Skip to content

Bulk asynchronous downloader for multiple file hosts

fix: do not trim URLS (camwhores) (#1156)

NTFSvolume54dc29a2f68e
diff --git a/cyberdrop_dl/crawlers/_kvs.py b/cyberdrop_dl/crawlers/_kvs.py
index 0ad4ac6ee..360f945ae 100644
--- a/cyberdrop_dl/crawlers/_kvs.py
+++ b/cyberdrop_dl/crawlers/_kvs.py
@@ -36,8 +36,8 @@ class Selectors:
PUBLIC_VIDEOS = "div#list_videos_public_videos_items"
PRIVATE_VIDEOS = "div#list_videos_private_videos_items"
FAVOURITE_VIDEOS = "div#list_videos_favourite_videos_items"
- COMMON_VIDEOS_TITLE = "div#list_videos_common_videos_list"
- VIDEOS = "a.tumbpu"
+ COMMON_VIDEOS_TITLE = "div#list_videos_common_videos_list h1"
+ VIDEOS = "div#list_videos_common_videos_list_items a"
NEXT_PAGE = "li.pagination-next > a"
ALBUM_ID = "script:contains('album_id')"
DATE2 = "span:contains('Added:') + span"
@@ -82,7 +82,8 @@ class KernelVideoSharingCrawler(Crawler, is_abc=True):
async with self.request_limiter:
soup: BeautifulSoup = await self.client.get_soup(self.DOMAIN, scrape_item.url)
title = ""
- if search_query := scrape_item.url.query.get("q"):
+ if (search_query := scrape_item.url.query.get("q")) or scrape_item.url.parts[1] == "search":
+ search_query = search_query or scrape_item.url.parts[2]
title = f"{search_query} [search]"
else:
common_title = css.select_one_get_text(soup, _SELECTORS.COMMON_VIDEOS_TITLE)
diff --git a/cyberdrop_dl/crawlers/camwhores_dot_tv.py b/cyberdrop_dl/crawlers/camwhores_dot_tv.py
index 9043fc8cb..136f2b965 100644
--- a/cyberdrop_dl/crawlers/camwhores_dot_tv.py
+++ b/cyberdrop_dl/crawlers/camwhores_dot_tv.py
@@ -3,20 +3,49 @@ from __future__ import annotations
from typing import TYPE_CHECKING, ClassVar
from cyberdrop_dl.crawlers._kvs import KernelVideoSharingCrawler, Video
-from cyberdrop_dl.data_structures.url_objects import AbsoluteHttpURL
+from cyberdrop_dl.data_structures.url_objects import AbsoluteHttpURL, ScrapeItem
from cyberdrop_dl.utils.utilities import get_og_properties
if TYPE_CHECKING:
from bs4 import BeautifulSoup
+ from cyberdrop_dl.crawlers.crawler import SupportedPaths
+
PRIMARY_URL = AbsoluteHttpURL("https://www.camwhores.tv")
class CamwhoresTVCrawler(KernelVideoSharingCrawler):
+ SUPPORTED_PATHS: ClassVar[SupportedPaths] = {
+ "Search": "/search/...",
+ "Categories": "/categories/...",
+ "Tags": "/tags/...",
+ "Videos": "/videos/...",
+ "Members": "/members/<member_id>",
+ }
+
PRIMARY_URL: ClassVar[AbsoluteHttpURL] = PRIMARY_URL
DOMAIN: ClassVar[str] = "camwhores.tv"
+ async def fetch(self, scrape_item: ScrapeItem) -> None:
+ # Returns 404 without the trailing slash
+ if scrape_item.url.name:
+ scrape_item.url = scrape_item.url / ""
+ await super().fetch(scrape_item)
+
def get_video_info(self, soup: BeautifulSoup) -> Video:
video = super().get_video_info(soup)
return video._replace(title=get_og_properties(soup).title)
+
+ def parse_url(self, link_str: str, relative_to: AbsoluteHttpURL | None = None, *_) -> AbsoluteHttpURL:
+ return super().parse_url(link_str, relative_to, trim=False)
+
+ async def picture(self, scrape_item: ScrapeItem) -> None:
+ # images are encrypted, similar to the video URLS
+ # https://www.camwhores.tv/get_image/93/9da0742b1fb753388286b95c2a66d766/sources/100000/100557/1472879.jpg/
+ # TODO: Find out license to decrypt them
+ # Almost all albums are private anyways..
+ raise NotImplementedError
+
+ async def album(self, scrape_item: ScrapeItem) -> None:
+ raise NotImplementedError