Skip to content

Commit

Permalink
Update WattpadParser
Browse files Browse the repository at this point in the history
  • Loading branch information
ImLJS committed Dec 14, 2024
1 parent 0415e5a commit b2d12cf
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions plugin/js/parsers/WattpadParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,9 @@ class WattpadParser extends Parser{
};

extractAuthor(dom) {
let authorLabel = dom.querySelector("div.author-info a.on-navigate");
if (authorLabel === null) {
return super.extractAuthor(dom)
}
let path = authorLabel.getAttribute("href").split("/");
return path[path.length - 1];
};
let authorLabel = dom.querySelector("div.o94Sz a");
return authorLabel?.textContent ?? super.extractAuthor(dom);
}

// custom cleanup of content
removeUnwantedElementsFromContentElement(element) {
Expand All @@ -183,6 +179,6 @@ class WattpadParser extends Parser{
}

findCoverImageUrl(dom) {
return util.getFirstImgSrc(dom, "div.story-cover");
return util.getFirstImgSrc(dom, "div[data-testid='cover']");
}
}

0 comments on commit b2d12cf

Please sign in to comment.