Fix broken Ward last chapter downloading

It's not clear when this started happening, but the "Next Chapter" link in Last 20.e6 no longer works.
This commit is contained in:
Domenic Denicola 2021-01-17 16:08:47 -05:00
commit 96e3e837e6
2 changed files with 10 additions and 3 deletions

View file

@ -65,14 +65,21 @@ function getNextChapterURL(rawChapterDoc) {
// - https://parahumans.wordpress.com/2012/04/21/sentinel-9-6/ // - 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. // So instead search for the first <a> within the main content area starting with "Next", trimmed.
let result = null;
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.trim().startsWith("Next")) { if (aEls[i].textContent.trim().startsWith("Next")) {
return aEls[i].href; result = aEls[i].href;
break;
} }
} }
return null; // Except, this doesn't always work, because the "Next Chapter" link in
// https://www.parahumans.net/2020/04/28/last-20-e6/ is just broken for some reason. We hard-code that.
if (result === "https://www.parahumans.net/?p=3365&preview=true") {
return "https://www.parahumans.net/2020/05/02/last-20-end/";
}
return result;
} }
function getChapterTitle(rawChapterDoc) { function getChapterTitle(rawChapterDoc) {

View file

@ -9128,7 +9128,7 @@
"after": "cross the ocean" "after": "cross the ocean"
} }
], ],
"https://www.parahumans.net/?p=3365&preview=true": [ "https://www.parahumans.net/2020/05/02/last-20-end/": [
{ {
"before": "saying dad had custody", "before": "saying dad had custody",
"after": "saying Dad had custody" "after": "saying Dad had custody"