Skip to content

Commit

Permalink
Merge pull request #1511 from gamebeaker/Add-fanfiction.com.br
Browse files Browse the repository at this point in the history
Add NyahFanfictionParser
  • Loading branch information
gamebeaker authored Sep 25, 2024
2 parents 77d6ad1 + 214693f commit d507e44
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
{ "name": "ktrin"},
{ "name": "Tyderion"},
{ "name": "nozwock"},
{ "name": "Darthagnon"}
{ "name": "Darthagnon"},
{ "name": "LucasFreitaslpf1"}
],
"license": "GPL-3.0-only",
"bugs": {
Expand Down
35 changes: 35 additions & 0 deletions plugin/js/parsers/NyahFanfictionParser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"use strict";

parserFactory.register("fanfiction.com.br", () => new NyahFanfictionParser());

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

async getChapterUrls(dom) {
let menu = dom.querySelector("div.container_chapter_list");
return util.hyperlinksToChapterList(menu);
}

findContent(dom) {
return dom.querySelector("div.historia");
}

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

extractAuthor(dom) {
let authorLabel = dom.querySelector("a.tooltip_userinfo");
return authorLabel?.textContent ?? super.extractAuthor(dom);
}

findCoverImageUrl(dom) {
return util.getFirstImgSrc(dom, "div#left_part");
}

getInformationEpubItemChildNodes(dom) {
return [...dom.querySelectorAll("p.justify")];
}
}
1 change: 1 addition & 0 deletions plugin/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,7 @@ <h3>Instructions</h3>
<script src="js/parsers/NovicetranslationsParser.js"></script>
<script src="js/parsers/NrvnqsrParser.js"></script>
<script src="js/parsers/NtruyenParser.js"></script>
<script src="js/parsers/NyahFanfictionParser.js"></script>
<script src="js/parsers/NyantlParser.js"></script>
<script src="js/parsers/OctopiiParser.js"></script>
<script src="js/parsers/OnlinenovelbookParser.js"></script>
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Credits
* nozwock
* Tyderion
* Darthagnon
* LucasFreitaslpf1

## How to use with Baka-Tsuki:
* Browse to a Baka-Tsuki web page that has the full text of a story.
Expand Down

0 comments on commit d507e44

Please sign in to comment.