You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generally, retrieving more than 60 pages would result in a status code 429 error in "loadPage" of EhRetriever.retrieve(). Maybe we should add some sleeping mechanism.
A naive version:
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
let fetchPage;
try {
const url = `${this.ehentaiHost}/api.php`;
const config = {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
// assign e = {'imgkey': ..., 'page': ...} to object literal {'method': ..., 'gid': ..., 'showkey': ...}
// does not modify e
body: JSON.stringify(Object.assign({
method: 'showpage',
gid: this.gallery.gid,
showkey: this.showkey
}, e))
};
let response = await this.fetch(url, config);
while (response.status == 429) {
await sleep(30000);
response = await this.fetch(url, config);
}
if (!response.ok) {
throw new Error(response.statusText);
}
fetchPage = await response.json();
} catch (error) {
console.warn(error);
throw error;
}
The text was updated successfully, but these errors were encountered:
Generally, retrieving more than 60 pages would result in a status code 429 error in "loadPage" of EhRetriever.retrieve(). Maybe we should add some sleeping mechanism.
A naive version:
The text was updated successfully, but these errors were encountered: