Skip to content

Bulk asynchronous downloader for multiple file hosts

refactor: reject false positive matches (x.com)

NTFSvolumed3f383497403
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 54ee0f0af..d1fce49ce 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -28,6 +28,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Support premium URLs (direct links)(GoFile)
+### Fixed
+
+- Pagination of some profiles stopping early (Twitter/x.com)
+
## [10.8.0] - 2026-09-06
### Added
diff --git a/cyberdrop_dl/crawlers/crawler.py b/cyberdrop_dl/crawlers/crawler.py
index 0506c02e5..9ca35d76d 100644
--- a/cyberdrop_dl/crawlers/crawler.py
+++ b/cyberdrop_dl/crawlers/crawler.py
@@ -224,6 +224,10 @@ class Crawler(HTTPMixin, HLSMixin, ABC):
def __db_path__(url: AbsoluteHttpURL, /) -> str:
return url.path
+ @classmethod
+ def check_host_match(cls, host: str) -> bool:
+ return bool(host)
+
@final
def __init__(self, manager: Manager, task_mng: aio.TaskManager, tui: ScrapingUI) -> None:
self.manager: Manager = manager
diff --git a/cyberdrop_dl/crawlers/twitter/crawler.py b/cyberdrop_dl/crawlers/twitter/crawler.py
index 8e5c9f95a..6e0d86f3e 100644
--- a/cyberdrop_dl/crawlers/twitter/crawler.py
+++ b/cyberdrop_dl/crawlers/twitter/crawler.py
@@ -111,7 +111,13 @@ class TwitterCrawler(Crawler):
if after := self.config.filters.after:
self._default_since = int(datetime.datetime.combine(after, datetime.time.min).timestamp())
+ @classmethod
+ @override
+ def check_host_match(cls, host: str) -> bool:
+ return host == "x.com" or not host.endswith("x.com")
+
@property
+ @override
def separate_posts(self) -> bool:
return True
diff --git a/cyberdrop_dl/scrape_mapper.py b/cyberdrop_dl/scrape_mapper.py
index 4819976e1..fb9e86796 100644
--- a/cyberdrop_dl/scrape_mapper.py
+++ b/cyberdrop_dl/scrape_mapper.py
@@ -463,16 +463,18 @@ def _disable_crawlers_by_config(current_crawlers: dict[str, type[Crawler]], *cra
log_spacer()
-def _best_match[T](current_map: dict[str, T], domain: str) -> T | None:
- if found := current_map.get(domain):
+def _best_match[T: Crawler | type[Crawler]](crawlers: dict[str, T], domain: str) -> T | None:
+ if found := crawlers.get(domain):
return found
+ matches = (host for host, cls in crawlers.items() if host in domain and cls.check_host_match(host))
+
try:
- best_match = max((host for host in current_map if host in domain), key=len)
+ best_match = max(matches, key=len)
except (ValueError, TypeError):
return None
else:
- current_map[domain] = found = current_map[best_match]
+ crawlers[domain] = found = crawlers[best_match]
return found