Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
Cleanup ScrapeMapper a little
Arkadiy Illarionov0140bbdc0492
diff --git a/cyberdrop_dl/crawlers/Anonfiles_Spider.py b/cyberdrop_dl/crawlers/Anonfiles_Spider.pyindex 905b7f236..d1196d9e0 100644--- a/cyberdrop_dl/crawlers/Anonfiles_Spider.py+++ b/cyberdrop_dl/crawlers/Anonfiles_Spider.py@@ -12,7 +12,7 @@ class AnonfilesCrawler:self.SQL_Helper = SQL_Helperself.api_link = URL("https://api.anonfiles.com/v2/file")- async def fetch(self, session: ScrapeSession, url: URL):+ async def fetch(self, session: ScrapeSession, url: URL) -> AlbumItem:"""Scraper for Anonfiles"""if 'cdn' in url.host:url = URL("https://anonfiles.com") / url.parts[1]diff --git a/cyberdrop_dl/crawlers/Bunkr_Spider.py b/cyberdrop_dl/crawlers/Bunkr_Spider.pyindex 222eeb417..0d369d388 100644--- a/cyberdrop_dl/crawlers/Bunkr_Spider.py+++ b/cyberdrop_dl/crawlers/Bunkr_Spider.py@@ -16,7 +16,7 @@ class BunkrCrawler:self.SQL_Helper = SQL_Helperself.remove_bunkr_id = remove_bunkr_id- async def fetch(self, session: ScrapeSession, url: URL):+ async def fetch(self, session: ScrapeSession, url: URL) -> AlbumItem:"""Scraper for Bunkr"""album_obj = AlbumItem("Loose Bunkr Files", [])await log(f"Starting: {str(url)}", quiet=self.quiet, style="green")diff --git a/cyberdrop_dl/crawlers/CyberFile_Spider.py b/cyberdrop_dl/crawlers/CyberFile_Spider.pyindex 2d99dbcc3..db8068667 100644--- a/cyberdrop_dl/crawlers/CyberFile_Spider.py+++ b/cyberdrop_dl/crawlers/CyberFile_Spider.py@@ -15,7 +15,7 @@ class CyberFileCrawler:self.load_files = URL('https://cyberfile.me/account/ajax/load_files')self.file_details = URL('https://cyberfile.me/account/ajax/file_details')- async def fetch(self, session: ScrapeSession, url: URL):+ async def fetch(self, session: ScrapeSession, url: URL) -> DomainItem:"""Director for cyberfile scraping"""await log(f"Starting: {str(url)}", quiet=self.quiet, style="green")domain_obj = DomainItem("cyberfile", {})diff --git a/cyberdrop_dl/crawlers/Cyberdrop_Spider.py b/cyberdrop_dl/crawlers/Cyberdrop_Spider.pyindex a26514ea6..477a50264 100644--- a/cyberdrop_dl/crawlers/Cyberdrop_Spider.py+++ b/cyberdrop_dl/crawlers/Cyberdrop_Spider.py@@ -14,7 +14,7 @@ class CyberdropCrawler:self.SQL_Helper = SQL_Helperself.quiet = quiet- async def fetch(self, session: ScrapeSession, url: URL):+ async def fetch(self, session: ScrapeSession, url: URL) -> AlbumItem:"""Cyberdrop scraper"""album_obj = AlbumItem("Loose Cyberdrop Files", [])diff --git a/cyberdrop_dl/crawlers/EHentai_Spider.py b/cyberdrop_dl/crawlers/EHentai_Spider.pyindex 96aaa3222..94c20b5ad 100644--- a/cyberdrop_dl/crawlers/EHentai_Spider.py+++ b/cyberdrop_dl/crawlers/EHentai_Spider.py@@ -11,7 +11,7 @@ class EHentaiCrawler:self.quiet = quietself.SQL_Helper = SQL_Helper- async def fetch(self, session: ScrapeSession, url: URL):+ async def fetch(self, session: ScrapeSession, url: URL) -> AlbumItem:"""Director for E-Hentai"""album_obj = AlbumItem("Loose EHentai Files", [])diff --git a/cyberdrop_dl/crawlers/Erome_Spider.py b/cyberdrop_dl/crawlers/Erome_Spider.pyindex 84ed8dbaa..fbaa8fe59 100644--- a/cyberdrop_dl/crawlers/Erome_Spider.py+++ b/cyberdrop_dl/crawlers/Erome_Spider.py@@ -13,7 +13,7 @@ class EromeCrawler:self.quiet = quietself.SQL_Helper = SQL_Helper- async def fetch(self, session: ScrapeSession, url: URL):+ async def fetch(self, session: ScrapeSession, url: URL) -> DomainItem:"""Director function for Erome scraping"""await log(f"Starting: {str(url)}", quiet=self.quiet, style="green")@@ -26,10 +26,10 @@ class EromeCrawler:return domain_obj- async def handle_album(self, session: ScrapeSession, url: URL):+ async def handle_album(self, session: ScrapeSession, url: URL) -> DomainItem:"""Handler function for erome albums, adds media items to the domain item"""+ domain_obj = DomainItem("erome", {})try:- domain_obj = DomainItem("erome", {})soup = await session.get_BS4(url)title = soup.select_one('div[class="col-sm-12 page-content"] h1').get_text()if title is None:@@ -66,18 +66,17 @@ class EromeCrawler:url_path = await get_db_path(url)await self.SQL_Helper.insert_domain("erome", url_path, domain_obj)- return domain_obj-except Exception as e:logger.debug("Error encountered while handling %s", str(url), exc_info=True)await log(f"Error: {str(url)}", quiet=self.quiet, style="red")logger.debug(e)- return domain_obj- async def handle_profile(self, session: ScrapeSession, url: URL):+ return domain_obj++ async def handle_profile(self, session: ScrapeSession, url: URL) -> DomainItem:"""Handler for erome profiles, sends albums to handle_album"""+ domain_obj = DomainItem("erome", {})try:- domain_obj = DomainItem("erome", {})soup = await session.get_BS4(url)title = soup.select_one('h1[class="username"]').get_text()if title is None:@@ -90,10 +89,9 @@ class EromeCrawler:url = URL(album.get('href'))await domain_obj.extend(await self.handle_album(session, url))await domain_obj.append_title(title)- return domain_obj-except Exception as e:logger.debug("Error encountered while handling %s", str(url), exc_info=True)await log(f"Error: {str(url)}", quiet=self.quiet, style="red")logger.debug(e)- return domain_obj++ return domain_objdiff --git a/cyberdrop_dl/crawlers/Fapello_Spider.py b/cyberdrop_dl/crawlers/Fapello_Spider.pyindex 1730b8875..f880daf85 100644--- a/cyberdrop_dl/crawlers/Fapello_Spider.py+++ b/cyberdrop_dl/crawlers/Fapello_Spider.py@@ -1,3 +1,5 @@+from typing import Optional+from yarl import URLfrom ..base_functions.base_functions import log, logger, make_title_safe, get_filename_and_ext, get_db_path@@ -12,18 +14,16 @@ class FapelloCrawler:self.quiet = quietself.SQL_Helper = SQL_Helper- async def fetch(self, session: ScrapeSession, url: URL):+ async def fetch(self, session: ScrapeSession, url: URL) -> Optional[AlbumItem]:"""Basic director for fapello"""await log(f"Starting: {str(url)}", quiet=self.quiet, style="green")album_obj = await self.parse_profile(session, url)await log(f"Finished: {str(url)}", quiet=self.quiet, style="green")- if not album_obj:- return Nonereturn album_obj- async def parse_profile(self, session: ScrapeSession, url: URL):+ async def parse_profile(self, session: ScrapeSession, url: URL) -> Optional[AlbumItem]:"""Profile parser, passes posts to parse_post"""try:soup, returned_url = await session.get_BS4_and_url(url)@@ -58,7 +58,7 @@ class FapelloCrawler:logger.debug("Error encountered while handling %s", str(url), exc_info=True)await log(f"Error: {str(url)}", quiet=self.quiet, style="red")logger.debug(e)- return+ return Noneasync def parse_post(self, session: ScrapeSession, url: URL):"""Parses posts, returns list of media_items"""diff --git a/cyberdrop_dl/crawlers/Gfycat_Spider.py b/cyberdrop_dl/crawlers/Gfycat_Spider.pyindex c666ed774..15a7e802b 100644--- a/cyberdrop_dl/crawlers/Gfycat_Spider.py+++ b/cyberdrop_dl/crawlers/Gfycat_Spider.py@@ -11,10 +11,10 @@ class GfycatCrawler:self.quiet = quietself.SQL_Helper = SQL_Helper- async def fetch(self, session: ScrapeSession, url: URL):+ async def fetch(self, session: ScrapeSession, url: URL) -> AlbumItem:"""Basic scraper for gfycat"""+ album_obj = AlbumItem("Gfycat", [])try:- album_obj = AlbumItem("Gfycat", [])await log(f"Starting: {str(url)}", quiet=self.quiet, style="green")soup = await session.get_BS4(url)@@ -37,10 +37,9 @@ class GfycatCrawler:await album_obj.add_media(media_item)await self.SQL_Helper.insert_album("gfycat", url_path, album_obj)await log(f"Finished: {str(url)}", quiet=self.quiet, style="green")- return album_obj-except Exception as e:logger.debug("Error encountered while handling %s", str(url), exc_info=True)await log(f"Error: {str(url)}", quiet=self.quiet, style="red")logger.debug(e)- return album_obj++ return album_objdiff --git a/cyberdrop_dl/crawlers/GoFile_Spider.py b/cyberdrop_dl/crawlers/GoFile_Spider.pyindex b6251bedc..f97d48018 100644--- a/cyberdrop_dl/crawlers/GoFile_Spider.py+++ b/cyberdrop_dl/crawlers/GoFile_Spider.py@@ -43,11 +43,11 @@ class GoFileCrawler:morsel.set('accountToken', client_token, client_token)session.client_session.cookie_jar.update_cookies({'gofile.io': morsel})- async def fetch(self, session: ScrapeSession, url: URL):+ async def fetch(self, session: ScrapeSession, url: URL) -> DomainItem:"""Basic director for actual scraping"""+ domain_obj = DomainItem("gofile", {})try:await log(f"Starting: {str(url)}", quiet=self.quiet, style="green")- domain_obj = DomainItem("gofile", {})content_id = url.nameresults = await self.get_links(session, url, content_id, None)for title, media_item in results:@@ -56,13 +56,13 @@ class GoFileCrawler:url_path = await get_db_path(url)await self.SQL_Helper.insert_domain("gofile", url_path, domain_obj)await log(f"Finished: {str(url)}", quiet=self.quiet, style="green")- return domain_obj-except Exception as e:logger.debug("Error encountered while handling %s", str(url), exc_info=True)await log(f"Error: {str(url)}", quiet=self.quiet, style="red")logger.debug(e)+ return domain_obj+async def get_links(self, session: ScrapeSession, url: URL, content_id: str, title=None):"""Gets links from the given url, creates media_items"""results = []diff --git a/cyberdrop_dl/crawlers/HGameCG_Spider.py b/cyberdrop_dl/crawlers/HGameCG_Spider.pyindex 3dc4fa0d2..f5ca219f2 100644--- a/cyberdrop_dl/crawlers/HGameCG_Spider.py+++ b/cyberdrop_dl/crawlers/HGameCG_Spider.py@@ -11,7 +11,7 @@ class HGameCGCrawler:self.quiet = quietself.SQL_Helper = SQL_Helper- async def fetch(self, session: ScrapeSession, url: URL):+ async def fetch(self, session: ScrapeSession, url: URL) -> AlbumItem:"""Basic director for HGameCG"""album_obj = AlbumItem("Loose HGamesCG Files", [])diff --git a/cyberdrop_dl/crawlers/ImgBox_Spider.py b/cyberdrop_dl/crawlers/ImgBox_Spider.pyindex 7549624e1..764f75606 100644--- a/cyberdrop_dl/crawlers/ImgBox_Spider.py+++ b/cyberdrop_dl/crawlers/ImgBox_Spider.py@@ -13,7 +13,7 @@ class ImgBoxCrawler:self.quiet = quietself.SQL_Helper = SQL_Helper- async def fetch(self, session: ScrapeSession, url: URL):+ async def fetch(self, session: ScrapeSession, url: URL) -> AlbumItem:"""Director func for ImgBox scraping"""album_obj = AlbumItem("Loose ImgBox Files", [])await log(f"Starting: {str(url)}", quiet=self.quiet, style="green")diff --git a/cyberdrop_dl/crawlers/LoveFap_Spider.py b/cyberdrop_dl/crawlers/LoveFap_Spider.pyindex c2ec1057e..b83211d82 100644--- a/cyberdrop_dl/crawlers/LoveFap_Spider.py+++ b/cyberdrop_dl/crawlers/LoveFap_Spider.py@@ -13,7 +13,7 @@ class LoveFapCrawler:self.SQL_Helper = SQL_Helperself.quiet = quiet- async def fetch(self, session: ScrapeSession, url: URL):+ async def fetch(self, session: ScrapeSession, url: URL) -> AlbumItem:"""Director for lovefap scraping"""album_obj = AlbumItem("Loose LoveFap Files", [])diff --git a/cyberdrop_dl/crawlers/NSFWXXXCrawler.py b/cyberdrop_dl/crawlers/NSFWXXXCrawler.pyindex d15a1aba3..8d349e35b 100644--- a/cyberdrop_dl/crawlers/NSFWXXXCrawler.py+++ b/cyberdrop_dl/crawlers/NSFWXXXCrawler.py@@ -14,7 +14,7 @@ class NSFWXXXCrawler:self.separate_posts = separate_postsself.SQL_Helper = SQL_Helper- async def fetch(self, session: ScrapeSession, url: URL):+ async def fetch(self, session: ScrapeSession, url: URL) -> DomainItem:"""Director for NSFW.XXX scraping"""domain_obj = DomainItem("nsfw.xxx", {})diff --git a/cyberdrop_dl/crawlers/PimpAndHost_Spider.py b/cyberdrop_dl/crawlers/PimpAndHost_Spider.pyindex 5be332e5a..d5a72635b 100644--- a/cyberdrop_dl/crawlers/PimpAndHost_Spider.py+++ b/cyberdrop_dl/crawlers/PimpAndHost_Spider.py@@ -11,7 +11,7 @@ class PimpAndHostCrawler:self.quiet = quietself.SQL_Helper = SQL_Helper- async def fetch(self, session: ScrapeSession, url: URL):+ async def fetch(self, session: ScrapeSession, url: URL) -> AlbumItem:"""Director for pimpandhost scraping"""await log(f"Starting: {str(url)}", quiet=self.quiet, style="green")album_obj = AlbumItem("Loose Pixeldrain Files", [])diff --git a/cyberdrop_dl/crawlers/PixelDrain_Spider.py b/cyberdrop_dl/crawlers/PixelDrain_Spider.pyindex 59debbf9c..b9e8ce12a 100644--- a/cyberdrop_dl/crawlers/PixelDrain_Spider.py+++ b/cyberdrop_dl/crawlers/PixelDrain_Spider.py@@ -13,7 +13,7 @@ class PixelDrainCrawler:self.SQL_Helper = SQL_Helperself.api = URL('https://pixeldrain.com/api/')- async def fetch(self, session: ScrapeSession, url: URL):+ async def fetch(self, session: ScrapeSession, url: URL) -> AlbumItem:"""Director for pixeldrain scraping"""await log(f"Starting: {str(url)}", quiet=self.quiet, style="green")album_obj = AlbumItem("Loose Pixeldrain Files", [])diff --git a/cyberdrop_dl/crawlers/PostImg_Spider.py b/cyberdrop_dl/crawlers/PostImg_Spider.pyindex b371f1ead..7be8ca2d2 100644--- a/cyberdrop_dl/crawlers/PostImg_Spider.py+++ b/cyberdrop_dl/crawlers/PostImg_Spider.py@@ -14,7 +14,7 @@ class PostImgCrawler:self.quiet = quietself.SQL_Helper = SQL_Helper- async def fetch(self, session: ScrapeSession, url: URL):+ async def fetch(self, session: ScrapeSession, url: URL) -> AlbumItem:"""Director for PostImg scraping"""album_obj = AlbumItem("Loose PostImg Files", [])await log(f"Starting: {str(url)}", quiet=self.quiet, style="green")diff --git a/cyberdrop_dl/crawlers/Saint_Spider.py b/cyberdrop_dl/crawlers/Saint_Spider.pyindex 3125c8ba7..942a7fdd6 100644--- a/cyberdrop_dl/crawlers/Saint_Spider.py+++ b/cyberdrop_dl/crawlers/Saint_Spider.py@@ -11,7 +11,7 @@ class SaintCrawler:self.quiet = quietself.SQL_Helper = SQL_Helper- async def fetch(self, session: ScrapeSession, url: URL):+ async def fetch(self, session: ScrapeSession, url: URL) -> AlbumItem:"""Basic director for saint scraping"""album_obj = AlbumItem("Loose Saint Files", [])await log(f"Starting: {str(url)}", quiet=self.quiet, style="green")diff --git a/cyberdrop_dl/crawlers/ShareX_Spider.py b/cyberdrop_dl/crawlers/ShareX_Spider.pyindex 43861bf8e..38227a56c 100644--- a/cyberdrop_dl/crawlers/ShareX_Spider.py+++ b/cyberdrop_dl/crawlers/ShareX_Spider.py@@ -17,7 +17,7 @@ class ShareXCrawler:self.quiet = quietself.SQL_Helper = SQL_Helper- async def fetch(self, session: ScrapeSession, url: URL):+ async def fetch(self, session: ScrapeSession, url: URL) -> DomainItem:"""Director for ShareX scraper"""domain_obj = DomainItem(url.host.lower(), {})diff --git a/cyberdrop_dl/crawlers/XBunkr_Spider.py b/cyberdrop_dl/crawlers/XBunkr_Spider.pyindex 13309e5b4..8b7e68081 100644--- a/cyberdrop_dl/crawlers/XBunkr_Spider.py+++ b/cyberdrop_dl/crawlers/XBunkr_Spider.py@@ -12,7 +12,7 @@ class XBunkrCrawler:self.quiet = quietself.SQL_Helper = SQL_Helper- async def fetch(self, session: ScrapeSession, url: URL):+ async def fetch(self, session: ScrapeSession, url: URL) -> AlbumItem:"""Director for XBunkr scraping"""album_obj = AlbumItem("Loose XBunkr Files", [])diff --git a/cyberdrop_dl/scraper/Scraper.py b/cyberdrop_dl/scraper/Scraper.pyindex 8dacdb284..ef5f687b2 100644--- a/cyberdrop_dl/scraper/Scraper.py+++ b/cyberdrop_dl/scraper/Scraper.py@@ -1,5 +1,5 @@import asyncio-from typing import Dict, Optional+from typing import Dictimport aiofilesfrom yarl import URL@@ -100,21 +100,21 @@ class ScrapeMapper:"coomer.party": self.Coomeno, "kemono.party": self.Coomeno,"simpcity": self.Xenforo, "socialmediagirls": self.Xenforo, "xbunker": self.Xenforo}- async def handle_additions(self, domain: str, album_obj: Optional[AlbumItem], domain_obj: Optional[DomainItem], title=None):- if album_obj:- if title:- await album_obj.append_title(title)- await self.Forums.add_album_to_thread(title, domain, album_obj)- else:- await self.Cascade.add_album(domain, album_obj.title, album_obj)- if domain_obj:- if title:- await domain_obj.append_title(title)- for album_title, album in domain_obj.albums.items():- await self.Forums.add_album_to_thread(title, domain, album)- else:- for title, album in domain_obj.albums.items():- await self.Cascade.add_album(domain, album.title, album)+ async def _handle_album_additions(self, domain: str, album_obj: AlbumItem, title=None) -> None:+ if title:+ await album_obj.append_title(title)+ await self.Forums.add_album_to_thread(title, domain, album_obj)+ else:+ await self.Cascade.add_album(domain, album_obj.title, album_obj)++ async def _handle_domain_additions(self, domain: str, domain_obj: DomainItem, title=None) -> None:+ if title:+ await domain_obj.append_title(title)+ for album in domain_obj.albums.values():+ await self.Forums.add_album_to_thread(title, domain, album)+ else:+ for album in domain_obj.albums.values():+ await self.Cascade.add_album(domain, album.title, album)"""Redirection handler for Simp City"""@@ -129,7 +129,7 @@ class ScrapeMapper:if not self.anonfiles_crawler:self.anonfiles_crawler = AnonfilesCrawler(quiet=self.quiet, SQL_Helper=self.SQL_Helper)album_obj = await self.anonfiles_crawler.fetch(anonfiles_session, url)- await self.handle_additions("anonfiles", album_obj, None, title)+ await self._handle_album_additions("anonfiles", album_obj, title)await anonfiles_session.exit_handler()async def Bunkr(self, url: URL, title=None):@@ -140,7 +140,7 @@ class ScrapeMapper:async with self.bunkr_limiter:album_obj = await self.bunkr_crawler.fetch(bunkr_session, url)if not await album_obj.is_empty():- await self.handle_additions("bunkr", album_obj, None, title)+ await self._handle_album_additions("bunkr", album_obj, title)await bunkr_session.exit_handler()async def Cyberdrop(self, url: URL, title=None):@@ -148,7 +148,7 @@ class ScrapeMapper:if not self.cyberdrop_crawler:self.cyberdrop_crawler = CyberdropCrawler(include_id=self.include_id, quiet=self.quiet, SQL_Helper=self.SQL_Helper)album_obj = await self.cyberdrop_crawler.fetch(cyberdrop_session, url)- await self.handle_additions("cyberdrop", album_obj, None, title)+ await self._handle_album_additions("cyberdrop", album_obj, title)await cyberdrop_session.exit_handler()async def CyberFile(self, url, title=None):@@ -157,7 +157,7 @@ class ScrapeMapper:self.cyberfile_crawler = CyberFileCrawler(quiet=self.quiet, SQL_Helper=self.SQL_Helper)async with self.cyberfile_semaphore:domain_obj = await self.cyberfile_crawler.fetch(cyberfile_session, url)- await self.handle_additions("cyberfile", None, domain_obj, title)+ await self._handle_domain_additions("cyberfile", domain_obj, title)await cyberfile_session.exit_handler()async def EHentai(self, url, title=None):@@ -165,7 +165,7 @@ class ScrapeMapper:if not self.ehentai_crawler:self.ehentai_crawler = EHentaiCrawler(quiet=self.quiet, SQL_Helper=self.SQL_Helper)album_obj = await self.ehentai_crawler.fetch(ehentai_session, url)- await self.handle_additions("e-hentai", album_obj, None, title)+ await self._handle_album_additions("e-hentai", album_obj, title)await ehentai_session.exit_handler()async def Erome(self, url, title=None):@@ -173,7 +173,7 @@ class ScrapeMapper:if not self.erome_crawler:self.erome_crawler = EromeCrawler(include_id=self.include_id, quiet=self.quiet, SQL_Helper=self.SQL_Helper)domain_obj = await self.erome_crawler.fetch(erome_session, url)- await self.handle_additions("erome", None, domain_obj, title)+ await self._handle_domain_additions("erome", domain_obj, title)await erome_session.exit_handler()async def Gfycat(self, url, title=None):@@ -181,7 +181,7 @@ class ScrapeMapper:if not self.gfycat_crawler:self.gfycat_crawler = GfycatCrawler(quiet=self.quiet, SQL_Helper=self.SQL_Helper)album_obj = await self.gfycat_crawler.fetch(gfycat_session, url)- await self.handle_additions("gfycat", album_obj, None, title)+ await self._handle_album_additions("gfycat", album_obj, title)await gfycat_session.exit_handler()async def GoFile(self, url, title=None):@@ -192,7 +192,7 @@ class ScrapeMapper:await self.gofile_crawler.get_token(session=gofile_session)async with self.gofile_limiter:domain_obj = await self.gofile_crawler.fetch(gofile_session, url)- await self.handle_additions("gofile", None, domain_obj, title)+ await self._handle_domain_additions("gofile", domain_obj, title)await gofile_session.exit_handler()async def HGameCG(self, url, title=None):@@ -200,7 +200,7 @@ class ScrapeMapper:if not self.hgamecg_crawler:self.hgamecg_crawler = HGameCGCrawler(quiet=self.quiet, SQL_Helper=self.SQL_Helper)album_obj = await self.hgamecg_crawler.fetch(hgamecg_session, url)- await self.handle_additions("hgamecg", album_obj, None, title)+ await self._handle_album_additions("hgamecg", album_obj, title)await hgamecg_session.exit_handler()async def ImgBox(self, url, title=None):@@ -208,7 +208,7 @@ class ScrapeMapper:if not self.imgbox_crawler:self.imgbox_crawler = ImgBoxCrawler(quiet=self.quiet, SQL_Helper=self.SQL_Helper)album_obj = await self.imgbox_crawler.fetch(imgbox_session, url)- await self.handle_additions("imgbox", album_obj, None, title)+ await self._handle_album_additions("imgbox", album_obj, title)await imgbox_session.exit_handler()async def LoveFap(self, url: URL, title=None):@@ -216,7 +216,7 @@ class ScrapeMapper:if not self.lovefap_crawler:self.lovefap_crawler = LoveFapCrawler(quiet=self.quiet, SQL_Helper=self.SQL_Helper)album_obj = await self.lovefap_crawler.fetch(lovefap_session, url)- await self.handle_additions("lovefap", album_obj, None, title)+ await self._handle_album_additions("lovefap", album_obj, title)await lovefap_session.exit_handler()async def PimpAndHost(self, url, title=None):@@ -224,7 +224,7 @@ class ScrapeMapper:if not self.pimpandhost_crawler:self.pimpandhost_crawler = PimpAndHostCrawler(quiet=self.quiet, SQL_Helper=self.SQL_Helper)album_obj = await self.pimpandhost_crawler.fetch(pimpandhost_session, url)- await self.handle_additions("pimpandhost", album_obj, None, title)+ await self._handle_album_additions("pimpandhost", album_obj, title)await pimpandhost_session.exit_handler()async def PixelDrain(self, url, title=None):@@ -232,7 +232,7 @@ class ScrapeMapper:if not self.pixeldrain_crawler:self.pixeldrain_crawler = PixelDrainCrawler(quiet=self.quiet, SQL_Helper=self.SQL_Helper)album_obj = await self.pixeldrain_crawler.fetch(pixeldrain_session, url)- await self.handle_additions("pixeldrain", album_obj, None, title)+ await self._handle_album_additions("pixeldrain", album_obj, title)await pixeldrain_session.exit_handler()async def PostImg(self, url, title=None):@@ -240,7 +240,7 @@ class ScrapeMapper:if not self.postimg_crawler:self.postimg_crawler = PostImgCrawler(quiet=self.quiet, SQL_Helper=self.SQL_Helper)album_obj = await self.postimg_crawler.fetch(postimg_session, url)- await self.handle_additions("postimg", album_obj, None, title)+ await self._handle_album_additions("postimg", album_obj, title)await postimg_session.exit_handler()async def Saint(self, url, title=None):@@ -248,7 +248,7 @@ class ScrapeMapper:if not self.saint_crawler:self.saint_crawler = SaintCrawler(quiet=self.quiet, SQL_Helper=self.SQL_Helper)album_obj = await self.saint_crawler.fetch(saint_session, url)- await self.handle_additions("saint", album_obj, None, title)+ await self._handle_album_additions("saint", album_obj, title)await saint_session.exit_handler()async def ShareX(self, url, title=None):@@ -261,7 +261,7 @@ class ScrapeMapper:domain_obj = await self.sharex_crawler.fetch(sharex_session, url)else:domain_obj = await self.sharex_crawler.fetch(sharex_session, url)- await self.handle_additions("sharex", None, domain_obj, title)+ await self._handle_domain_additions("sharex", domain_obj, title)await sharex_session.exit_handler()async def XBunkr(self, url, title=None):@@ -269,7 +269,7 @@ class ScrapeMapper:if not self.xbunkr_crawler:self.xbunkr_crawler = XBunkrCrawler(quiet=self.quiet, SQL_Helper=self.SQL_Helper)album_obj = await self.xbunkr_crawler.fetch(xbunkr_session, url)- await self.handle_additions("xbunkr", album_obj, None, title)+ await self._handle_album_additions("xbunkr", album_obj, title)await xbunkr_session.exit_handler()"""Archive Sites"""@@ -279,7 +279,8 @@ class ScrapeMapper:if not self.fapello_crawler:self.fapello_crawler = FapelloCrawler(quiet=self.quiet, SQL_Helper=self.SQL_Helper)album_obj = await self.fapello_crawler.fetch(fapello_session, url)- await self.handle_additions("fapello", album_obj, None, title)+ if album_obj:+ await self._handle_album_additions("fapello", album_obj, title)await fapello_session.exit_handler()async def NSFW_XXX(self, url, title=None):@@ -287,7 +288,7 @@ class ScrapeMapper:if not self.nsfwxxx_crawler:self.nsfwxxx_crawler = NSFWXXXCrawler(separate_posts=self.separate_posts, quiet=self.quiet, SQL_Helper=self.SQL_Helper)domain_obj = await self.nsfwxxx_crawler.fetch(nsfwxxx_session, url)- await self.handle_additions("nsfw.xxx", None, domain_obj, title)+ await self._handle_domain_additions("nsfw.xxx", domain_obj, title)await nsfwxxx_session.exit_handler()async def Coomeno(self, url: URL, title=None):@@ -338,21 +339,23 @@ class ScrapeMapper:async def map_url(self, url_to_map: URL, title=None, referer=None):if not url_to_map:return- elif not url_to_map.host:+ if not url_to_map.host:await log(f"Not Supported: {str(url_to_map)}", quiet=self.quiet, style="yellow")return- for key, value in self.mapping.items():- if key in url_to_map.host:- if self.only_data.sites:- if any(site in key for site in self.only_data.sites):- await value(url=url_to_map, title=title)- else:- await log(f"Skipping: {str(url_to_map)}", quiet=self.quiet, style="yellow")- elif any(site in key for site in self.skip_data.sites):- await log(f"Skipping: {str(url_to_map)}", quiet=self.quiet, style="yellow")++ key = next((key for key in self.mapping if key in url_to_map.host), None)+ if key:+ handler = self.mapping[key]+ if self.only_data.sites:+ if any(site in key for site in self.only_data.sites):+ await handler(url=url_to_map, title=title)else:- await value(url=url_to_map, title=title)- return+ await log(f"Skipping: {str(url_to_map)}", quiet=self.quiet, style="yellow")+ elif any(site in key for site in self.skip_data.sites):+ await log(f"Skipping: {str(url_to_map)}", quiet=self.quiet, style="yellow")+ else:+ await handler(url=url_to_map, title=title)+ returnif self.jdownloader.jdownloader_enable:async with asyncio.Semaphore(1):