Check for invalid posts

This commit is contained in:
2025-08-02 23:23:21 +02:00
parent bebb39e722
commit 1cc617aeda
2 changed files with 9 additions and 2 deletions

View File

@ -31,6 +31,13 @@ class List:
if str(entry).strip() == "": continue
if entry.name != "span": continue
# Get ID
post_id = int(entry["id"][1:])
# Rule34 displays invalid posts when near 1
if post_id < 1:
continue
# Extract image
img = entry.find_all("img")[0]
if "src" in img.attrs:
@ -40,7 +47,7 @@ class List:
# Append post
self.posts.append(Post(
int(entry["id"][1:]),
post_id,
img_src.dir,
img_src.id,
img["alt"].split(" "),

View File

@ -7,7 +7,7 @@ from bs4 import BeautifulSoup
class ScraperException(Exception):
def __init__(self, res: Response, *argv: any):
super(*argv)
super(Exception, *argv)
self.response = res