Skip to content

Bulk asynchronous downloader for multiple file hosts

fix: downloading videos without explicit resolution (ThisVid) (#1344)

Barbarella6666666550cd833b61c
diff --git a/cyberdrop_dl/crawlers/_kvs.py b/cyberdrop_dl/crawlers/_kvs.py
index a6fbd813a..49d5f52cb 100644
--- a/cyberdrop_dl/crawlers/_kvs.py
+++ b/cyberdrop_dl/crawlers/_kvs.py
@@ -189,7 +189,7 @@ def _parse_video_vars(video_vars: str) -> KVSVideo:
url_str = flashvars[key]
if "/get_file/" not in url_str:
continue
- quality = flashvars[f"{key}_text"]
+ quality = flashvars.get(f"{key}_text")
resolution = Resolution.highest() if quality == "HQ" else Resolution.parse(quality)
url = _deobfuscate_url(url_str, license_token)
yield resolution, url
diff --git a/cyberdrop_dl/data_structures/mediaprops.py b/cyberdrop_dl/data_structures/mediaprops.py
index 5f821cb22..8383d82b1 100644
--- a/cyberdrop_dl/data_structures/mediaprops.py
+++ b/cyberdrop_dl/data_structures/mediaprops.py
@@ -63,6 +63,9 @@ class Resolution(NamedTuple):
@staticmethod
def parse(url_number_or_string: yarl.URL | str | int, /) -> Resolution:
+ if url_number_or_string is None:
+ return UNKNOWN_RESOLUTION
+
if isinstance(url_number_or_string, int):
return Resolution._from_height(url_number_or_string)
diff --git a/tests/crawlers/test_cases/camwhores.py b/tests/crawlers/test_cases/camwhores.py
new file mode 100644
index 000000000..dd2cb3982
--- /dev/null
+++ b/tests/crawlers/test_cases/camwhores.py
@@ -0,0 +1,16 @@
+DOMAIN = "camwhores.tv"
+TEST_CASES = [
+ (
+ "https://www.camwhores.tv/videos/9722373/shadory-eula-cosplay/",
+ [
+ {
+ "url": "https://www.camwhores.tv/videos/9722373/shadory-eula-cosplay/",
+ "filename": "Shadory Eula cosplay [9722373].mp4",
+ "original_filename": "9722373.mp4",
+ "referer": "https://www.camwhores.tv/videos/9722373/shadory-eula-cosplay/",
+ "album_id": None,
+ "debrid_link": "ANY",
+ }
+ ],
+ )
+]
diff --git a/tests/crawlers/test_cases/thisvid.py b/tests/crawlers/test_cases/thisvid.py
index 0081a1d8e..d38004b92 100644
--- a/tests/crawlers/test_cases/thisvid.py
+++ b/tests/crawlers/test_cases/thisvid.py
@@ -8,7 +8,18 @@ TEST_CASES = [
"filename": "A wedding photo to remember [12797267].mp4",
"referer": "https://thisvid.com/videos/a-wedding-photo-to-remember",
"album_id": None,
- "datetime": 1753326000,
+ }
+ ],
+ ),
+ (
+ # No reslution info in video page
+ "https://thisvid.com/videos/smelling-foreskin/",
+ [
+ {
+ "url": "https://thisvid.com/videos/smelling-foreskin",
+ "filename": "Smelling foreskin [794368].mp4",
+ "referer": "https://thisvid.com/videos/smelling-foreskin",
+ "album_id": None,
}
],
),