Skip to content

Commit

Permalink
Merge pull request #245 from NTFSvolume/fix_party_crawlers
Browse files Browse the repository at this point in the history
fix: prepare files before looping through them (coomer/kemono)
  • Loading branch information
jbsparrow authored Nov 7, 2024
2 parents b14d1c5 + 01677d4 commit dea9056
Show file tree
Hide file tree
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
Expand Up @@ -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:
Expand Down
7 changes: 5 additions & 2 deletions cyberdrop_dl/scraper/crawlers/kemono_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit dea9056

Please sign in to comment.