Check for invalid posts
This commit is contained in:
@ -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(" "),
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user