diff --git a/py34/list.py b/py34/list.py index 1e7d269..8bc44b7 100644 --- a/py34/list.py +++ b/py34/list.py @@ -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(" "), diff --git a/py34/scraper.py b/py34/scraper.py index 776bd05..01bcf06 100644 --- a/py34/scraper.py +++ b/py34/scraper.py @@ -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