Skip to content

Commit 6a9e88b

Browse files
authored
Merge pull request #2618 from nitramkh/fix/remove_garbage_from_lunoxscans_com
Remove header/footer from https://lunoxscans.com/ content See: #2554
2 parents 6fb4f3c + a628f2c commit 6a9e88b

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

plugin/js/parsers/LunoxscansParser.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ parserFactory.register("lunoxscans.com", () => new LunoxscansParser());
77
*/
88
class LunoxscansParser extends MadaraParser {
99
/**
10+
* @override
1011
* @param { Document } dom
1112
*/
1213
async getChapterUrls(dom) {
@@ -22,6 +23,20 @@ class LunoxscansParser extends MadaraParser {
2223
}
2324

2425
/**
26+
* @override
27+
* @param { HTMLElement } dom
28+
*/
29+
removeUnwantedElementsFromContentElement(dom) {
30+
/** @type { NodeListOf<HTMLSpanElement> } */
31+
const suspects = dom.querySelectorAll("p:first-of-type, p:last-of-type");
32+
33+
[...suspects]
34+
.filter(suspect => suspect.textContent.includes("Lunox"))
35+
.forEach(suspect => suspect.remove());
36+
}
37+
38+
/**
39+
* @override
2540
* @param { Document } dom
2641
*/
2742
extractTitleImpl(dom) {

0 commit comments

Comments
 (0)