1
Fork 0

avoid 3/10,000,000 event

This commit is contained in:
Conduitry 2022-12-11 07:08:47 -05:00
parent 6de122ed6b
commit 92fb64675a
1 changed files with 3 additions and 3 deletions

View File

@ -4,10 +4,10 @@ import { dl, get } from './_shared.js';
await dl(
async function*(query) {
if (/^[0-9]+$/.test(query)) {
query = `id:${query}`;
} else if (/^[0-9a-f]{32}$/i.test(query)) {
if (/^[0-9a-f]{32}$/i.test(query)) {
query = `md5:${query}`;
} else if (/^[0-9]+$/.test(query)) {
query = `id:${query}`;
}
for (let page = null, posts; !posts || posts.length === 320; page = `b${posts[319]?.id}`) {
posts = (await (await get('https://e621.net/posts.json', { limit: 320, page, tags: query })).json()).posts;