Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
cleanup new_scrape_item creation, transfer possible_datetime in all instances
Jules-WinnfieldXc743587ee266
diff --git a/cyberdrop_dl/scraper/crawlers/bunkr_crawler.py b/cyberdrop_dl/scraper/crawlers/bunkr_crawler.pyindex c44fd0c6c..1402c53e8 100644--- a/cyberdrop_dl/scraper/crawlers/bunkr_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/bunkr_crawler.py@@ -54,13 +54,13 @@ class BunkrCrawler(Crawler):card_listings = soup.select('div[class*="grid-images_box rounded-lg"]')for card_listing in card_listings:file = card_listing.select_one('a[class*="grid-images_box-link"]')- date = card_listing.select_one('p[class*="date"]').text+ date = await self.parse_datetime(card_listing.select_one('p[class*="date"]').text)link = file.get("href")if link.startswith("/"):link = URL("https://" + scrape_item.url.host + link)link = URL(link)link = await self.get_stream_link(link)- await self.scraper_queue.put(ScrapeItem(url=link, parent_title=scrape_item.parent_title, part_of_album=True, possible_datetime=await self.parse_datetime(date)))+ await self.scraper_queue.put(ScrapeItem(link, scrape_item.parent_title, True, date))@error_handling_wrapperasync def video(self, scrape_item: ScrapeItem) -> None:diff --git a/cyberdrop_dl/scraper/crawlers/coomer_crawler.py b/cyberdrop_dl/scraper/crawlers/coomer_crawler.pyindex d526b0efa..ad209d7b7 100644--- a/cyberdrop_dl/scraper/crawlers/coomer_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/coomer_crawler.py@@ -123,7 +123,7 @@ class CoomerCrawler(Crawler):if self.manager.config_manager.settings_data['Download_Options']['include_album_id_in_folder_name']:post_title = post_id + " - " + post_title- new_scrape_item = ScrapeItem(link, old_scrape_item.parent_title, True, possible_datetime=await self.parse_datetime(date))+ new_scrape_item = ScrapeItem(link, old_scrape_item.parent_title, True, await self.parse_datetime(date))await new_scrape_item.add_to_parent_title(f"{user} ({self.folder_domain})")await new_scrape_item.add_to_parent_title(post_title)await self.scraper_queue.put(new_scrape_item)diff --git a/cyberdrop_dl/scraper/crawlers/cyberdrop_crawler.py b/cyberdrop_dl/scraper/crawlers/cyberdrop_crawler.pyindex c076195b3..69d756975 100644--- a/cyberdrop_dl/scraper/crawlers/cyberdrop_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/cyberdrop_crawler.py@@ -52,7 +52,7 @@ class CyberdropCrawler(Crawler):link = self.primary_base_url.with_path(link)link = URL(link)- new_scrape_item = ScrapeItem(link, parent_title=scrape_item.parent_title, part_of_album=True, possible_datetime=date)+ new_scrape_item = ScrapeItem(link, scrape_item.parent_title, True, date)await new_scrape_item.add_to_parent_title(title)await self.scraper_queue.put(new_scrape_item)diff --git a/cyberdrop_dl/scraper/crawlers/cyberfile_crawler.py b/cyberdrop_dl/scraper/crawlers/cyberfile_crawler.pyindex 9eeeef046..93d2db8cf 100644--- a/cyberdrop_dl/scraper/crawlers/cyberfile_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/cyberfile_crawler.py@@ -70,7 +70,7 @@ class CyberfileCrawler(Crawler):await log(f"Couldn't find folder or file id for {scrape_item.url} element")continue- new_scrape_item = ScrapeItem(url=link, parent_title=scrape_item.parent_title, part_of_album=True)+ new_scrape_item = ScrapeItem(link, scrape_item.parent_title, True, scrape_item.possible_datetime)await new_scrape_item.add_to_parent_title(title)await self.scraper_queue.put(new_scrape_item)@@ -106,7 +106,7 @@ class CyberfileCrawler(Crawler):await log(f"Couldn't find folder or file id for {scrape_item.url} element")continue- new_scrape_item = ScrapeItem(url=link, parent_title=scrape_item.parent_title, part_of_album=True)+ new_scrape_item = ScrapeItem(link, scrape_item.parent_title, True, scrape_item.possible_datetime)await new_scrape_item.add_to_parent_title(title)await self.scraper_queue.put(new_scrape_item)diff --git a/cyberdrop_dl/scraper/crawlers/ehentai_crawler.py b/cyberdrop_dl/scraper/crawlers/ehentai_crawler.pyindex d9638d294..f1c7611ee 100644--- a/cyberdrop_dl/scraper/crawlers/ehentai_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/ehentai_crawler.py@@ -48,7 +48,7 @@ class EHentaiCrawler(Crawler):images = soup.select("div[class=gdtm] div a")for image in images:link = URL(image.get('href'))- new_scrape_item = ScrapeItem(url=link, parent_title=scrape_item.parent_title, part_of_album=True, possible_datetime=date)+ new_scrape_item = ScrapeItem(link, scrape_item.parent_title, True, date)await new_scrape_item.add_to_parent_title(title)await self.scraper_queue.put(new_scrape_item)@@ -61,7 +61,7 @@ class EHentaiCrawler(Crawler):if next_page is not None:next_page = URL(next_page.get('href'))if next_page is not None:- new_scrape_item = ScrapeItem(url=next_page, parent_title=scrape_item.parent_title)+ new_scrape_item = ScrapeItem(next_page, scrape_item.parent_title, possible_datetime=scrape_item.possible_datetime)await self.scraper_queue.put(new_scrape_item)@error_handling_wrapperdiff --git a/cyberdrop_dl/scraper/crawlers/erome_crawler.py b/cyberdrop_dl/scraper/crawlers/erome_crawler.pyindex 08e3a9f6d..018e03ada 100644--- a/cyberdrop_dl/scraper/crawlers/erome_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/erome_crawler.py@@ -42,14 +42,14 @@ class EromeCrawler(Crawler):for album in albums:link = URL(album['href'])- new_scrape_item = ScrapeItem(url=link, parent_title=scrape_item.parent_title, part_of_album=True)+ new_scrape_item = ScrapeItem(link, scrape_item.parent_title, True, scrape_item.possible_datetime)await new_scrape_item.add_to_parent_title(title)await self.scraper_queue.put(new_scrape_item)next_page = soup.select_one('a[rel="next"]')if next_page:next_page = next_page.get("href").split("page=")[-1]- new_scrape_item = ScrapeItem(url=scrape_item.url.with_query(f"page={next_page}"), parent_title=scrape_item.parent_title)+ new_scrape_item = ScrapeItem(scrape_item.url.with_query(f"page={next_page}"), scrape_item.parent_title, possible_datetime=scrape_item.possible_datetime)await self.scraper_queue.put(new_scrape_item)@error_handling_wrapperdiff --git a/cyberdrop_dl/scraper/crawlers/fapello_crawler.py b/cyberdrop_dl/scraper/crawlers/fapello_crawler.pyindex 858177128..189c15b44 100644--- a/cyberdrop_dl/scraper/crawlers/fapello_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/fapello_crawler.py@@ -49,11 +49,11 @@ class FapelloCrawler(Crawler):if "javascript" in post.get('href'):video_tag = post.select_one('iframe')video_link = URL(video_tag.get('src'))- new_scrape_item = ScrapeItem(video_link, scrape_item.parent_title, part_of_album=True)+ new_scrape_item = ScrapeItem(video_link, scrape_item.parent_title, True, scrape_item.possible_datetime)await self.manager.queue_manager.url_objects_to_map.put(new_scrape_item)else:link = URL(post.get('href'))- new_scrape_item = ScrapeItem(link, scrape_item.parent_title, part_of_album=True)+ new_scrape_item = ScrapeItem(link, scrape_item.parent_title, True, scrape_item.possible_datetime)await new_scrape_item.add_to_parent_title(title)await self.scraper_queue.put(new_scrape_item)diff --git a/cyberdrop_dl/scraper/crawlers/gofile_crawler.py b/cyberdrop_dl/scraper/crawlers/gofile_crawler.pyindex 2581506d6..6ac418a18 100644--- a/cyberdrop_dl/scraper/crawlers/gofile_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/gofile_crawler.py@@ -72,7 +72,7 @@ class GoFileCrawler(Crawler):for content_id in contents:content = contents[content_id]if content["type"] == "folder":- new_scrape_item = ScrapeItem(scrape_item.url.with_name(content["name"]), scrape_item.parent_title, True)+ new_scrape_item = ScrapeItem(scrape_item.url.with_name(content["name"]), scrape_item.parent_title, True, scrape_item.possible_datetime)await new_scrape_item.add_to_parent_title(title)await self.scraper_queue.put(new_scrape_item)continuediff --git a/cyberdrop_dl/scraper/crawlers/imageban_crawler.py b/cyberdrop_dl/scraper/crawlers/imageban_crawler.pyindex 6fce46945..4df16c4c8 100644--- a/cyberdrop_dl/scraper/crawlers/imageban_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/imageban_crawler.py@@ -57,7 +57,7 @@ class ImageBanCrawler(Crawler):link = URL("https://" + scrape_item.url.host + link_path)else:link = URL(link_path)- new_scrape_item = ScrapeItem(url=link, parent_title=scrape_item.parent_title, part_of_album=True)+ new_scrape_item = ScrapeItem(link, scrape_item.parent_title, True, scrape_item.possible_datetime)await new_scrape_item.add_to_parent_title(title)await self.scraper_queue.put(new_scrape_item)@@ -68,7 +68,7 @@ class ImageBanCrawler(Crawler):link = URL("https://" + scrape_item.url.host + link_path)else:link = URL(link_path)- new_scrape_item = ScrapeItem(url=link, parent_title=scrape_item.parent_title, part_of_album=True)+ new_scrape_item = ScrapeItem(link, scrape_item.parent_title, True, scrape_item.possible_datetime)await self.scraper_queue.put(new_scrape_item)@error_handling_wrapperdiff --git a/cyberdrop_dl/scraper/crawlers/imgkiwi_crawler.py b/cyberdrop_dl/scraper/crawlers/imgkiwi_crawler.pyindex a26d1e868..77663090c 100644--- a/cyberdrop_dl/scraper/crawlers/imgkiwi_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/imgkiwi_crawler.py@@ -51,7 +51,7 @@ class ImgKiwiCrawler(Crawler):links = soup.select("a[href*=image]")for link in links:link = URL(link.get('href'))- new_scrape_item = ScrapeItem(link, parent_title=scrape_item.parent_title, part_of_album=True)+ new_scrape_item = ScrapeItem(link, scrape_item.parent_title, True, scrape_item.possible_datetime)await new_scrape_item.add_to_parent_title(title)await self.scraper_queue.put(new_scrape_item)diff --git a/cyberdrop_dl/scraper/crawlers/imgur_crawler.py b/cyberdrop_dl/scraper/crawlers/imgur_crawler.pyindex bc166f0c6..d675fb63e 100644--- a/cyberdrop_dl/scraper/crawlers/imgur_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/imgur_crawler.py@@ -62,7 +62,7 @@ class ImgurCrawler(Crawler):for image in JSON_Obj["data"]:link = URL(image["link"])date = image["datetime"]- new_scrape_object = ScrapeItem(url=link, parent_title=scrape_item.parent_title, part_of_album=True, possible_datetime=date)+ new_scrape_object = ScrapeItem(link, scrape_item.parent_title, True, date)await new_scrape_object.add_to_parent_title(title)await self.handle_direct(new_scrape_object)@@ -80,7 +80,7 @@ class ImgurCrawler(Crawler):date = JSON_Obj["data"]["datetime"]link = URL(JSON_Obj["data"]["link"])- new_scrape_object = ScrapeItem(url=link, parent_title=scrape_item.parent_title, possible_datetime=date)+ new_scrape_object = ScrapeItem(link, scrape_item.parent_title, possible_datetime=date)await self.handle_direct(new_scrape_object)@error_handling_wrapperdiff --git a/cyberdrop_dl/scraper/crawlers/jpgchurch_crawler.py b/cyberdrop_dl/scraper/crawlers/jpgchurch_crawler.pyindex 3f3faa9b9..5040873d6 100644--- a/cyberdrop_dl/scraper/crawlers/jpgchurch_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/jpgchurch_crawler.py@@ -49,7 +49,7 @@ class JPGChurchCrawler(Crawler):albums = soup.select("a[class='image-container --media']")for album in albums:sub_album_link = URL(album.get('href'))- new_scrape_item = ScrapeItem(sub_album_link, parent_title=scrape_item.parent_title, part_of_album=True)+ new_scrape_item = ScrapeItem(sub_album_link, scrape_item.parent_title, True, scrape_item.possible_datetime)await new_scrape_item.add_to_parent_title(title)await self.scraper_queue.put(new_scrape_item)@@ -63,7 +63,7 @@ class JPGChurchCrawler(Crawler):links = soup.select("a[href*=img]")for link in links:link = URL(link.get('href'))- new_scrape_item = ScrapeItem(link, parent_title=scrape_item.parent_title, part_of_album=True)+ new_scrape_item = ScrapeItem(link, scrape_item.parent_title, True, scrape_item.possible_datetime)await new_scrape_item.add_to_parent_title(title)await self.scraper_queue.put(new_scrape_item)diff --git a/cyberdrop_dl/scraper/crawlers/kemono_crawler.py b/cyberdrop_dl/scraper/crawlers/kemono_crawler.pyindex 251bcfc4f..2216e3b79 100644--- a/cyberdrop_dl/scraper/crawlers/kemono_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/kemono_crawler.py@@ -140,7 +140,7 @@ class KemonoCrawler(Crawler):if self.manager.config_manager.settings_data['Download_Options']['include_album_id_in_folder_name']:post_title = post_id + " - " + post_title- new_scrape_item = ScrapeItem(link, old_scrape_item.parent_title, True, possible_datetime=await self.parse_datetime(date))+ new_scrape_item = ScrapeItem(link, old_scrape_item.parent_title, True, await self.parse_datetime(date))await new_scrape_item.add_to_parent_title(f"{user} ({self.folder_domain})")await new_scrape_item.add_to_parent_title(post_title)await self.scraper_queue.put(new_scrape_item)diff --git a/cyberdrop_dl/scraper/crawlers/mediafire_crawler.py b/cyberdrop_dl/scraper/crawlers/mediafire_crawler.pyindex 468175cfc..261fbfef6 100644--- a/cyberdrop_dl/scraper/crawlers/mediafire_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/mediafire_crawler.py@@ -52,7 +52,7 @@ class MediaFireCrawler(Crawler):for file in files:date = await self.parse_datetime(file['created'])link = URL(file['links']['normal_download'])- new_scrape_item = ScrapeItem(link, parent_title=scrape_item.parent_title, part_of_album=True, possible_datetime=date)+ new_scrape_item = ScrapeItem(link, scrape_item.parent_title, True, date)await new_scrape_item.add_to_parent_title(title)await self.scraper_queue.put(new_scrape_item)diff --git a/cyberdrop_dl/scraper/crawlers/nudostartv_crawler.py b/cyberdrop_dl/scraper/crawlers/nudostartv_crawler.pyindex 067bf050d..69832c6b3 100644--- a/cyberdrop_dl/scraper/crawlers/nudostartv_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/nudostartv_crawler.py@@ -39,13 +39,13 @@ class NudoStarTVCrawler(Crawler):content = soup.select('div[id=list_videos_common_videos_list_items] div a')for page in content:link = URL(page.get('href'))- new_scrape_item = ScrapeItem(link, scrape_item.parent_title, part_of_album=True)+ new_scrape_item = ScrapeItem(link, scrape_item.parent_title, True, scrape_item.possible_datetime)await new_scrape_item.add_to_parent_title(title)await self.image(new_scrape_item)next_page = soup.select_one('li[class=next] a')if next_page:link = URL(next_page.get('href'))- new_scrape_item = ScrapeItem(link, scrape_item.parent_title)+ new_scrape_item = ScrapeItem(link, scrape_item.parent_title, possible_datetime=scrape_item.possible_datetime)await self.scraper_queue.put(new_scrape_item)@error_handling_wrapperdiff --git a/cyberdrop_dl/scraper/crawlers/pimpandhost_crawler.py b/cyberdrop_dl/scraper/crawlers/pimpandhost_crawler.pyindex 9b7650410..bf9d8f69d 100644--- a/cyberdrop_dl/scraper/crawlers/pimpandhost_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/pimpandhost_crawler.py@@ -46,7 +46,7 @@ class PimpAndHostCrawler(Crawler):files = soup.select('a[class*="image-wrapper center-cropped im-wr"]')for file in files:link = URL(file.get("href"))- new_scrape_item = ScrapeItem(link, scrape_item.parent_title, part_of_album=True, possible_datetime=date)+ new_scrape_item = ScrapeItem(link, scrape_item.parent_title, True, date)await new_scrape_item.add_to_parent_title(title)await self.scraper_queue.put(new_scrape_item)@@ -55,7 +55,7 @@ class PimpAndHostCrawler(Crawler):next_page = next_page.get("href")if next_page.startswith("/"):next_page = URL("https://pimpandhost.com" + next_page)- new_scrape_item = ScrapeItem(next_page, scrape_item.parent_title, part_of_album=True, possible_datetime=date)+ new_scrape_item = ScrapeItem(next_page, scrape_item.parent_title, True, date)await self.scraper_queue.put(new_scrape_item)@error_handling_wrapper@@ -71,7 +71,7 @@ class PimpAndHostCrawler(Crawler):date = soup.select_one("span[class=date-time]").get("title")date = await self.parse_datetime(date)- new_scrape_item = ScrapeItem(link, scrape_item.parent_title, part_of_album=True, possible_datetime=date)+ new_scrape_item = ScrapeItem(link, scrape_item.parent_title, True, date)filename, ext = await get_filename_and_ext(link.name)await self.handle_file(link, new_scrape_item, filename, ext)diff --git a/cyberdrop_dl/scraper/crawlers/pixeldrain_crawler.py b/cyberdrop_dl/scraper/crawlers/pixeldrain_crawler.pyindex b4ba31e66..64ab42fbd 100644--- a/cyberdrop_dl/scraper/crawlers/pixeldrain_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/pixeldrain_crawler.py@@ -46,7 +46,7 @@ class PixelDrainCrawler(Crawler):link = await self.create_download_link(file['id'])date = await self.parse_datetime(file['date_upload'].replace("T", " ").split(".")[0])filename, ext = await get_filename_and_ext(file['name'])- new_scrape_item = ScrapeItem(link, scrape_item.parent_title, part_of_album=True, possible_datetime=date)+ new_scrape_item = ScrapeItem(link, scrape_item.parent_title, True, date)await new_scrape_item.add_to_parent_title(title)await self.handle_file(link, new_scrape_item, filename, ext)@@ -59,7 +59,7 @@ class PixelDrainCrawler(Crawler):link = await self.create_download_link(JSON_Resp['id'])date = await self.parse_datetime(JSON_Resp['date_upload'].replace("T", " ").split(".")[0])filename, ext = await get_filename_and_ext(JSON_Resp['name'])- new_scrape_item = ScrapeItem(link, scrape_item.parent_title, part_of_album=scrape_item.part_of_album, possible_datetime=date)+ new_scrape_item = ScrapeItem(link, scrape_item.parent_title, scrape_item.part_of_album, date)await self.handle_file(link, new_scrape_item, filename, ext)"""~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"""diff --git a/cyberdrop_dl/scraper/crawlers/postimg_crawler.py b/cyberdrop_dl/scraper/crawlers/postimg_crawler.pyindex 32f091a5e..22155addd 100644--- a/cyberdrop_dl/scraper/crawlers/postimg_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/postimg_crawler.py@@ -50,7 +50,7 @@ class PostImgCrawler(Crawler):for image in JSON_Resp['images']:link = URL(image[4])filename, ext = image[2], image[3]- new_scrape_item = ScrapeItem(link, scrape_item.parent_title, part_of_album=True)+ new_scrape_item = ScrapeItem(link, scrape_item.parent_title, True, scrape_item.possible_datetime)await new_scrape_item.add_to_parent_title(title)await self.handle_file(link, new_scrape_item, filename, ext)diff --git a/cyberdrop_dl/scraper/crawlers/reddit_crawler.py b/cyberdrop_dl/scraper/crawlers/reddit_crawler.pyindex da74a88a1..399cc22d3 100644--- a/cyberdrop_dl/scraper/crawlers/reddit_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/reddit_crawler.py@@ -121,7 +121,7 @@ class RedditCrawler(Crawler):async def create_new_scrape_item(self, link: URL, old_scrape_item: ScrapeItem, title: str, date: int) -> ScrapeItem:"""Creates a new scrape item with the same parent as the old scrape item"""- new_scrape_item = ScrapeItem(link, old_scrape_item.parent_title, True, possible_datetime=date)+ new_scrape_item = ScrapeItem(link, old_scrape_item.parent_title, True, date)if self.manager.config_manager.settings_data['Download_Options']['separate_posts']:await new_scrape_item.add_to_parent_title(title)return new_scrape_itemdiff --git a/cyberdrop_dl/scraper/crawlers/redgifs_crawler.py b/cyberdrop_dl/scraper/crawlers/redgifs_crawler.pyindex bb4e3d295..b7ca4d304 100644--- a/cyberdrop_dl/scraper/crawlers/redgifs_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/redgifs_crawler.py@@ -56,7 +56,7 @@ class RedGifsCrawler(Crawler):else:link = URL(links["sd"])- new_scrape_item = ScrapeItem(link, parent_title=scrape_item.parent_title, part_of_album=True)+ new_scrape_item = ScrapeItem(link, scrape_item.parent_title, True, scrape_item.possible_datetime)await self.scraper_queue.put(new_scrape_item)page += 1diff --git a/cyberdrop_dl/scraper/crawlers/xbunkr_crawler.py b/cyberdrop_dl/scraper/crawlers/xbunkr_crawler.pyindex 7866cea13..0bc2bebef 100644--- a/cyberdrop_dl/scraper/crawlers/xbunkr_crawler.py+++ b/cyberdrop_dl/scraper/crawlers/xbunkr_crawler.py@@ -49,6 +49,6 @@ class XBunkrCrawler(Crawler):except NoExtensionFailure:await log(f"Couldn't get extension for {str(link)}")continue- new_scrape_item = ScrapeItem(url=link, parent_title=scrape_item.parent_title, part_of_album=True)+ new_scrape_item = ScrapeItem(link, scrape_item.parent_title, True, scrape_item.possible_datetime)await new_scrape_item.add_to_parent_title(title)await self.handle_file(link, new_scrape_item, filename, ext)