Skip to content

Commit

Permalink
Merge pull request #1599 from ImLJS/dev - Update WattpadParser
Browse files Browse the repository at this point in the history
Update WattpadParser
  • Loading branch information
ImLJS authored Dec 14, 2024
2 parents 0415e5a + b2d12cf commit f4785cd
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 f4785cd

Please sign in to comment.