v2ray commited on
Commit
00eb151
·
1 Parent(s): 6eb0f05

Added support for the questionable rating.

Browse files
Files changed (2) hide show
  1. scrape_gel.py +4 -1
  2. scrape_yan.py +4 -1
scrape_gel.py CHANGED
@@ -47,7 +47,10 @@ async def process_link(thread_pool, session, image_url, image_ids_to_ignore, wid
47
  if tag_count < min_tags:
48
  # print(f"Image {image_id} doesn't have enough tags({tag_count} < {min_tags}), skipped.")
49
  return
50
- tags.append("nsfw" if image_container["data-rating"] in {"explicit", "questionable"} else "sfw")
 
 
 
51
  random.shuffle(tags)
52
  image_path = os.path.join(IMAGE_DIR, image_id + image_ext)
53
  tags_path = os.path.join(IMAGE_DIR, image_id + ".txt")
 
47
  if tag_count < min_tags:
48
  # print(f"Image {image_id} doesn't have enough tags({tag_count} < {min_tags}), skipped.")
49
  return
50
+ rating = image_container["data-rating"]
51
+ if rating == "explicit": tags.append("nsfw")
52
+ elif rating == "questionable": tags.append("qfw")
53
+ else: tags.append("sfw")
54
  random.shuffle(tags)
55
  image_path = os.path.join(IMAGE_DIR, image_id + image_ext)
56
  tags_path = os.path.join(IMAGE_DIR, image_id + ".txt")
scrape_yan.py CHANGED
@@ -40,7 +40,10 @@ async def process_link(thread_pool, session, image_object, image_ids_to_ignore,
40
  if tag_count < min_tags:
41
  # print(f"Image {image_id} doesn't have enough tags({tag_count} < {min_tags}), skipped.")
42
  return
43
- tags.append("nsfw" if image_object["rating"] in {"e", "q"} else "sfw")
 
 
 
44
  random.shuffle(tags)
45
  image_path = os.path.join(IMAGE_DIR, image_id + image_ext)
46
  tags_path = os.path.join(IMAGE_DIR, image_id + ".txt")
 
40
  if tag_count < min_tags:
41
  # print(f"Image {image_id} doesn't have enough tags({tag_count} < {min_tags}), skipped.")
42
  return
43
+ rating = image_object["rating"]
44
+ if rating == "e": tags.append("nsfw")
45
+ elif rating == "q": tags.append("qfw")
46
+ else: tags.append("sfw")
47
  random.shuffle(tags)
48
  image_path = os.path.join(IMAGE_DIR, image_id + image_ext)
49
  tags_path = os.path.join(IMAGE_DIR, image_id + ".txt")