Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
Implement single post scraping option for forums.
Jules-WinnfieldXafeb190d1c21
diff --git a/README.md b/README.mdindex 34842301d..aab12b2ff 100644--- a/README.md+++ b/README.md@@ -157,6 +157,7 @@ optional arguments:--throttle this is a throttle between requests during the downloading phase, the number is in seconds--output-last-forum-post outputs the last post of a forum scrape to use as a starting point for future runs+--scrape-single-post scrapes a single post from a forum thread--separate-posts separates forum scraping into folders by post number--gofile-api-key api key for premium gofilediff --git a/cyberdrop_dl/__init__.py b/cyberdrop_dl/__init__.pyindex 8fa221e69..0f4dd5262 100644--- a/cyberdrop_dl/__init__.py+++ b/cyberdrop_dl/__init__.py@@ -1 +1 @@-__version__ = "4.2.16"+__version__ = "4.2.17"diff --git a/cyberdrop_dl/base_functions/config_schema.py b/cyberdrop_dl/base_functions/config_schema.pyindex 1bed2ab2e..4af417cce 100644--- a/cyberdrop_dl/base_functions/config_schema.py+++ b/cyberdrop_dl/base_functions/config_schema.py@@ -28,6 +28,7 @@ config_default: Dict = {},"Forum_Options": {"output_last_forum_post": False,+ "scrape_single_post": False,"separate_posts": False,},"Ignore": {diff --git a/cyberdrop_dl/crawlers/Xenforo_Spider.py b/cyberdrop_dl/crawlers/Xenforo_Spider.pyindex f9566f750..c9cbd9486 100644--- a/cyberdrop_dl/crawlers/Xenforo_Spider.py+++ b/cyberdrop_dl/crawlers/Xenforo_Spider.py@@ -142,6 +142,8 @@ class XenforoCrawler:def __init__(self, *, scraping_mapper, args: Dict, SQL_Helper: SQLHelper, quiet: bool):self.include_id = args["Runtime"]["include_id"]self.quiet = quiet++ self.scrape_single_post = args["Forum_Options"]["scrape_single_post"]self.separate_posts = args["Forum_Options"]["separate_posts"]self.output_last = args["Forum_Options"]["output_last_forum_post"]self.output_last_file = args["Files"]["output_last_forum_post_file"]@@ -258,6 +260,7 @@ class XenforoCrawler:title: str, post_number: int) -> str:"""Parses forum threads"""soup = await session.get_BS4(url)+ continue_scrape = Trueassert url.host is not Nonedomain = URL("https://" + url.host)@@ -303,6 +306,10 @@ class XenforoCrawler:content_links.extend([(URL(link), temp_title) for link in links])+ if self.scrape_single_post:+ continue_scrape = False+ break+# Handle linksdef is_direct_link(host: str) -> bool:assert url.host is not None@@ -315,7 +322,7 @@ class XenforoCrawler:await self.handle_external_links(external_links, url)next_page = soup.select_one(spec.next_page_tag)- if next_page is not None:+ if next_page is not None and continue_scrape:next_page = next_page.get(spec.next_page_attribute)if next_page is not None:if next_page.startswith('/'):diff --git a/cyberdrop_dl/main.py b/cyberdrop_dl/main.pyindex 1943e5be7..4d9efd45b 100644--- a/cyberdrop_dl/main.py+++ b/cyberdrop_dl/main.py@@ -98,6 +98,7 @@ def parse_args() -> argparse.Namespace:forum_opts = parser.add_argument_group("Forum options")forum_opts.add_argument("--output-last-forum-post", help="outputs the last post of a forum scrape to use as a starting point for future runs", action="store_true")forum_opts.add_argument("--separate-posts", help="separates forum scraping into folders by post number", action="store_true")+ forum_opts.add_argument("--scrape-single-post", help="Scrapes only a single post from the given forum links", action="store_true")# Authentication detailsconfig_group = config_data["Authentication"]