Take care of another broken Next Chapter pathology
This commit is contained in:
parent
1e346e7f9c
commit
972fcaa294
1 changed files with 5 additions and 3 deletions
|
|
@ -136,12 +136,14 @@ function cleanContentEl(el) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNextChapterUrl(rawChapterDoc) {
|
function getNextChapterUrl(rawChapterDoc) {
|
||||||
// a[title="Next Chapter"] doesn't always work (e.g. https://parahumans.wordpress.com/2011/09/27/shell-4-2/)
|
// a[title="Next Chapter"] doesn't always work. Two different pathologies:
|
||||||
// So instead search for the first <a> within the main content area starting with "Next".
|
// - https://parahumans.wordpress.com/2011/09/27/shell-4-2/
|
||||||
|
// - https://parahumans.wordpress.com/2012/04/21/sentinel-9-6/
|
||||||
|
// So instead search for the first <a> within the main content area starting with "Next", trimmed.
|
||||||
|
|
||||||
const aEls = rawChapterDoc.querySelectorAll(".entry-content a");
|
const aEls = rawChapterDoc.querySelectorAll(".entry-content a");
|
||||||
for (let i = 0; i < aEls.length; ++i) {
|
for (let i = 0; i < aEls.length; ++i) {
|
||||||
if (aEls[i].textContent.startsWith("Next")) {
|
if (aEls[i].textContent.trim().startsWith("Next")) {
|
||||||
return aEls[i].href;
|
return aEls[i].href;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue