Skip to content

Bulk asynchronous downloader for multiple file hosts

Fix gofile loose file detection (#626)

sublimal9a06d6ec46b7
diff --git a/cyberdrop_dl/scraper/crawlers/gofile_crawler.py b/cyberdrop_dl/scraper/crawlers/gofile_crawler.py
index be96cba54..a933bb259 100644
--- a/cyberdrop_dl/scraper/crawlers/gofile_crawler.py
+++ b/cyberdrop_dl/scraper/crawlers/gofile_crawler.py
@@ -78,14 +78,20 @@ class GoFileCrawler(Crawler):
json_resp = await self.client.get_json(self.domain, **api_query)
self.check_json_response(json_resp, scrape_item)
- title = self.create_title(json_resp["data"]["name"], content_id)
- scrape_item.add_to_parent_title(title)
+ json_data: dict = json_resp["data"]
+ name = json_data["name"]
+ title = self.create_title(name, content_id)
+ if json_data["childrenCount"] == 1 and name == json_data["code"] and scrape_item.type != FILE_HOST_ALBUM:
+ # Consider single files in autogenerated album as loose
+ scrape_item.part_of_album = False
+ else:
+ scrape_item.add_to_parent_title(title)
# Do not reset children inside nested folders
if scrape_item.type != FILE_HOST_ALBUM:
scrape_item.set_type(FILE_HOST_ALBUM, self.manager)
- children = json_resp["data"]["children"]
+ children = json_data["children"]
await self.handle_children(children, scrape_item)
"""~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"""