Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
Cleanup
Jules-WinnfieldX62fa369cd8e2
diff --git a/cyberdrop_dl/main.py b/cyberdrop_dl/main.pyindex c80035ded..0341d7746 100644--- a/cyberdrop_dl/main.py+++ b/cyberdrop_dl/main.py@@ -1,17 +1,11 @@import argparseimport asyncio-import logging-import osfrom pathlib import Path-import re--from colorama import Fore, Style-import requestsfrom . import __version__ as VERSIONfrom .utils.scraper import scrapefrom .utils.downloaders import get_downloaders-from .utils.data_classes import *+from .utils.base_functions import *def parse_args():@@ -29,16 +23,6 @@ def parse_args():return args-def log(text, style = Fore.WHITE) -> None:- """Wrapper around print() to add color to text"""- print(style + str(text) + Style.RESET_ALL)---def clear() -> None:- """Clears the terminal screen"""- os.system('cls' if os.name == 'nt' else 'clear')--def regex_links(urls) -> list:all_links = [x.group().replace(".md.", ".") for x in re.finditer(r"(?:http.*?)(?=('|$|\n|\r\n|\r|\s)|\")", urls)]return all_linksdiff --git a/cyberdrop_dl/utils/base_functions.py b/cyberdrop_dl/utils/base_functions.pyindex be145162c..b6675384b 100644--- a/cyberdrop_dl/utils/base_functions.py+++ b/cyberdrop_dl/utils/base_functions.py@@ -1,6 +1,12 @@+import logging+import osimport refrom urllib.parse import urljoin+from colorama import Fore, Style++"""This file contains generic information and functions that are used around the program"""+FILE_FORMATS = {'Images': {'.jpg', '.jpeg', '.png', '.gif',@@ -25,9 +31,22 @@ mapping_Erome = ["erome.com"]mapping_GoFile = ["gofile.io"]mapping_Pixeldrain = ["pixeldrain.com"]-user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36'+user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 ' \+ 'Safari/537.36'MAX_FILENAME_LENGTH = 100+logger = logging.getLogger(__name__)+++def log(text, style = Fore.WHITE) -> None:+ """Wrapper around print() to add color to text"""+ print(style + str(text) + Style.RESET_ALL)+++def clear() -> None:+ """Clears the terminal screen"""+ os.system('cls' if os.name == 'nt' else 'clear')+def make_title_safe(title: str):title = re.sub(r'[\\*?:"<>|./]', "-", title)diff --git a/cyberdrop_dl/utils/crawlers/Chibisafe_Spider.py b/cyberdrop_dl/utils/crawlers/Chibisafe_Spider.pyindex b696cd039..c004929a8 100644--- a/cyberdrop_dl/utils/crawlers/Chibisafe_Spider.py+++ b/cyberdrop_dl/utils/crawlers/Chibisafe_Spider.py@@ -1,5 +1,3 @@-import logging-import tldextractfrom bs4 import BeautifulSoup@@ -7,9 +5,6 @@ from ..base_functions import *from ..data_classes import *-logger = logging.getLogger(__name__)--class ChibisafeCrawler():def __init__(self, *, include_id=False, **kwargs):self.include_id = include_iddiff --git a/cyberdrop_dl/utils/crawlers/Erome_Spider.py b/cyberdrop_dl/utils/crawlers/Erome_Spider.pyindex 16b64e0a3..dd2896ee5 100644--- a/cyberdrop_dl/utils/crawlers/Erome_Spider.py+++ b/cyberdrop_dl/utils/crawlers/Erome_Spider.py@@ -1,5 +1,3 @@-import logging-import tldextractfrom bs4 import BeautifulSoup@@ -7,9 +5,6 @@ from ..base_functions import *from ..data_classes import *-logger = logging.getLogger(__name__)--class EromeCrawler():def __init__(self, *, include_id=False, **kwargs):self.include_id = include_iddiff --git a/cyberdrop_dl/utils/crawlers/GoFile_Spider.py b/cyberdrop_dl/utils/crawlers/GoFile_Spider.pyindex 60989cc61..2332f4a2a 100644--- a/cyberdrop_dl/utils/crawlers/GoFile_Spider.py+++ b/cyberdrop_dl/utils/crawlers/GoFile_Spider.py@@ -2,7 +2,6 @@ from typing import Unionfrom gofile import Gofile-from ..base_functions import *from ..data_classes import *diff --git a/cyberdrop_dl/utils/crawlers/ShareX_Spider.py b/cyberdrop_dl/utils/crawlers/ShareX_Spider.pyindex fe54b28f3..5d26413d5 100644--- a/cyberdrop_dl/utils/crawlers/ShareX_Spider.py+++ b/cyberdrop_dl/utils/crawlers/ShareX_Spider.py@@ -1,5 +1,3 @@-import logging-import tldextractfrom bs4 import BeautifulSoup@@ -7,9 +5,6 @@ from ..base_functions import *from ..data_classes import *-logger = logging.getLogger(__name__)--class ShareXCrawler():def __init__(self, *, include_id=False, **kwargs):self.include_id = include_iddiff --git a/cyberdrop_dl/utils/downloaders.py b/cyberdrop_dl/utils/downloaders.pyindex 7c4544e5a..3c03e98e4 100644--- a/cyberdrop_dl/utils/downloaders.py+++ b/cyberdrop_dl/utils/downloaders.py@@ -1,7 +1,6 @@import asynciofrom functools import wrapsimport http-import loggingimport multiprocessingfrom pathlib import Pathimport ssl@@ -13,7 +12,6 @@ import aiofiles.osimport aiohttpimport aiohttp.client_exceptionsimport certifi-from colorama import Fore, Stylefrom sanitize_filename import sanitizefrom tqdm import tqdmimport yarl@@ -21,13 +19,6 @@ import yarlfrom .base_functions import *from .data_classes import *-logger = logging.getLogger(__name__)---def log(text, style):- # Log function for printing to command line- print(style + str(text) + Style.RESET_ALL)-class FailureException(Exception):"""Basic failure exception I can throw to force a retry."""diff --git a/cyberdrop_dl/utils/scraper.py b/cyberdrop_dl/utils/scraper.pyindex fa05429b7..7ea559241 100644--- a/cyberdrop_dl/utils/scraper.py+++ b/cyberdrop_dl/utils/scraper.py@@ -1,12 +1,7 @@-from collections import OrderedDict-import logging-import re-import asyncioimport aiohttpimport tldextract-from colorama import Fore, Stylefrom .crawlers.ShareX_Spider import ShareXCrawlerfrom .crawlers.Erome_Spider import EromeCrawler@@ -16,14 +11,6 @@ from .data_classes import *from .base_functions import *-logger = logging.getLogger(__name__)---def log(text, style):- # Log function for printing to command line- print(style + str(text) + Style.RESET_ALL)--async def scrape(urls, include_id: bool):Cascade = CascadeItem({})