Skip to content

Bulk asynchronous downloader for multiple file hosts

Implement nudostar, expand ParseSpec to encompass entire element and attribute set for further possible expansion of supported forums.

Jules-WinnfieldXa7b42a4b0821
diff --git a/cyberdrop_dl/base_functions/config_schema.py b/cyberdrop_dl/base_functions/config_schema.py
index dc9ae98f2..42098a308 100644
--- a/cyberdrop_dl/base_functions/config_schema.py
+++ b/cyberdrop_dl/base_functions/config_schema.py
@@ -4,6 +4,8 @@ config_default = {
"Authentication": {
"gofile_api_key": "",
"pixeldrain_api_key": "",
+ "nudostar_username": "",
+ "nudostar_password": "",
"simpcity_username": "",
"simpcity_password": "",
"socialmediagirls_username": "",
diff --git a/cyberdrop_dl/base_functions/data_classes.py b/cyberdrop_dl/base_functions/data_classes.py
index a92c1c078..9a36104fc 100644
--- a/cyberdrop_dl/base_functions/data_classes.py
+++ b/cyberdrop_dl/base_functions/data_classes.py
@@ -239,5 +239,5 @@ class SkipData:
"hgamecg", "img.kiwi", "imgbox", "jpg.church", "jpg.fish",
"gallery.deltaporno.com", "kemono.party",
"lovefap", "nsfw.xxx", "pimpandhost", "pixeldrain", "pixl.li", "postimg",
- "saint", "simpcity", "socialmediagirls", "xbunker", "xbunkr")
+ "saint", "nudostar", "simpcity", "socialmediagirls", "xbunker", "xbunkr")
sites: List[str]
diff --git a/cyberdrop_dl/crawlers/Xenforo_Spider.py b/cyberdrop_dl/crawlers/Xenforo_Spider.py
index a5e577661..e3038326d 100644
--- a/cyberdrop_dl/crawlers/Xenforo_Spider.py
+++ b/cyberdrop_dl/crawlers/Xenforo_Spider.py
@@ -35,13 +35,49 @@ async def write_last_post_file(file: Path, url: str):
class ParseSpec:
"""Class for specific selectors of supported domains"""
domain: str
- title_clutter_tag: str = field(init=False)
+ title_block_element: str = "h1[class=p-title-value]"
+ title_clutter_element: str = field(init=False)
+
+ posts_block_element: str = field(init=False)
+ posts_number_element: str = field(init=False)
+ posts_number_attribute: str = "href"
+
+ post_content_element: str = "div[class=bbWrapper]"
+ block_quote_element: str = "blockquote"
+
+ links_element: str = "a"
+ links_attribute: str = "href"
+
+ images_element: str = "div[class*='bbImage']"
+ images_attribute: str = field(init=False)
+
+ video_element: str = "video source"
+ video_attribute: str = "src"
+ saint_iframe_element: str = "iframe[class=saint-iframe]"
+ saint_iframe_attribute: str = "src"
+
+ embedded_content_element: str = "span[data-s9e-mediaembed-iframe]"
+ embedded_content_attribute: str = "data-s9e-mediaembed-iframe"
+
+ attachment_block_element: str = "section[class=message-attachments]"
+ attachment_element: str = "a"
+ attachment_attribute: str = "href"
+
+ next_page_element: str = 'a[class="pageNav-jump pageNav-jump--next"]'
+ next_page_attribute: str = "href"
def __post_init__(self):
- if self.domain in ("simpcity", "xbunker"):
- self.title_clutter_tag = "a"
- elif self.domain == "socialmediagirls":
- self.title_clutter_tag = "span"
+ if self.domain in ("simpcity", "xbunker", "socialmediagirls"):
+ self.title_clutter_element = "a" if self.domain in ("simpcity", "xbunker") else "span"
+ self.posts_block_element = 'div[class="message-main uix_messageContent js-quickEditTarget"]'
+ self.posts_number_element = "li[class=u-concealed] a"
+ self.images_attribute = "data-src"
+
+ elif self.domain == "nudostar":
+ self.title_clutter_element = "span"
+ self.posts_block_element = 'div[class*="message-userContent lbContainer js-lbContainer"]'
+ self.posts_number_element = "a[id*=js-XFUniqueId]"
+ self.images_attribute = "src"
class ForumLogin:
@@ -64,7 +100,9 @@ class ForumLogin:
if attempt == 5:
raise FailedLoginFailure()
- domain = URL("https://" + url.host) / "login"
+ domain = URL("https://" + url.host) / "forum/login" if "nudostar" in url.host else \
+ URL("https://" + url.host) / "login"
+
text = await session.get_text(domain)
await asyncio.sleep(5)
soup = BeautifulSoup(text, 'html.parser')
@@ -93,7 +131,7 @@ class ForumLogin:
class XenforoCrawler:
- domains = ("simpcity", "socialmediagirls", "xbunker")
+ domains = ("nudostar", "simpcity", "socialmediagirls", "xbunker")
def __init__(self, *, scraping_mapper, args: dict, SQL_Helper: SQLHelper, quiet: bool):
self.include_id = args["Runtime"]["include_id"]
@@ -102,6 +140,10 @@ class XenforoCrawler:
self.output_last = args["Forum_Options"]["output_last_forum_post"]
self.output_last_file = args["Files"]["output_last_forum_post_file"]
+ self.nudostar = ForumLogin("NudoStar",
+ args["Authentication"]["nudostar_username"],
+ args["Authentication"]["nudostar_password"])
+
self.simpcity = ForumLogin("SimpCity",
args["Authentication"]["simpcity_username"],
args["Authentication"]["simpcity_password"])
@@ -131,6 +173,8 @@ class XenforoCrawler:
await self.socialmediagirls.login(session, url, self.quiet)
elif "xbunker" in url.host:
await self.xbunker.login(session, url, self.quiet)
+ elif "nudostar" in url.host:
+ await self.nudostar.login(session, url, self.quiet)
domain = next((domain for domain in self.domains if domain in url.host), None)
if domain:
@@ -171,7 +215,7 @@ class XenforoCrawler:
found_links.append([URL(link), temp_title])
return found_links
- async def get_embedded(self, post_content, selector, attribute, domain, temp_title):
+ async def get_embedded(self, post_content, selector, attribute, temp_title):
"""Gets embedded media from post content based on selector and attribute provided"""
found_links = []
links = post_content.select(selector)
@@ -237,8 +281,8 @@ class XenforoCrawler:
post_num_str = None
content_links = []
- title_block = soup.select_one("h1[class=p-title-value]")
- for elem in title_block.find_all(spec.title_clutter_tag):
+ title_block = soup.select_one(spec.title_block_element)
+ for elem in title_block.find_all(spec.title_clutter_element):
elem.decompose()
if title:
@@ -247,46 +291,50 @@ class XenforoCrawler:
title = title_block.text
title = await make_title_safe(title.replace("\n", "").strip())
- posts = soup.select("div[class='message-main uix_messageContent js-quickEditTarget']")
+ posts = soup.select(spec.posts_block_element)
for post in posts:
- post_num_str = post.select_one("li[class=u-concealed] a").get('href').split('/')[-1]
+ post_num_str = post.select_one(spec.posts_number_element).get(spec.posts_number_attribute).split('/')[-1]
post_num_int = int(post_num_str.split('post-')[-1])
if post_number > post_num_int:
continue
temp_title = title + "/" + post_num_str if self.separate_posts else title
- for elem in post.find_all('blockquote'):
+ for elem in post.find_all(spec.block_quote_element):
elem.decompose()
- post_content = post.select_one("div[class=bbWrapper]")
+ post_content = post.select_one(spec.post_content_element)
# Get Links
- content_links.extend(await self.get_links(post_content, "a", "href", domain, temp_title))
+ content_links.extend(await self.get_links(post_content, spec.links_element, spec.links_attribute, domain,
+ temp_title))
# Get Images
- content_links.extend(await self.get_links(post_content, "div[class='bbImageWrapper js-lbImage']", "data-src", domain, temp_title))
- content_links.extend(await self.get_links(post_content, "div[class='bbImageWrapper lazyload js-lbImage']", "data-src", domain, temp_title))
+ content_links.extend(await self.get_links(post_content, spec.images_element, spec.images_attribute, domain,
+ temp_title))
# Get Videos:
- content_links.extend(await self.get_links(post_content, "video source", "src", domain, temp_title))
- content_links.extend(await self.get_links(post_content, "iframe[class=saint-iframe]", "src", domain, temp_title))
+ content_links.extend(await self.get_links(post_content, spec.video_element, spec.video_attribute, domain,
+ temp_title))
+ content_links.extend(await self.get_links(post_content, spec.saint_iframe_element,
+ spec.saint_iframe_attribute, domain, temp_title))
# Get Other Embedded Content
- content_links.extend(await self.get_embedded(post_content, "span[data-s9e-mediaembed-iframe]", "data-s9e-mediaembed-iframe",
- domain, temp_title))
+ content_links.extend(await self.get_embedded(post_content, spec.embedded_content_element,
+ spec.embedded_content_attribute, temp_title))
# Get Attachments
- attachments_block = post.select_one("section[class=message-attachments]")
- content_links.extend(await self.get_links(attachments_block, "a[class='file-preview js-lbImage']", "href", domain, temp_title))
+ attachments_block = post.select_one(spec.attachment_block_element)
+ content_links.extend(await self.get_links(attachments_block, spec.attachment_element,
+ spec.attachment_attribute, domain, temp_title))
# Handle links
content_links = await self.filter_content_links(cascade, content_links, url, spec.domain)
await self.handle_external_links(content_links, url)
- next_page = soup.select_one('a[class="pageNav-jump pageNav-jump--next"]')
+ next_page = soup.select_one(spec.next_page_element)
if next_page is not None:
- next_page = next_page.get('href')
+ next_page = next_page.get(spec.next_page_attribute)
if next_page is not None:
if next_page.startswith('/'):
next_page = domain / next_page[1:]
diff --git a/cyberdrop_dl/main.py b/cyberdrop_dl/main.py
index b5260cac9..9001f800a 100644
--- a/cyberdrop_dl/main.py
+++ b/cyberdrop_dl/main.py
@@ -108,6 +108,8 @@ def parse_args() -> argparse.Namespace:
auth_opts = parser.add_argument_group("Authentication options")
auth_opts.add_argument("--gofile-api-key", help="api key for premium gofile", default=config_group["gofile_api_key"])
auth_opts.add_argument("--pixeldrain-api-key", help="api key for premium pixeldrain", default=config_group["pixeldrain_api_key"])
+ auth_opts.add_argument("--nudostar-username", help="username to login to nudostar", default=config_group["nudostar_username"])
+ auth_opts.add_argument("--nudostar-password", help="password to login to nudostar", default=config_group['nudostar_password'])
auth_opts.add_argument("--simpcity-username", help="username to login to simpcity", default=config_group["simpcity_username"])
auth_opts.add_argument("--simpcity-password", help="password to login to simpcity", default=config_group['simpcity_password'])
auth_opts.add_argument("--socialmediagirls-username", help="username to login to socialmediagirls", default=config_group["socialmediagirls_username"])
diff --git a/cyberdrop_dl/scraper/Scraper.py b/cyberdrop_dl/scraper/Scraper.py
index 3b503ca48..48f3ebb05 100644
--- a/cyberdrop_dl/scraper/Scraper.py
+++ b/cyberdrop_dl/scraper/Scraper.py
@@ -89,6 +89,7 @@ class ScrapeMapper:
self.gofile_semaphore = asyncio.Semaphore(1)
self.jpgfish_semaphore = asyncio.Semaphore(5)
self.cyberfile_semaphore = asyncio.Semaphore(2)
+ self.nudostar_semaphore = asyncio.Semaphore(1)
self.simpcity_semaphore = asyncio.Semaphore(1)
self.socialmediagirls_semaphore = asyncio.Semaphore(1)
self.xbunker_semaphore = asyncio.Semaphore(1)
@@ -101,7 +102,7 @@ class ScrapeMapper:
"jpg.church": self.ShareX, "jpg.fish": self.ShareX, "pixl.li": self.ShareX,
"nsfw.xxx": self.NSFW_XXX, "pimpandhost": self.PimpAndHost, "lovefap": self.LoveFap,
"e-hentai": self.EHentai, "gallery.deltaporno": self.ShareX, "vk.com": self.vk_redirect,
- "coomer.party": self.Coomeno, "kemono.party": self.Coomeno,
+ "coomer.party": self.Coomeno, "kemono.party": self.Coomeno, "nudostar": self.Xenforo,
"simpcity": self.Xenforo, "socialmediagirls": self.Xenforo, "xbunker": self.Xenforo}
async def _handle_album_additions(self, domain: str, album_obj: AlbumItem, title=None) -> None:
@@ -326,12 +327,15 @@ class ScrapeMapper:
if "simpcity" in url.host:
async with self.simpcity_semaphore:
cascade, title = await self.xenforo_crawler.fetch(xenforo_session, url)
- if "socialmediagirls" in url.host:
+ elif "socialmediagirls" in url.host:
async with self.socialmediagirls_semaphore:
cascade, title = await self.xenforo_crawler.fetch(xenforo_session, url)
- if "xbunker" in url.host:
+ elif "xbunker" in url.host:
async with self.xbunker_semaphore:
cascade, title = await self.xenforo_crawler.fetch(xenforo_session, url)
+ elif "nudostar" in url.host:
+ async with self.nudostar_semaphore:
+ cascade, title = await self.xenforo_crawler.fetch(xenforo_session, url)
if not title or await cascade.is_empty():
await xenforo_session.exit_handler()
return