mirror of
https://github.com/Yuvi9587/Kemono-Downloader.git
synced 2025-12-29 16:14:44 +00:00
Commit
This commit is contained in:
@@ -63,7 +63,6 @@ def parse_datetime(date_string, format="%Y-%m-%dT%H:%M:%S%z", utcoffset=0):
|
|||||||
unquote = urllib.parse.unquote
|
unquote = urllib.parse.unquote
|
||||||
unescape = html.unescape
|
unescape = html.unescape
|
||||||
|
|
||||||
# --- From: util.py ---
|
|
||||||
def decrypt_xor(encrypted, key, base64=True, fromhex=False):
|
def decrypt_xor(encrypted, key, base64=True, fromhex=False):
|
||||||
if base64: encrypted = binascii.a2b_base64(encrypted)
|
if base64: encrypted = binascii.a2b_base64(encrypted)
|
||||||
if fromhex: encrypted = bytes.fromhex(encrypted.decode())
|
if fromhex: encrypted = bytes.fromhex(encrypted.decode())
|
||||||
@@ -76,7 +75,6 @@ def advance(iterable, num):
|
|||||||
def json_loads(s): return json.loads(s)
|
def json_loads(s): return json.loads(s)
|
||||||
def json_dumps(obj): return json.dumps(obj, separators=(",", ":"))
|
def json_dumps(obj): return json.dumps(obj, separators=(",", ":"))
|
||||||
|
|
||||||
# --- From: common.py ---
|
|
||||||
class Extractor:
|
class Extractor:
|
||||||
def __init__(self, match, logger):
|
def __init__(self, match, logger):
|
||||||
self.log = logger
|
self.log = logger
|
||||||
@@ -116,7 +114,6 @@ class Extractor:
|
|||||||
if not kwargs.get("fatal", True): return {}
|
if not kwargs.get("fatal", True): return {}
|
||||||
raise
|
raise
|
||||||
|
|
||||||
# --- From: bunkr.py (Adapted) ---
|
|
||||||
BASE_PATTERN_BUNKR = r"(?:https?://)?(?:[a-zA-Z0-9-]+\.)?(bunkr\.(?:si|la|ws|red|black|media|site|is|to|ac|cr|ci|fi|pk|ps|sk|ph|su)|bunkrr\.ru)"
|
BASE_PATTERN_BUNKR = r"(?:https?://)?(?:[a-zA-Z0-9-]+\.)?(bunkr\.(?:si|la|ws|red|black|media|site|is|to|ac|cr|ci|fi|pk|ps|sk|ph|su)|bunkrr\.ru)"
|
||||||
DOMAINS = ["bunkr.si", "bunkr.ws", "bunkr.la", "bunkr.red", "bunkr.black", "bunkr.media", "bunkr.site"]
|
DOMAINS = ["bunkr.si", "bunkr.ws", "bunkr.la", "bunkr.red", "bunkr.black", "bunkr.media", "bunkr.site"]
|
||||||
CF_DOMAINS = set()
|
CF_DOMAINS = set()
|
||||||
@@ -195,10 +192,6 @@ class BunkrMediaExtractor(BunkrAlbumExtractor):
|
|||||||
self.log.error("%s: %s", exc.__class__.__name__, exc)
|
self.log.error("%s: %s", exc.__class__.__name__, exc)
|
||||||
yield MockMessage.Directory, {"album_name": "error", "count": 0}, {}
|
yield MockMessage.Directory, {"album_name": "error", "count": 0}, {}
|
||||||
|
|
||||||
# ==============================================================================
|
|
||||||
# --- PUBLIC API FOR THE GUI ---
|
|
||||||
# ==============================================================================
|
|
||||||
|
|
||||||
def get_bunkr_extractor(url, logger):
|
def get_bunkr_extractor(url, logger):
|
||||||
"""Selects the correct Bunkr extractor based on the URL pattern."""
|
"""Selects the correct Bunkr extractor based on the URL pattern."""
|
||||||
if BunkrAlbumExtractor.pattern.match(url):
|
if BunkrAlbumExtractor.pattern.match(url):
|
||||||
@@ -235,7 +228,6 @@ def fetch_bunkr_data(url, logger):
|
|||||||
album_name = re.sub(r'[<>:"/\\|?*]', '_', raw_album_name).strip() or "untitled"
|
album_name = re.sub(r'[<>:"/\\|?*]', '_', raw_album_name).strip() or "untitled"
|
||||||
logger.info(f"Processing Bunkr album: {album_name}")
|
logger.info(f"Processing Bunkr album: {album_name}")
|
||||||
elif msg_type == MockMessage.Url:
|
elif msg_type == MockMessage.Url:
|
||||||
# data here is the file_data dictionary
|
|
||||||
files_to_download.append(data)
|
files_to_download.append(data)
|
||||||
|
|
||||||
if not files_to_download:
|
if not files_to_download:
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ def fetch_nhentai_gallery(gallery_id, logger=print):
|
|||||||
"""
|
"""
|
||||||
api_url = f"https://nhentai.net/api/gallery/{gallery_id}"
|
api_url = f"https://nhentai.net/api/gallery/{gallery_id}"
|
||||||
|
|
||||||
# Create a cloudscraper instance
|
|
||||||
scraper = cloudscraper.create_scraper()
|
scraper = cloudscraper.create_scraper()
|
||||||
|
|
||||||
logger(f" Fetching nhentai gallery metadata from: {api_url}")
|
logger(f" Fetching nhentai gallery metadata from: {api_url}")
|
||||||
|
|||||||
@@ -1,14 +1,9 @@
|
|||||||
# src/core/saint2_client.py
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re as re_module
|
import re as re_module
|
||||||
import html
|
import html
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
# ##############################################################################
|
|
||||||
# SECTION: Utility functions adapted from the original script
|
|
||||||
# ##############################################################################
|
|
||||||
|
|
||||||
PATTERN_CACHE = {}
|
PATTERN_CACHE = {}
|
||||||
|
|
||||||
@@ -46,10 +41,6 @@ def nameext_from_url(url):
|
|||||||
data["filename"], data["extension"] = filename, ""
|
data["filename"], data["extension"] = filename, ""
|
||||||
return data
|
return data
|
||||||
|
|
||||||
# ##############################################################################
|
|
||||||
# SECTION: Extractor Logic adapted for the main application
|
|
||||||
# ##############################################################################
|
|
||||||
|
|
||||||
class BaseExtractor:
|
class BaseExtractor:
|
||||||
"""A simplified base class for extractors."""
|
"""A simplified base class for extractors."""
|
||||||
def __init__(self, match, session, logger):
|
def __init__(self, match, session, logger):
|
||||||
@@ -165,7 +156,6 @@ def fetch_saint2_data(url, logger):
|
|||||||
if match:
|
if match:
|
||||||
extractor = extractor_cls(match, session, logger)
|
extractor = extractor_cls(match, session, logger)
|
||||||
album_title, files = extractor.items()
|
album_title, files = extractor.items()
|
||||||
# Sanitize the album title to be a valid folder name
|
|
||||||
sanitized_title = re_module.sub(r'[<>:"/\\|?*]', '_', album_title) if album_title else "saint2_download"
|
sanitized_title = re_module.sub(r'[<>:"/\\|?*]', '_', album_title) if album_title else "saint2_download"
|
||||||
return sanitized_title, files
|
return sanitized_title, files
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user