Skip to content
Merged
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
31 changes: 29 additions & 2 deletions plugin/js/parsers/ScribblehubParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ parserFactory.register("scribblehub.com", () => new ScribblehubParser());
class ScribblehubParser extends Parser {
constructor() {
super();
this.minimumThrottle = 5000;
this.minimumThrottle = 5200;
}

async getChapterUrls(dom, chapterUrlsUI) {
this.tocURL = dom.baseURI;
let baseUrl = dom.baseURI;
let nextTocIndex = 1;
let numChapters = parseInt(dom.querySelector("span.cnt_toc").textContent);
Expand All @@ -20,7 +21,7 @@ class ScribblehubParser extends Parser {
: null;
};
let saveThrottle = this.minimumThrottle;
this.minimumThrottle = 0;
this.minimumThrottle = 500;
let chapters = (await this.walkTocPages(dom,
ScribblehubParser.getChapterUrlsFromTocPage,
nextTocPageUrl,
Expand All @@ -35,6 +36,32 @@ class ScribblehubParser extends Parser {
.map(a => util.hyperLinkToChapter(a));
}

async fetchChapter(url) {
let rules = [
{
id: 1,
priority: 1,
action: {
type: "modifyHeaders",
requestHeaders: [
{
header: "referer",
operation: "set",
value: this.tocURL,
},
],
},
condition: {
urlFilter: "*://www.scribblehub.com/*",
},
},
];

await HttpClient.setDeclarativeNetRequestRules(rules);

return (await HttpClient.wrapFetch(url)).responseXML;
}

findContent(dom) {
return dom.querySelector("div.fic_row, div#chp_raw");
}
Expand Down
Loading