summaryrefslogtreecommitdiffstats
path: root/src/api/e926
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/e926')
-rw-r--r--src/api/e926/index.ts6
1 files changed, 6 insertions, 0 deletions
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);
7 7
8export interface GetPostQuery { 8export interface GetPostQuery {
9 tags: readonly string[]; 9 tags: readonly string[];
10 tagsBlacklist: readonly string[];
10 maxPage: number; 11 maxPage: number;
11} 12}
12 13
@@ -71,6 +72,11 @@ export async function getRandomPost(query: GetPostQuery): Promise<Post> {
71 const postIndex = Math.floor(Math.random() * response.posts.length); 72 const postIndex = Math.floor(Math.random() * response.posts.length);
72 const post = response.posts[postIndex]; 73 const post = response.posts[postIndex];
73 74
75 if (post.tags.general.some(tag => query.tagsBlacklist.includes(tag))) {
76 await delay(1000);
77 return getRandomPost(query);
78 }
79
74 if (config.e621.blacklist.includes(post.id)) { 80 if (config.e621.blacklist.includes(post.id)) {
75 await delay(1000); 81 await delay(1000);
76 return getRandomPost(query); 82 return getRandomPost(query);