From d4e2f646abeba5a5777432cb22652472e4741174 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Tue, 26 Oct 2021 06:38:43 +0200 Subject: Added tag blacklist since the query limit was reached --- src/api/e926/index.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/api') diff --git a/src/api/e926/index.ts b/src/api/e926/index.ts index 8e363c9..301ad3f 100644 --- a/src/api/e926/index.ts +++ b/src/api/e926/index.ts @@ -7,6 +7,7 @@ export const dedupeDb = new PostDatabase("e926dedupe.json", 100); export interface GetPostQuery { tags: readonly string[]; + tagsBlacklist: readonly string[]; maxPage: number; } @@ -71,6 +72,11 @@ export async function getRandomPost(query: GetPostQuery): Promise { const postIndex = Math.floor(Math.random() * response.posts.length); const post = response.posts[postIndex]; + if (post.tags.general.some(tag => query.tagsBlacklist.includes(tag))) { + await delay(1000); + return getRandomPost(query); + } + if (config.e621.blacklist.includes(post.id)) { await delay(1000); return getRandomPost(query); -- cgit v1.2.3-70-g09d2