Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
add more handling for thotsbay
Jules-WinnfieldX85462a85a801
diff --git a/cyberdrop_dl/main.py b/cyberdrop_dl/main.pyindex 32006d92c..2d32842a3 100644--- a/cyberdrop_dl/main.py+++ b/cyberdrop_dl/main.py@@ -59,7 +59,7 @@ async def download_all(args: argparse.Namespace):disable_attempt_limit=args.disable_attempt_limit,threads=args.threads, exclude_videos=args.exclude_videos,exclude_images=args.exclude_images, exclude_audio=args.exclude_audio,- exclude_other=args.exclude_other, connection=conn, cursor=curr)+ exclude_other=args.exclude_other, connection=conn, cursor=curr,)for downloader in downloaders:await downloader.download_content()diff --git a/cyberdrop_dl/utils/base_functions.py b/cyberdrop_dl/utils/base_functions.pyindex 33fbaac07..0851e7e07 100644--- a/cyberdrop_dl/utils/base_functions.py+++ b/cyberdrop_dl/utils/base_functions.py@@ -28,7 +28,7 @@ FILE_FORMATS = {'.mp3', '.flac', '.wav', '.m4a'},'Other': {- '.json', '.torrent'+ '.json', '.torrent', '.zip'}}diff --git a/cyberdrop_dl/utils/crawlers/GoFile_Spider.py b/cyberdrop_dl/utils/crawlers/GoFile_Spider.pyindex dcbafd87d..24dff932c 100644--- a/cyberdrop_dl/utils/crawlers/GoFile_Spider.py+++ b/cyberdrop_dl/utils/crawlers/GoFile_Spider.py@@ -42,7 +42,7 @@ class GofileCrawler():content = self.client.get_content(content_id)except:log("GoFile seems to be down.")- logging.debug("GoFile seems to be down")+ logging.debug("GoFile seems to be down or the link is dead")returnif not content:returndiff --git a/cyberdrop_dl/utils/crawlers/Thotsbay_Spider.py b/cyberdrop_dl/utils/crawlers/Thotsbay_Spider.pyindex 80c7ab3e5..ad2836cba 100644--- a/cyberdrop_dl/utils/crawlers/Thotsbay_Spider.py+++ b/cyberdrop_dl/utils/crawlers/Thotsbay_Spider.py@@ -121,6 +121,8 @@ class ThotsbayCrawler():link = link.get('src')if link.startswith('//'):link = "https:" + link+ elif link.startswith('/'):+ link = URL("https://forum.thotsbay.com") / link[1:]content_links.append(URL(link))attachments_block = post.select_one("section[class=message-attachments]")@@ -135,6 +137,12 @@ class ThotsbayCrawler():ShareX_urls, Chibisafe_urls, Erome_urls, GoFile_urls, Thotsbay_urls, Anonfile_urls = url_sort(content_links, Cascade)+ for link in Thotsbay_urls:+ if 'attachments' in link.parts:+ Cascade.add_to_album("Thotsbay.com", "Attachments", link, url)+ elif 'data' in link.parts:+ Cascade.add_to_album("Thotsbay.com", "Attachments", link, url)+next_page = soup.select_one('pageNav-jump pageNav-jump--next')if next_page is not None:next_page = next_page.get('href')diff --git a/cyberdrop_dl/utils/downloaders.py b/cyberdrop_dl/utils/downloaders.pyindex 25248e44e..6aee0a432 100644--- a/cyberdrop_dl/utils/downloaders.py+++ b/cyberdrop_dl/utils/downloaders.py@@ -70,19 +70,23 @@ class Downloader:self.cookie_jar = cookie_jarself.folder = folderself.title = title++ self.connection = connection+ self.cursor = cursor+self.attempts = attemptsself.current_attempt = 0self.disable_attempt_limit = disable_attempt_limit- self.max_workers = max_workers+self.exclude_videos = exclude_videosself.exclude_images = exclude_imagesself.exclude_audio = exclude_audioself.exclude_other = exclude_other++ self.max_workers = max_workersself._semaphore = asyncio.Semaphore(max_workers)self.delay = {'media-files.bunkr.is': 2}self.throttle_times = {}- self.connection = connection- self.cursor = cursor"""Changed from aiohttp exceptions caught to FailureException to allow for partial downloads."""@@ -146,7 +150,7 @@ class Downloader:resume_point = temp_file.stat().st_sizeheaders['Range'] = 'bytes=%d-' % resume_point- async with session.get(url, headers=headers, ssl=ssl_context, raise_for_status=True, allow_redirects=False) as resp:+ async with session.get(url, headers=headers, ssl=ssl_context, raise_for_status=True) as resp:content_type = resp.headers.get('Content-Type')if 'text' in content_type.lower() or 'html' in content_type.lower():log(f"\nServer for {url} is either down or the file no longer exists", Fore.RED)@@ -202,6 +206,7 @@ class Downloader:filename = filename[:MAX_FILENAME_LENGTH] + '.' + fileextif (self.folder / self.title / filename).exists():+ await sql_update_file(self.connection, self.cursor, url, filename, 1)logger.debug(str(self.folder / self.title / filename) + " Already Exists")await sql_update_file(self.connection, self.cursor, url, filename, 1)else: