Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
fix: resolution parsing (ThisVid) (#1329)
Barbarella6666666742d4827d7b5
diff --git a/cyberdrop_dl/crawlers/_kvs.py b/cyberdrop_dl/crawlers/_kvs.pyindex 1d334b689..3aa54df1d 100644--- a/cyberdrop_dl/crawlers/_kvs.py+++ b/cyberdrop_dl/crawlers/_kvs.py@@ -189,7 +189,8 @@ def _parse_video_vars(video_vars: str) -> KVSVideo:url_str = flashvars[key]if "/get_file/" not in url_str:continue- resolution = Resolution.parse(flashvars[f"{key}_text"])+ quality = flashvars[f"{key}_text"]+ resolution = Resolution.highest() if quality == "HQ" else Resolution.parse(quality)url = _deobfuscate_url(url_str, license_token)yield resolution, urldiff --git a/cyberdrop_dl/crawlers/crawler.py b/cyberdrop_dl/crawlers/crawler.pyindex b4ad6d660..4d9deed37 100644--- a/cyberdrop_dl/crawlers/crawler.py+++ b/cyberdrop_dl/crawlers/crawler.py@@ -784,7 +784,11 @@ class Crawler(ABC):if _placeholder_config.include_audio_codec and audio_codec:extra_info.append(audio_codec)- if _placeholder_config.include_resolution and resolution and resolution != (0, 0):+ if (+ _placeholder_config.include_resolution+ and resolution+ and resolution not in [Resolution.highest(), Resolution.unknown()]+ ):if not isinstance(resolution, Resolution):resolution = Resolution.parse(resolution)extra_info.append(resolution.name)diff --git a/cyberdrop_dl/data_structures/mediaprops.py b/cyberdrop_dl/data_structures/mediaprops.pyindex f607f307a..5f821cb22 100644--- a/cyberdrop_dl/data_structures/mediaprops.py+++ b/cyberdrop_dl/data_structures/mediaprops.py@@ -105,8 +105,13 @@ class Resolution(NamedTuple):def unknown() -> Resolution:return UNKNOWN_RESOLUTION+ @staticmethod+ def highest() -> Resolution:+ return HIGHEST_RESOLUTION+UNKNOWN_RESOLUTION = Resolution.parse(0)+HIGHEST_RESOLUTION = Resolution(9999, 9999)COMMON_RESOLUTIONS: Final = tuple(diff --git a/tests/crawlers/test_cases/thisvid.py b/tests/crawlers/test_cases/thisvid.pynew file mode 100644index 000000000..0081a1d8e--- /dev/null+++ b/tests/crawlers/test_cases/thisvid.py@@ -0,0 +1,27 @@+DOMAIN = "thisvid"+TEST_CASES = [+ (+ "https://thisvid.com/videos/a-wedding-photo-to-remember/",+ [+ {+ "url": "https://thisvid.com/videos/a-wedding-photo-to-remember",+ "filename": "A wedding photo to remember [12797267].mp4",+ "referer": "https://thisvid.com/videos/a-wedding-photo-to-remember",+ "album_id": None,+ "datetime": 1753326000,+ }+ ],+ ),+ (+ "https://thisvid.com/albums/bruxel/",+ [+ {+ "url": "re:https://media.thisvid.com/contents/albums/main/700x525/517000/51739",+ "download_folder": r"re:Julia Bruxel \[album\] \(ThisVid\)",+ "referer": "re:https://thisvid.com/albums/bruxel",+ "album_id": "517393",+ },+ ],+ 10,+ ),+]