Skip to content

Commit

Permalink
Try to get chapter URLs for Patreon
Browse files Browse the repository at this point in the history
See: #1198
  • Loading branch information
dteviot committed Feb 13, 2024
1 parent b7b1157 commit d2f6210
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions plugin/js/parsers/PatreonParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,16 @@ class PatreonParser extends Parser{
return this.walkToc(campaignId);
}

return [...dom.querySelectorAll("span[data-tag='post-title'] a")]
.map(a => util.hyperLinkToChapter(a)).reverse();
return [...dom.querySelectorAll("span[data-tag='post-title']")]
.map(s => this.spanToChapter(s)).reverse();
}

spanToChapter(span) {
let link = span.parentNode.nextElementSibling.querySelector("a");
return ({
title: span.textContent.trim(),
sourceUrl: link.href
});
}

findCampaignId(dom) {
Expand Down

0 comments on commit d2f6210

Please sign in to comment.