Skip to content

Commit

Permalink
fix: prepare files before looping through them
Browse files Browse the repository at this point in the history
NTFSvolume committed Nov 7, 2024
1 parent b14d1c5 commit 01677d4
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions cyberdrop_dl/scraper/crawlers/coomer_crawler.py
Original file line number Diff line number Diff line change
@@ -139,10 +139,13 @@ async def handle_file(file_obj):
add_parent=scrape_item.url.joinpath("post", post_id))

files = []
if post['file']:
if post.get('file'):
files.append(post['file'])

for file in files.extend(post['attachments']):
if post.get('attachments'):
files.extend(post['attachments'])

for file in files:
await handle_file(file)
scrape_item.children += 1
if scrape_item.children_limit:
7 changes: 5 additions & 2 deletions cyberdrop_dl/scraper/crawlers/kemono_crawler.py
Original file line number Diff line number Diff line change
@@ -146,10 +146,13 @@ async def handle_file(file_obj):
await self.create_new_scrape_item(link, scrape_item, user_str, post_title, post_id, date)

files = []
if post['file']:
if post.get('file'):
files.append(post['file'])

for file in files.extend(post['attachments']):
if post.get('attachments'):
files.extend(post['attachments'])

for file in files:
if scrape_item.children_limit:
if scrape_item.children >= scrape_item.children_limit:
raise ScrapeItemMaxChildrenReached(origin = scrape_item)

0 comments on commit 01677d4

Please sign in to comment.