Skip to content

Commit

Permalink
Spacebattles, award links are not chapters
Browse files Browse the repository at this point in the history
Fix: Spacebattles award links on threadmarks are picked up
as chapter URLs.

See: dteviot#1335
  • Loading branch information
dteviot committed Jun 4, 2024
1 parent dd07723 commit 73d50b6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion plugin/js/parsers/SpacebattlesParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ class SpacebattlesParser extends Parser{

async getChapterUrls(dom) {
let chapters = [...dom.querySelectorAll("div.structItem--threadmark a")]
.filter(a => !a.querySelector("date"));
.filter(this.isLinkToChapter);
return chapters.map(a => util.hyperLinkToChapter(a));
};

isLinkToChapter(link) {
return !link.querySelector("date")
&& !(new URL(link.href).pathname.startsWith("/awards/award"));
}

findContent(dom) {
return Parser.findConstrutedContent(dom);
};
Expand Down

0 comments on commit 73d50b6

Please sign in to comment.