Skip to content

Bulk asynchronous downloader for multiple file hosts

minor cleanup, fix type hinting issues <3.9

Jules-WinnfieldX7075934bb5d4
diff --git a/cyberdrop_dl/__init__.py b/cyberdrop_dl/__init__.py
index 60d7dd948..fefabe427 100644
--- a/cyberdrop_dl/__init__.py
+++ b/cyberdrop_dl/__init__.py
@@ -1 +1 @@
-__version__ = "2.30.2"
+__version__ = "2.30.3"
diff --git a/cyberdrop_dl/base_functions/data_classes.py b/cyberdrop_dl/base_functions/data_classes.py
index cd29dfd10..f65f189a7 100644
--- a/cyberdrop_dl/base_functions/data_classes.py
+++ b/cyberdrop_dl/base_functions/data_classes.py
@@ -2,7 +2,6 @@ import asyncio
from dataclasses import dataclass
from typing import ClassVar, Dict, List, Optional, Tuple
-import aiohttp
from yarl import URL
diff --git a/cyberdrop_dl/client/downloaders.py b/cyberdrop_dl/client/downloaders.py
index 15dd18ec0..193b51dd2 100644
--- a/cyberdrop_dl/client/downloaders.py
+++ b/cyberdrop_dl/client/downloaders.py
@@ -3,7 +3,7 @@ import logging
import traceback
from functools import wraps
from pathlib import Path
-from typing import List, Tuple
+from typing import List, Tuple, Dict
from random import gauss
import aiofiles
@@ -15,7 +15,6 @@ from yarl import URL
from ..base_functions.base_functions import FILE_FORMATS, MAX_FILENAME_LENGTH, log, logger, sanitize
from ..base_functions.sql_helper import SQLHelper
from ..base_functions.data_classes import AlbumItem, CascadeItem, FileLock
-from ..client.rate_limiting import throttle
from ..client.client import Client, DownloadSession
@@ -53,7 +52,7 @@ def retry(f):
class Downloader:
def __init__(self, album_obj: AlbumItem, folder: Path, title: str, attempts: int,
- disable_attempt_limit: bool, max_workers: int, excludes: dict[str, bool], SQL_helper: SQLHelper,
+ disable_attempt_limit: bool, max_workers: int, excludes: Dict[str, bool], SQL_helper: SQLHelper,
client: Client):
self.album_obj = album_obj
self.client = client
@@ -262,7 +261,7 @@ class Downloader:
async def get_downloaders(Cascade: CascadeItem, folder: Path, attempts: int, disable_attempt_limit: bool,
- max_workers: int, excludes: dict[str, bool], SQL_helper: SQLHelper, client: Client) -> List[Downloader]:
+ max_workers: int, excludes: Dict[str, bool], SQL_helper: SQLHelper, client: Client) -> List[Downloader]:
"""Get a list of downloaders for each supported type of URLs.
We shouldn't just assume that each URL will have the same netloc as
the first one, so we need to classify them one by one, sort them to
diff --git a/cyberdrop_dl/client/rate_limiting.py b/cyberdrop_dl/client/rate_limiting.py
index 3352a65d8..f7e32a4e7 100644
--- a/cyberdrop_dl/client/rate_limiting.py
+++ b/cyberdrop_dl/client/rate_limiting.py
@@ -6,7 +6,7 @@ from datetime import datetime
from types import TracebackType
from typing import Optional, Callable, Awaitable, Any, Type
-from cyberdrop_dl.base_functions.base_functions import logger
+from ..base_functions.base_functions import logger
class AsyncRateLimiter:
@@ -66,7 +66,7 @@ class AsyncRateLimiter:
return self.calls[-1] - self.calls[0]
-async def throttle(self, delay, host) -> None:
+async def throttle(self, delay: int, host: str) -> None:
if delay is None or delay == 0:
return
diff --git a/cyberdrop_dl/scraper/scraper.py b/cyberdrop_dl/scraper/scraper.py
index 405a9a25a..e06273815 100644
--- a/cyberdrop_dl/scraper/scraper.py
+++ b/cyberdrop_dl/scraper/scraper.py
@@ -1,8 +1,5 @@
import asyncio
-import aiohttp
-from colorama import Fore
-
from .scraper_helper import ScrapeMapper
from ..base_functions.base_functions import log
from ..base_functions.data_classes import AuthData, SkipData
@@ -11,7 +8,7 @@ from ..client.client import Client
async def scrape(urls, client: Client, include_id: bool, thotsbay_auth: AuthData, separate_posts: bool,
skip_data: SkipData, threads: int):
- await log("Starting Scrape", Fore.WHITE)
+ await log("Starting Scrape")
scraper = ScrapeMapper(client=client, include_id=include_id, thotsbay_auth=thotsbay_auth,
separate_posts=separate_posts, skip_data=skip_data, threads=threads)