Fix the downloads to not stop at Interlude 3½
Apparently encoding the request URL is no longer a good idea, and generates a 404. Also, properly bail on 404s, instead of just counting it as the last chapter.
This commit is contained in:
parent
876be19c8b
commit
28587c0de2
1 changed files with 7 additions and 5 deletions
|
|
@ -124,10 +124,12 @@ function retry(times, fn) {
|
|||
}
|
||||
|
||||
function downloadChapter(url) {
|
||||
// Necessary for https://parahumans.wordpress.com/2011/10/11/interlude-3½-bonus/
|
||||
const escapedUrl = encodeURI(url);
|
||||
|
||||
return retry(3, function () {
|
||||
return request(escapedUrl).redirects(10);
|
||||
return retry(3, () => {
|
||||
return request(url).redirects(10).then(response => {
|
||||
if (response.status !== 200) {
|
||||
throw new Error(`Response status for ${url} was ${response.status}`);
|
||||
}
|
||||
return response;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue