Skip to content

Fix FreeWebNovel extractor for new AJAX chapter pagination system#2747

Merged
dteviot merged 11 commits into
dteviot:ExperimentalTabModefrom
fake-name:ExperimentalTabMode
Jul 1, 2026
Merged

Fix FreeWebNovel extractor for new AJAX chapter pagination system#2747
dteviot merged 11 commits into
dteviot:ExperimentalTabModefrom
fake-name:ExperimentalTabMode

Conversation

@fake-name

@fake-name fake-name commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

This should fix the issue with FreeWebNovel.com now paginating their chapter listing.

This also includes a couple of other assorted tweaks, mostly related to content cleanup.

The source site inserts "FreeWebnovel.com" in the text a bunch using unicode math alternative chars. NFKD normalization detects that, and they are stripped (including one case where the markup is reewebnovel.com. Typos in watermarks! Also lol, watermarking content the site has itself stolen)!

There's also some cleanup of advertisements, as well as fixing some broken source content, where HTML tags got accidentally escaped somehow. (This site is a pirate aggregator, and apparently their scraper for the actual source sites is slightly broken in some cases)

Anyways, tests pass, and the couple novels I experimentally fetched all seem to work now.

Disclosure: I used LLM tools to generate this, though I did read the actual scraper JS file pretty carefully and made some edits. Less so much the tests (though they do pass!).

Should fix #2745

@fake-name

Copy link
Copy Markdown
Contributor Author

Ok, minor additional tweak.

I added a pre-start check for DOMPurify and zip.js. Mostly because you can in fact install the plugin from a git clone without those dependencies, and if you do so it works fine..... right up until the last moment where it fails to generate epub files.

Which is nice if you're fetching a series with 900+ chapters. At one chapter every 25 seconds.

Anyways, now it pops a warning if they're not present and loaded.

@dteviot dteviot left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Firstly, thank you very much for your hard work.

I'd love to accept this as it stands and I'd fix the minor issues myself. But the innerHTML is a killer. That said, if you'd like me to try and fix that one, I'll have a go.

Comment thread plugin/js/parsers/FreeWebNovelParser.js Outdated
let parent = tNode.parentNode;
if (parent) {
let tempSpan = content.ownerDocument.createElement("span");
tempSpan.innerHTML = tNode.nodeValue;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't do assignment to innerHTML. Extensions will be rejected for doing this.

Comment thread plugin/js/parsers/FreeWebNovelParser.js Outdated
removeUnwantedElementsFromContentElement(content) {
// Remove ads injected by third-party ad networks (such as SSP ads and PubFuture networks)
// whose div IDs start with 'bg-ssp-' or 'pf-'
util.removeChildElementsMatchingSelector(content, "div[id^='bg-ssp-']");

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can combine the selectors with a comma. e.g.

util.removeChildElementsMatchingSelector(content, "div[id^='bg-ssp-' ], div[id^='pf-']");

Comment thread plugin/js/parsers/FreeWebNovelParser.js Outdated
let url = `${baseNovelUrl}?ajax=chapters&page=${page}`;
try {
let response = await HttpClient.fetchJson(url);
if (response && response.json && response.json.code === 200 && response.json.html) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use null chaining operator

if (response?.json?.code === 200

Comment thread plugin/manifest.json Outdated
"manifest_version": 3,
"name": "WebToEpub",
"version": "1.0.12.75",
"version": "1.0.12.77",

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not be bumping this. Build process does it. But it won't hurt.

@fake-name fake-name Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build process did this. And then pushed it to my branch. Somehow.

0cda6a0 and afa8d0f are both by github-actions[bot]

@fake-name

Copy link
Copy Markdown
Contributor Author

Ok, I think that should address all the feedback.

Of course, now I expect the bot will bump the version again

@dteviot dteviot merged commit f7544d2 into dteviot:ExperimentalTabMode Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Freewebnovel- only first 40 chapters

2 participants