Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
refactor: make create children a scrape_item method
NTFSvolumef28437e82198
diff --git a/cyberdrop_dl/crawlers/crawler.py b/cyberdrop_dl/crawlers/crawler.pyindex 9b3569ac7..2779066f7 100644--- a/cyberdrop_dl/crawlers/crawler.py+++ b/cyberdrop_dl/crawlers/crawler.py@@ -758,16 +758,14 @@ class Crawler(HTTPMixin, HLSMixin, ABC):/,attribute: str = "href",*,- results: Mapping[str, bool] | None = None,- ) -> Generator[tuple[AbsoluteHttpURL | None, ScrapeItem]]:+ results: Mapping[str, bool] | None = None, # noqa: ARG002+ ) -> Generator[tuple[None, ScrapeItem]]:"""Generates tuples with an URL from the `src` value of the first image tag (AKA the thumbnail) and a new scrape item from the value of `attribute`:param results: must be the output of `self.get_album_results`.If provided, it will be used as a filter, to only yield items that has not been downloaded before"""- for thumb, link in self.iter_thumbnails(soup, selector, attribute, results=results):- new_scrape_item = scrape_item.create_child(link)- yield thumb, new_scrape_item- scrape_item.add_children()+ for new_scrape_item in scrape_item.create_children(self.iter_urls(soup, selector, attribute)):+ yield None, new_scrape_itemasync def web_pager(self,diff --git a/cyberdrop_dl/url_objects.py b/cyberdrop_dl/url_objects.pyindex e306eee31..68136e625 100644--- a/cyberdrop_dl/url_objects.py+++ b/cyberdrop_dl/url_objects.py@@ -15,7 +15,7 @@ import yarlfrom cyberdrop_dl.utils.filepath import sanitize_folderif TYPE_CHECKING:- from collections.abc import Generator, Sequence+ from collections.abc import Generator, Iterable, Sequencefrom cyberdrop_dl import signaturefrom cyberdrop_dl.manager import Manager@@ -341,6 +341,11 @@ class ScrapeItem:def setup_as_post(self: ScrapeItem, title: str, *, album_id: str | None = None) -> None:return self.setup_as(title, FORUM_POST, album_id=album_id)+ def create_children(self, urls: Iterable[AbsoluteHttpURL]) -> Generator[Self]:+ for url in urls:+ yield self.create_child(url)+ self.add_children()+@propertydef origin(self) -> AbsoluteHttpURL | None:if self.parents: