Skip to content

Bulk asynchronous downloader for multiple file hosts

feat: add `--thumbnails` option

NTFSvolume57d1ebb79dff
diff --git a/cyberdrop_dl/config/default.yaml b/cyberdrop_dl/config/default.yaml
index ead2e409f..9f29d2f0a 100644
--- a/cyberdrop_dl/config/default.yaml
+++ b/cyberdrop_dl/config/default.yaml
@@ -90,6 +90,7 @@ filters:
audio: true
images: true
non_media: true
+ thumbnails: false
videos: true
only_hosts: []
sizes:
diff --git a/cyberdrop_dl/config/filters.py b/cyberdrop_dl/config/filters.py
index 363ee49fc..da6797366 100644
--- a/cyberdrop_dl/config/filters.py
+++ b/cyberdrop_dl/config/filters.py
@@ -137,6 +137,9 @@ class _FileFilter(ConfigModel):
non_media: bool = True
"Download/skip non media files (.txt, zip, .rar, etc...)"
+ thumbnails: bool = False
+ "Download/skip thumbnails of media files (if available)"
+
class Filters(ConfigGroup):
files: _FileFilter = Field(default_factory=_FileFilter)
diff --git a/cyberdrop_dl/config/schema.json b/cyberdrop_dl/config/schema.json
index 66c9cab2a..f47fbc781 100644
--- a/cyberdrop_dl/config/schema.json
+++ b/cyberdrop_dl/config/schema.json
@@ -1086,6 +1086,11 @@
"default": true,
"title": "Non Media",
"type": "boolean"
+ },
+ "thumbnails": {
+ "default": false,
+ "title": "Thumbnails",
+ "type": "boolean"
}
},
"title": "_FileFilter",
diff --git a/cyberdrop_dl/crawlers/crawler.py b/cyberdrop_dl/crawlers/crawler.py
index ccae0209e..5cdcc2d12 100644
--- a/cyberdrop_dl/crawlers/crawler.py
+++ b/cyberdrop_dl/crawlers/crawler.py
@@ -542,6 +542,7 @@ class Crawler(HTTPMixin, HLSMixin, ABC):
json_check=self.__json_resp_check__,
)
+ media_item.thumbnail = thumbnail
media_item.headers.update(self._prepare_headers(scrape_item))
if headers:
media_item.headers.update(headers)
@@ -553,7 +554,7 @@ class Crawler(HTTPMixin, HLSMixin, ABC):
check_dangerous_filename(media_item.download_filename or media_item.filename)
await self.handle_media_item(media_item, m3u8)
- if thumbnail:
+ if thumbnail and self.config.filters.files.thumbnails:
_, ext = self.get_filename_and_ext(thumbnail.name)
thumb_name = f"{Path(media_item.filename).stem}_thumb{ext}"
filename, _ = self.get_filename_and_ext(thumb_name)
diff --git a/cyberdrop_dl/url_objects.py b/cyberdrop_dl/url_objects.py
index 01cfabd94..118bd2e83 100644
--- a/cyberdrop_dl/url_objects.py
+++ b/cyberdrop_dl/url_objects.py
@@ -140,6 +140,7 @@ class MediaItem:
album_id: str | None = None
uploaded_at: int | None = None
xxhash: str | None = None
+ thumbnail: AbsoluteHttpURL | None = None
parents: tuple[AbsoluteHttpURL, ...] = dataclasses.field(default_factory=tuple)
attempts: int = dataclasses.field(init=False, default=0)
diff --git a/docs/reference/config/filters.md b/docs/reference/config/filters.md
index f0d172015..e8dbfdf60 100644
--- a/docs/reference/config/filters.md
+++ b/docs/reference/config/filters.md
@@ -150,4 +150,5 @@ filters:
images: true
non_media: true
videos: true
+ thumbnails: false
```