Skip to content

Bulk asynchronous downloader for multiple file hosts

Feature: Add Tits In Tops Crawler (#454)

Jacob9618704a5bb9
diff --git a/cyberdrop_dl/config_definitions/authentication_settings.py b/cyberdrop_dl/config_definitions/authentication_settings.py
index de5c63b87..350e7f7c7 100644
--- a/cyberdrop_dl/config_definitions/authentication_settings.py
+++ b/cyberdrop_dl/config_definitions/authentication_settings.py
@@ -28,6 +28,9 @@ class ForumAuth(BaseModel):
socialmediagirls_xf_user_cookie: str = ""
socialmediagirls_username: str = ""
socialmediagirls_password: str = ""
+ titsintops_xf_user_cookie: str = ""
+ titsintops_username: str = ""
+ titsintops_password: str = ""
xbunker_xf_user_cookie: str = ""
xbunker_username: str = ""
xbunker_password: str = ""
diff --git a/cyberdrop_dl/scraper/__init__.py b/cyberdrop_dl/scraper/__init__.py
index 3e7025513..d058eb04b 100644
--- a/cyberdrop_dl/scraper/__init__.py
+++ b/cyberdrop_dl/scraper/__init__.py
@@ -44,6 +44,7 @@ from cyberdrop_dl.scraper.crawlers.saint_crawler import SaintCrawler
from cyberdrop_dl.scraper.crawlers.scrolller_crawler import ScrolllerCrawler
from cyberdrop_dl.scraper.crawlers.simpcity_crawler import SimpCityCrawler
from cyberdrop_dl.scraper.crawlers.socialmediagirls_crawler import SocialMediaGirlsCrawler
+from cyberdrop_dl.scraper.crawlers.titsintops_crawler import TitsInTopsCrawler
from cyberdrop_dl.scraper.crawlers.tokyomotion_crawler import TokioMotionCrawler
from cyberdrop_dl.scraper.crawlers.toonily_crawler import ToonilyCrawler
from cyberdrop_dl.scraper.crawlers.xbunker_crawler import XBunkerCrawler
diff --git a/cyberdrop_dl/scraper/crawlers/titsintops_crawler.py b/cyberdrop_dl/scraper/crawlers/titsintops_crawler.py
new file mode 100644
index 000000000..d38e66a8c
--- /dev/null
+++ b/cyberdrop_dl/scraper/crawlers/titsintops_crawler.py
@@ -0,0 +1,47 @@
+from __future__ import annotations
+
+from typing import TYPE_CHECKING
+
+from yarl import URL
+
+from .xenforo_crawler import PostSelectors, Selector, XenforoCrawler, XenforoSelectors
+
+if TYPE_CHECKING:
+ from bs4 import Tag
+
+ from cyberdrop_dl.managers.manager import Manager
+
+
+class TitsInTopsCrawler(XenforoCrawler):
+ primary_base_domain = URL("https://titsintops.com")
+ domain = "titsintops"
+ post_selectors = PostSelectors(
+ images=Selector("a[class*=file-preview]", "href"),
+ )
+ selectors = XenforoSelectors(posts=post_selectors)
+ login_required = True
+
+ def __init__(self, manager: Manager) -> None:
+ super().__init__(manager, self.domain, "TitsInTops")
+ self.attachment_url_part = ["attachments", "data"]
+
+ async def filter_link(self, link: URL):
+ return URL(
+ str(link)
+ .replace("index.php%3F", "index.php/")
+ .replace("index.php?", "index.php/")
+ .replace("index.php/goto", "index.php?goto")
+ )
+
+ async def pre_filter_link(self, link):
+ return URL(str(link).replace("index.php?", "index.php/").replace("index.php%3F", "index.php/"))
+
+ def is_valid_post_link(self, link_obj: Tag) -> bool:
+ is_image = link_obj.select_one("img")
+ text = link_obj.text
+ if text and "view attachment" in text.lower():
+ return False
+ if link_obj.get("title") and "permanent link" in link_obj.get("title").lower():
+ return False
+ link = link_obj.get(self.selectors.posts.links.element)
+ return not (is_image and self.is_attachment(link))
diff --git a/cyberdrop_dl/scraper/crawlers/xenforo_crawler.py b/cyberdrop_dl/scraper/crawlers/xenforo_crawler.py
index f0e0dc4cd..7e3e69090 100644
--- a/cyberdrop_dl/scraper/crawlers/xenforo_crawler.py
+++ b/cyberdrop_dl/scraper/crawlers/xenforo_crawler.py
@@ -103,9 +103,13 @@ class XenforoCrawler(Crawler):
"""~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"""
+ async def pre_filter_link(self, link: URL) -> URL:
+ return link
+
@create_task_id
async def fetch(self, scrape_item: ScrapeItem) -> None:
"""Determines where to send the scrape item based on the url."""
+ scrape_item.url = await self.pre_filter_link(scrape_item.url)
if self.thread_url_part not in scrape_item.url.parts:
log(f"Scrape Failed: Unknown URL path: {scrape_item.url}", 40)
return
@@ -340,7 +344,7 @@ class XenforoCrawler(Crawler):
if page_url.startswith("/"):
page_url = self.primary_base_domain / page_url[1:]
page_url = URL(page_url)
- log(f"scraping page: {page_url}")
+ page_url = await self.pre_filter_link(page_url)
continue
break
diff --git a/cyberdrop_dl/scraper/filters.py b/cyberdrop_dl/scraper/filters.py
index 0548a3b3d..b735112e7 100644
--- a/cyberdrop_dl/scraper/filters.py
+++ b/cyberdrop_dl/scraper/filters.py
@@ -147,6 +147,7 @@ async def filter_fn(response: ClientResponse) -> bool:
"xbunker.nu": check_xenforo_last_page,
"socialmediagirls.com": check_xenforo_last_page,
"simpcity.su": check_xenforo_last_page,
+ "titsintops.com": check_xenforo_last_page,
"coomer.su": check_coomer_page,
"kemono.su": check_kemono_page,
}