dl-e621: support downloading posts by ID or MD5

master
Conduitry 3 months ago
parent d472b8e360
commit dd05ab91b3
  1. 5
      dl-e621.js

@ -4,6 +4,11 @@ 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)) {
query = `md5:${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;
yield posts.map(post => ({

Loading…
Cancel
Save