fix(ReadWN): Implemented better chapter assumption #622
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ReadWN Scraper Improvement
I noticed several old ReadWN related bug reports of chapters not loading that were hard to reproduce.
I found one I was able to reproduce.
I traced the issue down to the fact all the chapterUrls are actually generated procedurally in our script (1..2..3..), but sometimes authors use different naming schemes (001...002...003).
This is janky. So, to fix this, I made it more janky.
Based on my observations on ReadWN, the first hundred chapters comfortably display by default, In probably 90% of usecases, the issue will be ironed out by chapter 100. So I have as many chapters as it can generate according to the table of contents, and then resume procedural generation from where it left off until the latest chapter of the novel.
In the test case I had, this fixed the issue perfectly.
I tested some other random novels on the paired sources, and they did not appear to have any issues.
As an added benefit, this allows partial chapters to display on the earlier chapters (25.26 or 5.5)
I am not aware of any cons compared to the current implementation, but if we could do a full table of contents pull that would be even better.
Fixes LNReader/lnreader-plugins#448
Fixes LNReader/lnreader-plugins#480
Fixes LNReader/lnreader-plugins#479
Fixes LNReader/lnreader-plugins#464 specifically, but won't fix it if there's chapter numbers off the first page written like this