Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NyahFanfictionParser #1511

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading