Skip to content

Commit

Permalink
Merge pull request #1600 from ImLJS/test
Browse files Browse the repository at this point in the history
Add Site mvlempyr
  • Loading branch information
ImLJS authored Dec 15, 2024
2 parents 965c0e6 + 13b5b6d commit cc27d12
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
54 changes: 54 additions & 0 deletions plugin/js/parsers/MvlempyrParser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"use strict";

parserFactory.register("mvlempyr.com", () => new MvlempyrParser());

class MvlempyrParser extends Parser {
constructor() {
super();
}

async getChapterUrls(dom) {
let imgLink = dom.querySelector("div.novel-image-wrapper img").src;
let slug = imgLink.split("/").pop().split(".")[0];
let chapterCount = parseInt(dom.querySelector("div#chapter-count").textContent);

let chapterList = [];

for (let i = 1; i <= chapterCount; i++) {
let link = `https://www.mvlempyr.com/chapter/${slug}-${i}`;
chapterList.push({
sourceUrl: link,
title: `Chapter ${i}`
});
}
return chapterList;
}

findContent(dom) {
return (
dom.querySelector("div#chapter") || dom.querySelector("#chapter-content")
);
}

extractTitleImpl(dom) {
return dom.querySelector("h1.novel-title");
}

extractAuthor(dom) {
let authorLabel = dom.querySelector("div.novelinfo .text-block-9");
return authorLabel?.textContent ?? super.extractAuthor(dom);
}

findChapterTitle(dom) {
return dom.querySelector("#span-28-164").textContent;
}

findCoverImageUrl(dom) {
return util.getFirstImgSrc(dom, "div.novel-image-wrapper");
}

getInformationEpubItemChildNodes(dom) {
return [...dom.querySelectorAll("div.synopsis")];
}

}
1 change: 1 addition & 0 deletions plugin/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,7 @@ <h3>Instructions</h3>
<script src="js/parsers/MtnovelParser.js"></script>
<script src="js/parsers/MoonQuillParser.js"></script>
<script src="js/parsers/MuggleNetParser.js"></script>
<script src="js/parsers/MvlempyrParser.js"></script>
<script src="js/parsers/MyxlsParser.js"></script>
<script src="js/parsers/NanodesuParser.js"></script>
<script src="js/parsers/NanomashinonlineParser.js"></script>
Expand Down

0 comments on commit cc27d12

Please sign in to comment.