avoid 3/10,000,000 event

master
Conduitry 2 months ago
parent 6de122ed6b
commit 92fb64675a

@ -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;

Loading…
Cancel
Save