18 lines
650 B
JavaScript
Executable File
18 lines
650 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
import { dl } from './_dl.js';
|
|
|
|
await dl(
|
|
async function*(query, get) {
|
|
for (let pid = 0, posts; !posts || posts.length === 100; pid++) {
|
|
posts = (await (await get('https://furry.booru.org/index.php', { page: 'dapi', s: 'post', q: 'index', limit: 100, pid, tags: query })).text()).match(/<post\b.*?\/>/gs) || [];
|
|
yield posts.map(post => {
|
|
const url = post.match(/\bfile_url="(.*?)"/)[1];
|
|
const dest = `${query}/${post.match(/\bid="(.*?)"/)[1]}-${post.match(/\bmd5="(.*?)"/)[1]}.${url.match(/[^.]*$/)[0]}`;
|
|
const date = post.match(/\bcreated_at="(.*?)"/)[1];
|
|
return { url, dest, date };
|
|
});
|
|
}
|
|
},
|
|
);
|