1
Fork 0

support md5 and id queries in boorus

This commit is contained in:
Conduitry 2023-02-08 23:53:27 -05:00
parent 1fca797207
commit 0f1ff32170
1 changed files with 5 additions and 0 deletions

View File

@ -2,6 +2,11 @@ import { dl, get } from './_shared.js';
export const booru = (host, limit) => dl(
async function*(query) {
if (/^[0-9a-f]{32}$/i.test(query)) {
query = `md5:${query}`;
} else if (/^[0-9]+$/.test(query)) {
query = `id:${query}`;
}
for (let pid = 0, posts; !posts || posts.length === limit; pid++) {
posts = (await (await get(`https://${host}/index.php`, { page: 'dapi', s: 'post', q: 'index', limit, pid, tags: query })).text()).match(/<post\b.*?\/>/gs) || [];
yield posts.map(post => {