Skip to content

Commit 9e70a76

Browse files
committed
refactor(ehentai): 返回结果尝试过滤评分只有 1 星的
1 parent 97a2c1c commit 9e70a76

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

YetAnotherPicSearch/ehentai.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,19 @@ async def search_result_filter(
9090
if priority[key] > 0 and len(res.raw) != len(group_list):
9191
res.raw = [i for i in res.raw if i not in group_list]
9292

93-
# 过滤那些无主题的杂图图集
93+
# 尝试过滤无主题的杂图图集
9494
if not_themeless_res := [i for i in res.raw if "themeless" not in " ".join(i.tags)]:
9595
res.raw = not_themeless_res
96-
# 优先找汉化版,并尝试过滤只有评分 1 星的结果;没找到就优先找原版
96+
# 尝试过滤评分只有 1 星的
97+
if not_1_star_res := [
98+
i for i in res.raw if ("-64px" not in PyQuery(i.origin)("div.ir").attr("style"))
99+
]:
100+
res.raw = not_1_star_res
101+
# 优先找汉化版;没找到就优先找原版
97102
if chinese_res := [
98103
i
99104
for i in res.raw
100-
if "translated" in " ".join(i.tags)
101-
and "chinese" in " ".join(i.tags)
102-
and ("-64px" not in PyQuery(i.origin)("div.ir").attr("style"))
105+
if "translated" in " ".join(i.tags) and "chinese" in " ".join(i.tags)
103106
]:
104107
selected_res = chinese_res[0]
105108
elif not_translated_res := [

0 commit comments

Comments
 (0)