diff --git a/lib/worm-scraper.js b/lib/worm-scraper.js index ccfba17..dba01a3 100644 --- a/lib/worm-scraper.js +++ b/lib/worm-scraper.js @@ -136,12 +136,14 @@ function cleanContentEl(el) { } function getNextChapterUrl(rawChapterDoc) { - // a[title="Next Chapter"] doesn't always work (e.g. https://parahumans.wordpress.com/2011/09/27/shell-4-2/) - // So instead search for the first within the main content area starting with "Next". + // a[title="Next Chapter"] doesn't always work. Two different pathologies: + // - 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 within the main content area starting with "Next", trimmed. const aEls = rawChapterDoc.querySelectorAll(".entry-content a"); 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; } }