Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
feat: support embed URLs (odysee)
NTFSvolumec83ea0c3f6ea
diff --git a/cyberdrop_dl/crawlers/odysee.py b/cyberdrop_dl/crawlers/odysee.pyindex 4b6383424..56faf5cf7 100644--- a/cyberdrop_dl/crawlers/odysee.py+++ b/cyberdrop_dl/crawlers/odysee.py@@ -21,12 +21,19 @@ if TYPE_CHECKING:@Crawler.db_path_builder("url")class OdyseeCrawler(Crawler):SUPPORTED_PATHS: ClassVar[SupportedPaths] = {- "Video": ("@channel:uri",),+ "Video": ("/@channel:uri",),+ "Embed": ("/$/embed/@channel:uri",),}DOMAIN: ClassVar[str] = "odysee"PRIMARY_URL: ClassVar[AbsoluteHttpURL] = AbsoluteHttpURL("https://odysee.com")+ @classmethod+ @override+ def transform_url(cls, url: AbsoluteHttpURL) -> AbsoluteHttpURL:+ url = super().transform_url(url)+ return url.with_path(url.path.removeprefix("/$/embed"), keep_query=True)+def __post_init__(self) -> None:self.api: LBRYAPI = LBRYAPI.from_crawler(self)diff --git a/tests/crawlers/test_cases/odysee.py b/tests/crawlers/test_cases/odysee.pyindex 1159a567c..f0934db4b 100644--- a/tests/crawlers/test_cases/odysee.py+++ b/tests/crawlers/test_cases/odysee.py@@ -25,4 +25,29 @@ TEST_CASES = [},],},+ {+ "url": "https://odysee.com/$/embed/@wickedtruths:2/Biotechnological-Invasion-of-Skin-(April-2023):4",+ "results": [+ {+ "url": "lbry://wickedtruths/#2/Biotechnological-Invasion-of-Skin-(April-2023)%234",+ "filename": "Biotechnological Invasion of Skin (April [41fbfe805eb73c8d3012c0c49faa0f563274f634][1440p].mp4",+ "debrid_url": "https://player.odycdn.com/v6/streams/41fbfe805eb73c8d3012c0c49faa0f563274f634/2df6b0.mp4",+ "original_filename": "Biotechnological Invasion of Skin (April 2023)",+ "referer": "https://odysee.com/@wickedtruths:2/Biotechnological-Invasion-of-Skin-(April-2023):4",+ "album_id": None,+ "uploaded_at": 1685617473,+ "download_folder": "re:Loose Files (Odysee)",+ },+ {+ "url": "https://thumbs.odycdn.com/4e6d39da4df0cfdad45f64e253a15959.webp",+ "filename": "Biotechnological Invasion of Skin (April [41fbfe805eb73c8d3012c0c49faa0f563274f634][1440p].webp",+ "debrid_url": None,+ "original_filename": "Biotechnological Invasion of Skin (April [41fbfe805eb73c8d3012c0c49faa0f563274f634][1440p]_thumb.webp",+ "referer": "https://odysee.com/@wickedtruths:2/Biotechnological-Invasion-of-Skin-(April-2023):4#thumbnail",+ "album_id": None,+ "uploaded_at": 1685617473,+ "download_folder": "re:Loose Files (Odysee)",+ },+ ],+ },]diff --git a/tests/crawlers/test_crawlers.py b/tests/crawlers/test_crawlers.pyindex 8d8cf22ea..7f97677b3 100644--- a/tests/crawlers/test_crawlers.py+++ b/tests/crawlers/test_crawlers.py@@ -96,7 +96,7 @@ class _NOT_NONE: # noqa: N801, PLW1641NOT_NONE = _NOT_NONE()-def _validate_results(crawler: Crawler, test_case: test_cases.CrawlerTestCase, results: list[MediaItem]) -> None:+def _validate_results(crawler: Crawler, test_case: test_cases.CrawlerTestCase, results: list[MediaItem]) -> None: # noqa: C901expected_results = dict(sorted(((x["url"], idx), x) for idx, x in enumerate(test_case.results, 1)))origin = getattr(crawler, "PRIMARY_URL", AbsoluteHttpURL("https://google.com"))for (index, expected), media_item in zip(expected_results.items(), results, strict=False):@@ -122,6 +122,9 @@ def _validate_results(crawler: Crawler, test_case: test_cases.CrawlerTestCase, rif expected_value.startswith("http"):expected_value = crawler.parse_url(expected_value, origin)+ elif attr_name == "url":+ expected_value = AbsoluteHttpURL(expected_value)+elif expected_value.startswith("re:"):expected_value = expected_value.removeprefix("re:")assert re_search(expected_value, result_value), (