Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
Add hgamecg support
Jules-WinnfieldX677566140293
diff --git a/README.md b/README.mdindex 3d2cc0126..c5fcc4341 100644--- a/README.md+++ b/README.md@@ -1,7 +1,7 @@# `cyberdrop-dl`**Bulk downloader for multiple file hosts**-The latest version of the program is 3.5.9+The latest version of the program is 3.5.11<a href="https://www.buymeacoffee.com/juleswinnft" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>@@ -18,6 +18,7 @@ The latest version of the program is 3.5.9| Cyberfile | folders: cyberfile.is/folder/... <br> shared: cyberfile.is/shared/... <br> Direct: cyberfile.is/... || Erome | Albums: erome.com/a/... || GoFile | Albums: gofile.io/d/... |+| HGameCG | Albums: hgamecg.com/.../index.html || IMG.Kiwi | Albums: img.kiwi/album/... <br> Direct Images: img.kiwi/image/... <br> User Profile: img.kiwi/#USER# <br> All User Albums: img.kiwi/#USER#/albums || jpg.church | Albums: jpg.church/album/... <br> Direct Images: jpg.church/image/... <br> User Profile: jpg.church/#USER# <br> All User Albums: jpg.church/#USER#/albums || Kemono.party | Profiles: kemono.party/... <br> Thumbnail Links: kemono.party/thumbnail/... <br> Data Links: kemono.party/data/... <br> Posts: kemono.party/.../post/... |@@ -41,28 +42,21 @@ You can get Python from here: https://www.python.org/downloads/Make sure you tick the check box for "Add python to path"-`cyberdrop-dl` will take the title of the archive and create a new folder for it, and download all of the available media to that folder.-It'll repeat that for every link you give it.--# Installation-Mac users will also likely need to open terminal and execute the following command: `xcode-select --install`-## Script method+# Script MethodGo to the [releases page](https://github.com/Jules-WinnfieldX/CyberDropDownloader/releases) and download the Cyberdrop_DL.zip file. Extract it to wherever you want the program to be.-## Using `pip`-Once Python is installed, run `pip3 install cyberdrop-dl`.--Advanced users may want to use virtual environments (via `pipx`), but it's **NOT** required.--# Usage-## Script methodPut the links in the URLs.txt file then run `Start Windows.bat` (Windows) or `Start Mac.command` (OS X) or `Start Linux.sh` (Linux).** Mac users will need to run the command `chmod +x 'Start Mac.command'` to make the file executable.-## Pip install method+# CLI Method++Run `pip3 install cyberdrop-dl` in command prompt/terminal++Advanced users may want to use virtual environments (via `pipx`), but it's **NOT** required.+1. Run `cyberdrop-dl` once to generate an empty `URLs.txt` file.2. Copy and paste your links into `URLs.txt`.Each link you add has to go on its own line (paste link, press enter, repeat).@@ -70,7 +64,7 @@ Each link you add has to go on its own line (paste link, press enter, repeat).It will begin to download everything.4. Enjoy!-## Custom way (Pip install above)+## ArgumentsIf you know what you're doing, you can use the available options to adjust how the program runs.```$ cyberdrop-dl -h@@ -117,6 +111,6 @@ optional arguments:--ratelimit this will add a ratelimiter to requests made in the program, the number you provide is in seconds--throttle this is a throttle between requests during the downloading phase, the number is in seconds```---skip can use: "anonfiles", "bayfiles", "bunkr", "coomer.party", "cyberdrop", "cyberfile", "erome", "gfycat", "gofile",+--skip can use: "anonfiles", "bayfiles", "bunkr", "coomer.party", "cyberdrop", "cyberfile", "erome", "gfycat", "gofile", "hgamescg","jpg.church", "kemono.party", "pixeldrain", "pixl.is", "postimg.cc", "redgifs", "saint", "socialmediagirls", "simpcity", "xbunker", "xbunkr"diff --git a/changelog.txt b/changelog.txtindex 821e8d3cb..11c09b519 100644--- a/changelog.txt+++ b/changelog.txt@@ -58,4 +58,7 @@- Follow links on Kemono/Coomer3.5.9-- Change Kemono/Coomer to not separate posts unless flag is set.\ No newline at end of file+- Change Kemono/Coomer to not separate posts unless flag is set.++3.5.11+- Add hgamecg support\ No newline at end of filediff --git a/cyberdrop_dl/__init__.py b/cyberdrop_dl/__init__.pyindex 2f3fddf6b..b20c367c2 100644--- a/cyberdrop_dl/__init__.py+++ b/cyberdrop_dl/__init__.py@@ -1 +1 @@-__version__ = "3.5.9"+__version__ = "3.5.11"diff --git a/cyberdrop_dl/base_functions/data_classes.py b/cyberdrop_dl/base_functions/data_classes.pyindex a5bd8b632..b9016b323 100644--- a/cyberdrop_dl/base_functions/data_classes.py+++ b/cyberdrop_dl/base_functions/data_classes.py@@ -138,7 +138,7 @@ class AuthData:@dataclassclass SkipData:supported_hosts: ClassVar[Tuple[str]] = (- "anonfiles", "bayfiles", "bunkr", "coomer.party", "cyberdrop", "cyberfile", "erome", "gfycat", "gofile", "img.kiwi",- "jpg.church", "kemono.party", "pixeldrain", "pixl.is", "postimg.cc", "redgifs", "rule34", "saint",- "socialmediagirls", "simpcity", "xbunker", "xbunkr")+ "anonfiles", "bayfiles", "bunkr", "coomer.party", "cyberdrop", "cyberfile", "erome", "gfycat", "gofile",+ "hgamecg", "img.kiwi", "jpg.church", "kemono.party", "pixeldrain", "pixl.is", "postimg.cc", "redgifs", "rule34",+ "saint", "socialmediagirls", "simpcity", "xbunker", "xbunkr")sites: List[str]diff --git a/cyberdrop_dl/crawlers/HGameCG_Spider.py b/cyberdrop_dl/crawlers/HGameCG_Spider.pynew file mode 100644index 000000000..f5781c9e0--- /dev/null+++ b/cyberdrop_dl/crawlers/HGameCG_Spider.py@@ -0,0 +1,54 @@+from yarl import URL++from ..base_functions.base_functions import log, logger, make_title_safe, check_direct+from ..base_functions.data_classes import DomainItem+from ..client.client import Session+++class HGameCGCrawler:+ async def fetch(self, session: Session, url: URL):+ domain_obj = DomainItem(url.host, {})++ await log("Starting scrape of " + str(url))+ results = await self.get_album(session, url)+ for result in results:+ await domain_obj.add_to_album(result['title'], result['url'], result['referral'])+ await log("Finished scrape of " + str(url))+ return domain_obj++ async def get_album(self, session: Session, url: URL):+ results = []+ try:+ soup = await session.get_BS4(url)+ title = await make_title_safe(soup.select_one("div[class=navbar] h1").get_text())+ results = []++ images = soup.select("div[class=image] a")+ for image in images:+ image = image.get('href')+ image = URL("https://" + url.host + image)+ link = await self.get_image(session, image)+ results.append({'url': link, 'title': title, 'referral': url, 'cookies': ''})++ next_page = soup.find("a", text="Next Page")+ if next_page is not None:+ next_page = next_page.get('href')+ if next_page is not None:+ next_page = URL("https://" + url.host + next_page)+ results.extend(result for result in await self.get_album(session, next_page))++ except Exception as e:+ logger.debug("Error encountered while handling %s", str(url), exc_info=True)+ await log("Error scraping " + str(url))+ logger.debug(e)++ return results++ async def get_image(self, session: Session, url: URL):+ try:+ soup = await session.get_BS4(url)+ image = soup.select_one("div[class=hgamecgimage] img")+ image = URL(image.get('src'))+ return image+ except:+ logger.error(f"Unable to get image from {str(url)}")diff --git a/cyberdrop_dl/scraper/scraper_helper.py b/cyberdrop_dl/scraper/scraper_helper.pyindex c3d0f6734..07c6fa277 100644--- a/cyberdrop_dl/scraper/scraper_helper.py+++ b/cyberdrop_dl/scraper/scraper_helper.py@@ -16,6 +16,7 @@ from ..crawlers.Cyberfile_Spider import CyberfileCrawlerfrom ..crawlers.Erome_Spider import EromeCrawlerfrom ..crawlers.Gfycat_Spider import GfycatCrawlerfrom ..crawlers.GoFile_Spider import GofileCrawler+from ..crawlers.HGameCG_Spider import HGameCGCrawlerfrom ..crawlers.Kemono_Spider import KemonoCrawlerfrom ..crawlers.Pixeldrain_Spider import PixelDrainCrawlerfrom ..crawlers.Postimg_Spider import PostImgCrawler@@ -36,6 +37,7 @@ class ScrapeMapper:def __init__(self, *, client: Client, file_args: Dict, jdownloader_args: Dict, runtime_args: Dict,jdownloader_auth: AuthData, simpcity_auth: AuthData, socialmediagirls_auth: AuthData,xbunker_auth: AuthData, skip_data: SkipData):+self.include_id = runtime_args['include_id']self.jdownloader_enable = jdownloader_args['jdownloader_enable']self.jdownloader_device = jdownloader_args['jdownloader_device']@@ -58,6 +60,7 @@ class ScrapeMapper:self.erome_crawler = Noneself.gfycat_crawler = Noneself.gofile_crawler = None+ self.hgamecg_crawler = Noneself.kemono_crawler = Noneself.pixeldrain_crawler = Noneself.postimg_crawler = None@@ -79,10 +82,10 @@ class ScrapeMapper:self.mapping = {"anonfiles.com": self.Anonfiles, "bayfiles": self.Anonfiles, "xbunkr": self.XBunkr,"bunkr": self.Bunkr, "coomer.party": self.Coomer, "cyberdrop": self.Cyberdrop,"cyberfile.is": self.Cyberfile, "erome.com": self.Erome, "gfycat.com": self.Gfycat,- "gofile.io": self.GoFile, "img.kiwi": self.ShareX, "jpg.church": self.ShareX,- "kemono.party": self.Kemono, "pixeldrain.com": self.Pixeldrain, "pixl.is": self.ShareX,- "postimg": self.Postimg, "redgifs.com": self.Redgifs, "rule34.xxx": self.Rule34,- "saint.to": self.Saint, "socialmediagirls": self.SocialMediaGirls,+ "gofile.io": self.GoFile, "hgamecg.com": self.HGameCG, "img.kiwi": self.ShareX,+ "jpg.church": self.ShareX, "kemono.party": self.Kemono, "pixeldrain.com": self.Pixeldrain,+ "pixl.is": self.ShareX, "postimg": self.Postimg, "redgifs.com": self.Redgifs,+ "rule34.xxx": self.Rule34, "saint.to": self.Saint, "socialmediagirls": self.SocialMediaGirls,"simpcity": self.SimpCity, "xbunker": self.XBunker}async def Anonfiles(self, url: URL, title=None):@@ -119,7 +122,8 @@ class ScrapeMapper:async def Coomer(self, url: URL, title=None):coomer_session = Session(self.client)if not self.coomer_crawler:- self.coomer_crawler = CoomerCrawler(include_id=self.include_id, scraping_mapper=self, separate_posts=self.separate_posts)+ self.coomer_crawler = CoomerCrawler(include_id=self.include_id, scraping_mapper=self,+ separate_posts=self.separate_posts)domain_obj = await self.coomer_crawler.fetch(coomer_session, url)if title:await domain_obj.append_title(title)@@ -161,10 +165,21 @@ class ScrapeMapper:await self.Cascade.add_albums(domain_obj)await gofile_session.exit_handler()+ async def HGameCG(self, url: URL, title=None):+ hgamecg_session = Session(self.client)+ if not self.hgamecg_crawler:+ self.hgamecg_crawler = HGameCGCrawler()+ domain_obj = await self.hgamecg_crawler.fetch(hgamecg_session, url)+ if title:+ await domain_obj.append_title(title)+ await self.Cascade.add_albums(domain_obj)+ await hgamecg_session.exit_handler()+async def Kemono(self, url: URL, title=None):kemono_session = Session(self.client)if not self.kemono_crawler:- self.kemono_crawler = KemonoCrawler(include_id=self.include_id, scraping_mapper=self, separate_posts=self.separate_posts)+ self.kemono_crawler = KemonoCrawler(include_id=self.include_id, scraping_mapper=self,+ separate_posts=self.separate_posts)domain_obj = await self.kemono_crawler.fetch(kemono_session, url)if title:await domain_obj.append_title(title)