Skip to content

Commit

Permalink
Add Site mvlempyr
Browse files Browse the repository at this point in the history
  • Loading branch information
ImLJS committed Dec 15, 2024
1 parent 965c0e6 commit 13b5b6d
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 13b5b6d

Please sign in to comment.