Skip to content

Bulk asynchronous downloader for multiple file hosts

feat: add lensdump support (#2191)

NTFSvolume8288b54375ac
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8e8a29c8d..1ae631cdd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -27,9 +27,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- New `--subfolders.group-loose-files` option
+- Lensdump support
- Support subfolders (Upfile)
- Support subtitles (VKVideo)
+### Changed
+
+- Ignore low config timeouts values during Flaresolverr requests. Always wait at least 1 minute for a response
+
### Fixed
- Handle posts with no audio (TikTok)
@@ -38,8 +43,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Respect `--rate-limit` values higher than 25req/s
- Respect `--subfolders.include.domain` for `Loose Files` folders
-### Security
-
## [10.13.0] - 2026-10-24
### Added
diff --git a/cyberdrop_dl/crawlers/crawler.py b/cyberdrop_dl/crawlers/crawler.py
index ab370a5ca..1dbe0724e 100644
--- a/cyberdrop_dl/crawlers/crawler.py
+++ b/cyberdrop_dl/crawlers/crawler.py
@@ -61,6 +61,7 @@ if TYPE_CHECKING:
)
import yarl
+ from aiohttp.typedefs import LooseCookies
from bs4 import BeautifulSoup, Tag
from cyberdrop_dl.clients.request import RequestParams
@@ -884,7 +885,7 @@ class Crawler(HTTPMixin, HLSMixin, ABC):
return SiteCookies(self.client.cookies.filter_cookies(self.PRIMARY_URL))
@final
- def update_cookies(self, cookies: dict[str, Any], url: yarl.URL | None = None) -> None:
+ def update_cookies(self, cookies: LooseCookies, url: yarl.URL | None = None) -> None:
"""Update cookies for the provided URL
If `url` is `None`, defaults to `self.PRIMARY_URL`
diff --git a/cyberdrop_dl/crawlers/lensdump.py b/cyberdrop_dl/crawlers/lensdump.py
new file mode 100644
index 000000000..671d1df18
--- /dev/null
+++ b/cyberdrop_dl/crawlers/lensdump.py
@@ -0,0 +1,251 @@
+from __future__ import annotations
+
+import dataclasses
+from typing import TYPE_CHECKING, Any, ClassVar, Self, override
+
+from cyberdrop_dl import aio
+from cyberdrop_dl.clients import etag
+from cyberdrop_dl.crawlers.crawler import API, Crawler, SupportedDomains, SupportedPaths
+from cyberdrop_dl.exceptions import DownloadError, ScrapeError
+from cyberdrop_dl.url_objects import AbsoluteHttpURL
+from cyberdrop_dl.utils.dataclass import deserialize
+from cyberdrop_dl.utils.errors import error_handling_wrapper
+
+if TYPE_CHECKING:
+ from collections.abc import AsyncGenerator
+
+ from cyberdrop_dl.url_objects import ScrapeItem
+
+NOT_FOUND_MSG = "You either don't have permission to access this image or it has been deleted"
+
+etag.register(
+ etag.ETag(
+ "686157ae6e2b3d52f9bf5fb8f531da42",
+ NOT_FOUND_MSG,
+ 404, # https://cdn.lensdump.com/404.png
+ )
+)
+
+
+def _id(slug: str) -> str:
+ return slug.partition(".")[0]
+
+
+class LensDumpCrawler(Crawler):
+ SUPPORTED_DOMAINS: ClassVar[SupportedDomains] = ".l3n.co", "lensdump.com"
+ SUPPORTED_PATHS: ClassVar[SupportedPaths] = {
+ "Image": "/i/<image_id>",
+ "Album": "/a/<album_id>",
+ "Direct Links": "https://<server>.l3n.co/.../<image_id>.<ext>",
+ }
+ DOMAIN: ClassVar[str] = "lensdump"
+ PRIMARY_URL: ClassVar[AbsoluteHttpURL] = AbsoluteHttpURL("https://lensdump.com")
+
+ def __post_init__(self) -> None:
+ self.update_cookies({"ld_nsfw_ok": "1"})
+ self.api: LensDumpAPI = LensDumpAPI.from_crawler(self)
+
+ @classmethod
+ @override
+ def transform_url(cls, url: AbsoluteHttpURL) -> AbsoluteHttpURL:
+ url = super().transform_url(url)
+ match url.parts[1:]:
+ case [*_, name] if url.host.endswith(".l3n.co"):
+ return cls.PRIMARY_URL / "i" / _id(name)
+ case ["i" | "a" as kind, name]:
+ return cls.PRIMARY_URL / kind / _id(name)
+ case _:
+ return url
+
+ async def fetch(self, scrape_item: ScrapeItem) -> None:
+ match scrape_item.url.parts[1:]:
+ case ["i", image_id]:
+ await self.file(scrape_item, image_id)
+ case ["a", album_id]:
+ await self.album(scrape_item, album_id)
+ case ["404.png"]:
+ await self.raise_exc(scrape_item, 404)
+ case [username] if username not in {"upload", "login", "pricing", "signup", "api"}:
+ await self.user(scrape_item, username)
+ case _:
+ raise ValueError
+
+ @error_handling_wrapper
+ async def album(self, scrape_item: ScrapeItem, album_id: str) -> None:
+ album = await self.api.album(album_id)
+ await self._album(scrape_item, album)
+
+ def _album_title(self, album: Album) -> str:
+ return self.create_title(album.name, album.id, force_album_id=album.name.lower() == "earlier uploads")
+
+ @error_handling_wrapper
+ async def _album(self, scrape_item: ScrapeItem, album: FullAlbum) -> None:
+ scrape_item.setup_as_album(self._album_title(album), album_id=album.id)
+ self.create_eager_task(self.write_metadata(scrape_item, f"album_{album.id}", album))
+ if not album.files:
+ raise ScrapeError(204, "Album has no files")
+
+ if album.sub_albums:
+ pass # TODO: support this
+
+ downloaded = await self.get_completed_by_album(album.id)
+ sleep = aio.periodic_sleep(10)
+ async with aio.non_cancelling_taskgroup() as tg:
+ async for image in self.api.album_files(album):
+ web_url = self.PRIMARY_URL / "i" / image.id
+ if web_url in downloaded:
+ continue
+ tg.create_task(self._file(scrape_item.create_child(web_url), image))
+ scrape_item.add_children()
+ await sleep()
+
+ @error_handling_wrapper
+ async def user(self, scrape_item: ScrapeItem, username: str) -> None:
+ user = await self.api.user(username)
+ scrape_item.setup_as_profile(self.create_title(f"{user.username} [user]"))
+ self.create_eager_task(self.write_metadata(scrape_item, f"user_{user.username}", user))
+ if not user.albums:
+ raise ScrapeError(204, "User has no albums")
+
+ sleep = aio.periodic_sleep(10)
+ async with aio.non_cancelling_taskgroup() as tg:
+ async for album in self.api.user_albums(user):
+ web_url = self.PRIMARY_URL / "a" / album.id
+ tg.create_task(self._album(scrape_item.create_child(web_url), album))
+ scrape_item.add_children()
+ await sleep()
+
+ @error_handling_wrapper
+ async def file(self, scrape_item: ScrapeItem, image_id: str) -> None:
+ if await self.check_complete(scrape_item.url):
+ return
+
+ image = await self.api.file(image_id)
+ scrape_item.setup_as_album(self._album_title(image.album), album_id=image.album.id)
+ await self._file(scrape_item, image)
+
+ @error_handling_wrapper
+ async def _file(self, scrape_item: ScrapeItem, file: File) -> None:
+ src = self.parse_url(file.src)
+ _, ext = self.get_filename_and_ext(src.name)
+ await self.handle_file(
+ scrape_item.url,
+ scrape_item,
+ file.title,
+ ext,
+ custom_filename=self.create_custom_filename(file.title, ext, file_id=file.id),
+ metadata=file,
+ debrid_link=lambda: self.api.probe(src),
+ uploaded_at=int(self.parse_iso_date(file.uploaded_at)),
+ )
+
+
[email protected](slots=True, frozen=True)
+class File:
+ id: str
+ type: str
+ title: str
+ uploaded_at: str
+ album: Album
+ src: AbsoluteHttpURL | str
+ owner: User | None = None
+ description: str | None = None
+
+ @classmethod
+ def parse(cls, file: dict[str, Any], owner: User | None) -> Self:
+ return deserialize(
+ cls,
+ file,
+ src=file.get("src_url") or file["urls"]["file"],
+ owner=owner,
+ album=Album.parse(file["album"]),
+ uploaded_at=file.get("uploaded_at") or file["date"],
+ )
+
+
[email protected](slots=True, frozen=True)
+class User:
+ id: str
+ username: str
+ name: str | None
+
+ parse = classmethod(deserialize)
+
+
[email protected](slots=True, frozen=True)
+class FullUser(User):
+ files: int
+ albums: int
+ bio: str | None
+ tier: str
+
+
[email protected](slots=True, frozen=True)
+class Album:
+ id: str
+ name: str
+
+ parse = classmethod(deserialize)
+
+
[email protected](slots=True, frozen=True)
+class FullAlbum(Album):
+ files: int
+ sub_albums: int
+ owner: User | None
+ created_at: str | None = None
+ parent: str | None = None
+
+
+class LensDumpAPI(API):
+ ENTRYPOINT: ClassVar[AbsoluteHttpURL] = AbsoluteHttpURL("https://lensdump.com/api/2")
+
+ async def file(self, image_id: str) -> File:
+ url = self.ENTRYPOINT / "files" / image_id
+ resp = await self.request_json(url)
+ owner = resp.get("owner")
+ return File.parse(resp, owner=User.parse(owner) if owner else None)
+
+ async def probe(self, url: AbsoluteHttpURL) -> AbsoluteHttpURL:
+ async with self.request(url) as resp:
+ if resp.url.name == "404.png":
+ raise DownloadError(404, NOT_FOUND_MSG)
+ return resp.url
+
+ async def user(self, username: str) -> FullUser:
+ url = self.ENTRYPOINT / "users" / username
+ resp = await self.request_json(url)
+ return FullUser.parse(resp)
+
+ async def album(self, album_id: str) -> FullAlbum:
+ url = self.ENTRYPOINT / "albums" / album_id
+ resp = await self.request_json(url)
+ owner = resp.get("owner")
+ return FullAlbum.parse(resp, owner=User.parse(owner) if owner else None)
+
+ async def user_albums(self, user: User) -> AsyncGenerator[FullAlbum]:
+ url = self.ENTRYPOINT / "users" / user.username / "albums"
+ async for album in self._pager(url):
+ yield FullAlbum.parse(album, owner=user)
+
+ async def album_files(self, album: FullAlbum) -> AsyncGenerator[File]:
+ url = self.ENTRYPOINT / "albums" / album.id / "files"
+ async for file in self._pager(url):
+ file["src_url"] = _thumb_to_src(self.parse_url(file["preview"]))
+ yield File.parse(file, album.owner)
+
+ async def _pager(self, url: AbsoluteHttpURL) -> AsyncGenerator[dict[str, Any]]:
+ while True:
+ resp = await self.request_json(url)
+ for item in resp["items"]:
+ yield item
+
+ cursor = resp.get("next_cursor")
+ if not cursor:
+ break
+
+ url = url.update_query(cursor=cursor)
+
+
+def _thumb_to_src(url: AbsoluteHttpURL) -> AbsoluteHttpURL:
+ return url.with_name(url.name.replace(".th.", ".").replace(".md.", "."))
diff --git a/tests/crawlers/test_cases/lensdump.py b/tests/crawlers/test_cases/lensdump.py
new file mode 100644
index 000000000..69402926e
--- /dev/null
+++ b/tests/crawlers/test_cases/lensdump.py
@@ -0,0 +1,225 @@
+DOMAIN = "lensdump"
+TEST_CASES = [
+ {
+ "url": "https://lensdump.com/i/86Njhe",
+ "results": [
+ {
+ "url": "https://lensdump.com/i/86Njhe",
+ "filename": "Temple of Doom Gold Series Version 1 [86Njhe].jpg",
+ "debrid_url": None,
+ "original_filename": "Temple of Doom Gold Series Version 1",
+ "referer": "https://lensdump.com/i/86Njhe",
+ "album_id": "gAXLD",
+ "uploaded_at": 1522263221,
+ "download_folder": "re:Indiana Jones Collection (Lensdump)",
+ "thumbnail": None,
+ "size": None,
+ "duration": None,
+ "metadata": {
+ "id": "86Njhe",
+ "type": "image",
+ "title": "Temple of Doom Gold Series Version 1",
+ "uploaded_at": "2018-03-28T18:53:41Z",
+ "album": {"id": "gAXLD", "name": "Indiana Jones Collection"},
+ "src": "https://a.l3n.co/86Njhe.jpg",
+ "owner": {
+ "id": "nT93",
+ "username": "nielslauridsen",
+ "name": "tintacle",
+ },
+ "description": None,
+ },
+ "extra_info": {},
+ "id": ["lensdump", "/i/86Njhe"],
+ }
+ ],
+ },
+ {
+ "url": "https://lensdump.com/i/PWb8q1",
+ "results": [
+ {
+ "url": "https://lensdump.com/i/PWb8q1",
+ "filename": "Video senza titolo Realizzato con Clipchamp (22) [PWb8q1].gif",
+ "debrid_url": "https://d.l3n.co/PWb8q1.gif",
+ "original_filename": "Video senza titolo Realizzato con Clipchamp (22)",
+ "referer": "https://lensdump.com/i/PWb8q1",
+ "album_id": "9wSLD99O",
+ "uploaded_at": 1757859018,
+ "download_folder": "re:Earlier uploads 9wSLD99O (Lensdump)",
+ "thumbnail": None,
+ "size": None,
+ "duration": None,
+ "parents": [],
+ "metadata": {
+ "id": "PWb8q1",
+ "type": "image",
+ "title": "Video senza titolo Realizzato con Clipchamp (22)",
+ "uploaded_at": "2025-09-14T14:10:18Z",
+ "album": {"id": "9wSLD99O", "name": "Earlier uploads"},
+ "src": "https://d.l3n.co/PWb8q1.gif",
+ "owner": None,
+ "description": None,
+ },
+ "extra_info": {},
+ "id": ["lensdump", "/i/PWb8q1"],
+ "base64_id": "bGVuc2R1bXAvaS9QV2I4cTE",
+ }
+ ],
+ "count": 1,
+ },
+ {
+ "url": "https://d.l3n.co/PWb8q1.gif",
+ "description": "direct URL of the gif above",
+ "results": [
+ {
+ "url": "https://lensdump.com/i/PWb8q1",
+ "filename": "Video senza titolo Realizzato con Clipchamp (22) [PWb8q1].gif",
+ "debrid_url": "https://d.l3n.co/PWb8q1.gif",
+ "original_filename": "Video senza titolo Realizzato con Clipchamp (22)",
+ "referer": "https://lensdump.com/i/PWb8q1",
+ }
+ ],
+ "count": 1,
+ },
+ {
+ "url": "https://lensdump.com/a/gAXLD",
+ "description": "16 images (8 of them deleted 404)",
+ "results": [
+ {
+ "url": "https://lensdump.com/i/86Njhe",
+ "filename": "Temple of Doom Gold Series Version 1 [86Njhe].jpg",
+ "debrid_url": None,
+ "original_filename": "Temple of Doom Gold Series Version 1",
+ "referer": "https://lensdump.com/i/86Njhe",
+ "album_id": "gAXLD",
+ "uploaded_at": 1522263221,
+ "download_folder": "re:Indiana Jones Collection (Lensdump)",
+ "thumbnail": None,
+ "size": None,
+ "duration": None,
+ "metadata": {
+ "id": "86Njhe",
+ "type": "image",
+ "title": "Temple of Doom Gold Series Version 1",
+ "uploaded_at": "2018-03-28T18:53:41Z",
+ "album": {"id": "gAXLD", "name": "Indiana Jones Collection"},
+ "src": "https://a.l3n.co/86Njhe.jpg",
+ "owner": {
+ "id": "nT93",
+ "username": "nielslauridsen",
+ "name": "tintacle",
+ },
+ "description": None,
+ },
+ "extra_info": {},
+ "id": ["lensdump", "/i/86Njhe"],
+ },
+ {
+ "url": "https://lensdump.com/i/86NE0Z",
+ "filename": "Kingdom of the Crystal Skull Gold Series Version 2 [86NE0Z].jpg",
+ "debrid_url": None,
+ "original_filename": "Kingdom of the Crystal Skull Gold Series Version 2",
+ "referer": "https://lensdump.com/i/86NE0Z",
+ },
+ {
+ "url": "https://lensdump.com/i/9f9Nb",
+ "filename": "Raiders of the Lost Ark DCC Version 1 (Vinyl) [9f9Nb].jpg",
+ "debrid_url": None,
+ "original_filename": "Raiders of the Lost Ark DCC Version 1 (Vinyl)",
+ "referer": "https://lensdump.com/i/9f9Nb",
+ },
+ {
+ "url": "https://lensdump.com/i/9fTa2",
+ "filename": "Raiders of the Lost Ark DCC Version 1 [9fTa2].jpg",
+ "debrid_url": None,
+ "original_filename": "Raiders of the Lost Ark DCC Version 1",
+ "referer": "https://lensdump.com/i/9fTa2",
+ },
+ {
+ "url": "https://lensdump.com/i/iHD0OF",
+ "filename": "Kingdom of the Crystal Skull (DVD Version 1) [iHD0OF].jpg",
+ "debrid_url": None,
+ "original_filename": "Kingdom of the Crystal Skull (DVD Version 1)",
+ "referer": "https://lensdump.com/i/iHD0OF",
+ },
+ {
+ "url": "https://lensdump.com/i/86uXEH",
+ "filename": "Raiders of the Lost Ark Gold Series Version 1 [86uXEH].jpg",
+ "debrid_url": None,
+ "original_filename": "Raiders of the Lost Ark Gold Series Version 1",
+ "referer": "https://lensdump.com/i/86uXEH",
+ },
+ {
+ "url": "https://lensdump.com/i/iHuNuK",
+ "filename": "Raiders of the Lost Ark (DVD Version 1) [iHuNuK].jpg",
+ "debrid_url": None,
+ "original_filename": "Raiders of the Lost Ark (DVD Version 1)",
+ "referer": "https://lensdump.com/i/iHuNuK",
+ },
+ {
+ "url": "https://lensdump.com/i/iHufAZ",
+ "filename": "Temple of Doom (DVD Version 1) [iHufAZ].jpg",
+ "debrid_url": None,
+ "original_filename": "Temple of Doom (DVD Version 1)",
+ "referer": "https://lensdump.com/i/iHufAZ",
+ },
+ {
+ "url": "https://lensdump.com/i/86NICk",
+ "filename": "The Last Crusade Gold Series Version 1 [86NICk].jpg",
+ "debrid_url": None,
+ "original_filename": "The Last Crusade Gold Series Version 1",
+ "referer": "https://lensdump.com/i/86NICk",
+ },
+ {
+ "url": "https://lensdump.com/i/86Nt11",
+ "filename": "Kingdom of the Crystal Skull Gold Series Version 1 [86Nt11].jpg",
+ "debrid_url": None,
+ "original_filename": "Kingdom of the Crystal Skull Gold Series Version 1",
+ "referer": "https://lensdump.com/i/86Nt11",
+ },
+ {
+ "url": "https://lensdump.com/i/iHDrsD",
+ "filename": "The Last Crusade (DVD Alternate) [iHDrsD].jpg",
+ "debrid_url": None,
+ "original_filename": "The Last Crusade (DVD Alternate)",
+ "referer": "https://lensdump.com/i/iHDrsD",
+ },
+ {
+ "url": "https://lensdump.com/i/iHDIc3",
+ "filename": "Raiders of the Lost Ark (DVD Alternate) [iHDIc3].jpg",
+ "debrid_url": None,
+ "original_filename": "Raiders of the Lost Ark (DVD Alternate)",
+ "referer": "https://lensdump.com/i/iHDIc3",
+ },
+ {
+ "url": "https://lensdump.com/i/iHDgg0",
+ "filename": "Temple of Doom (DVD Alternate) [iHDgg0].jpg",
+ "debrid_url": None,
+ "original_filename": "Temple of Doom (DVD Alternate)",
+ "referer": "https://lensdump.com/i/iHDgg0",
+ },
+ {
+ "url": "https://lensdump.com/i/iHDjEr",
+ "filename": "The Last Crusade (DVD Version 1) [iHDjEr].jpg",
+ "debrid_url": None,
+ "original_filename": "The Last Crusade (DVD Version 1)",
+ "referer": "https://lensdump.com/i/iHDjEr",
+ },
+ {
+ "url": "https://lensdump.com/i/iHDtDq",
+ "filename": "Kingdom of the Crystal Skull (DVD Alternate) [iHDtDq].jpg",
+ "debrid_url": None,
+ "original_filename": "Kingdom of the Crystal Skull (DVD Alternate)",
+ "referer": "https://lensdump.com/i/iHDtDq",
+ },
+ {
+ "url": "https://lensdump.com/i/joLC9c",
+ "filename": "Raiders of the Lost Ark Version 4 [joLC9c].jpg",
+ "debrid_url": None,
+ "original_filename": "Raiders of the Lost Ark Version 4",
+ "referer": "https://lensdump.com/i/joLC9c",
+ },
+ ],
+ "count": 16,
+ },
+]