Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
feat: add `expand_posts` option (Pawchive)
NTFSvolumebb0d84c760b0
diff --git a/cyberdrop_dl/config/crawlers.py b/cyberdrop_dl/config/crawlers.pyindex d9b65bace..9dfe247b8 100644--- a/cyberdrop_dl/config/crawlers.py+++ b/cyberdrop_dl/config/crawlers.py@@ -38,7 +38,10 @@ class KemonoConfig(ConfigModel):"Download all attachments in a post (may or may not include `file`)"content_urls: bool = True- "Download any URL found inside the description (text) of a post (slower)"+ "Download any URL found inside the description (text) of a post"++ expand_posts: bool = False+ "Make an additional API request for each post to get original filenames and the content/text (slower)"embed: bool = True"Download the embedded file from third party sites (if any)(mega.nz, pcloud, dropbox, etc..)"diff --git a/cyberdrop_dl/config/default.yaml b/cyberdrop_dl/config/default.yamlindex 22301df56..dcd000b57 100644--- a/cyberdrop_dl/config/default.yaml+++ b/cyberdrop_dl/config/default.yaml@@ -59,11 +59,13 @@ crawlers:attachments: truecontent_urls: trueembed: true+ expand_posts: falsefile: truepawchive:attachments: truecontent_urls: trueembed: true+ expand_posts: falsefile: truepornhub:profile_paths:diff --git a/cyberdrop_dl/config/schema.json b/cyberdrop_dl/config/schema.jsonindex 492a7c9a9..52710933d 100644--- a/cyberdrop_dl/config/schema.json+++ b/cyberdrop_dl/config/schema.json@@ -754,6 +754,11 @@"title": "Content Urls","type": "boolean"},+ "expand_posts": {+ "default": false,+ "title": "Expand Posts",+ "type": "boolean"+ },"embed": {"default": true,"title": "Embed",diff --git a/cyberdrop_dl/crawlers/kemono/kemono.py b/cyberdrop_dl/crawlers/kemono/kemono.pyindex 6f2482229..f81c44ae0 100644--- a/cyberdrop_dl/crawlers/kemono/kemono.py+++ b/cyberdrop_dl/crawlers/kemono/kemono.py@@ -60,17 +60,17 @@ class KemonoBaseCrawler[T: KemonoAPI[Any]](Crawler, is_abc=True):async def fetch(self, scrape_item: ScrapeItem) -> None:match scrape_item.url.parts[1:]:case [service, "user", creator_id, "post", post_id]:- return await self.post(scrape_item, service, creator_id, post_id)+ await self.post(scrape_item, service, creator_id, post_id)case [service, "user", creator_id]:- return await self.creator(scrape_item, service, creator_id)+ await self.creator(scrape_item, service, creator_id)case ["favorites"] if (type_ := scrape_item.url.query.get("type")) in ("post", "artist", None):- return await self.favorites(scrape_item, type_ or "artist")+ await self.favorites(scrape_item, type_ or "artist")case ["account", "favorites", slug] if (type_ := slug.removesuffix("s")) in ("post", "artist"):- return await self.favorites(scrape_item, type_)+ await self.favorites(scrape_item, type_)case ["posts"] if search_query := scrape_item.url.query.get("q"):- return await self.search(scrape_item, search_query)+ await self.search(scrape_item, search_query)case ["thumbnail" | "thumbnails" | "data", _, *_]:- return await self._direct_file(scrape_item)+ await self._direct_file(scrape_item)case _:raise ValueError@@ -188,10 +188,11 @@ class KemonoBaseCrawler[T: KemonoAPI[Any]](Crawler, is_abc=True):for post in posts:self.__check_for_ads(post)new_item = scrape_item.create_child(self.parse_url(post.web_path_qs))- if post.content or not self.__kemono_config__.content_urls:- await self._user_post(new_item, post)+ expand = self.__kemono_config__.expand_posts or (self.__kemono_config__.content_urls and not post.content)+ if expand:+ self.create_task(self.post(new_item, post.service, post.user_id, post.id))else:- self.create_task(self.run(new_item))+ await self._user_post(new_item, post)scrape_item.add_children()diff --git a/cyberdrop_dl/crawlers/kemono/only_haven.py b/cyberdrop_dl/crawlers/kemono/only_haven.pyindex 4767a77da..05087646f 100644--- a/cyberdrop_dl/crawlers/kemono/only_haven.py+++ b/cyberdrop_dl/crawlers/kemono/only_haven.py@@ -126,13 +126,13 @@ class OnlyHavenCrawler(KemonoBaseCrawler[OnlyHavenAPI]):async def fetch(self, scrape_item: ScrapeItem) -> None:match scrape_item.url.parts[1:]:case ["creators", service, creator_id, "post", post_id]:- return await self.post(scrape_item, service, creator_id, post_id)+ await self.post(scrape_item, service, creator_id, post_id)case ["creators", service, creator_id, "dm", dm_id]:- return await self.dm(scrape_item, service, creator_id, dm_id)+ await self.dm(scrape_item, service, creator_id, dm_id)case ["creators", service, creator_id]:- return await self.creator(scrape_item, service, creator_id)+ await self.creator(scrape_item, service, creator_id)case ["posts"] if search_query := scrape_item.url.query.get("q"):- return await self.search(scrape_item, search_query)+ await self.search(scrape_item, search_query)case _:raise ValueErrordiff --git a/docs/reference/config/crawlers.md b/docs/reference/config/crawlers.mdindex ccfb0074e..81a8d1eab 100644--- a/docs/reference/config/crawlers.md+++ b/docs/reference/config/crawlers.md@@ -124,7 +124,7 @@ Parse and download embeds from third-party sites| ------ | ------- || `Bool` | `true` |-Parse and try to download any URL found inside the text of a post+Parse and try to download any URL found inside the text of a post.## `threads`@@ -205,7 +205,7 @@ Default format for presentations (can be overridden per URL with the 'format' quDownload episodes with english audio tracks instead of japanese (if available)-# Pawchive+# Pawchive / OnlyHaven## `file`@@ -232,8 +232,19 @@ Download all attachments in a post (may or may not include `file`)Scan the description (text) in a post and download any URL found{% hint style="warning" %}-This option slows down scraping significally. The default response from a search query does not return the content of each post.-`cyberdrop-dl` needs to make an additional request for each post to get its content (50x requests in total).+This option slows down scraping significally (50x requests in total)+{% endhint %}++## `expand_posts`++| Type | Default |+| ------ | ------- |+| `Bool` | `false` |++When crawling profiles/favorites/searchs results, make an additional request per post to get the original filenames of files and the content/text in the post++{% hint style="warning" %}+This option slows down scraping significally (50x requests in total){% endhint %}## `embed`