Initial commit: doujinshi-dl generic plugin framework

History reset as part of DMCA compliance. The project has been
refactored into a generic, site-agnostic download framework.
Site-specific logic lives in separate plugin packages.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ricter Zheng
2026-03-25 10:37:21 +08:00
commit 81d008036a
53 changed files with 4063 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
# coding: utf-8
"""Generic async HTTP request helper (no site-specific headers injected here)."""
import httpx
import urllib3.exceptions
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
async def async_request(method, url, proxy=None, **kwargs):
"""
Thin async HTTP client wrapper.
Header injection (Cookie, User-Agent, Referer) is done by callers that
have access to site-specific configuration; this helper stays generic.
"""
from doujinshi_dl import constant
headers = kwargs.pop('headers', {})
if proxy is None:
proxy = constant.CONFIG.get('proxy', '')
if isinstance(proxy, str) and not proxy:
proxy = None
# Remove 'timeout' from kwargs to avoid duplicate keyword argument since
# httpx.AsyncClient accepts it as a constructor arg or request arg.
timeout = kwargs.pop('timeout', 30)
async with httpx.AsyncClient(headers=headers, verify=False, proxy=proxy,
timeout=timeout) as client:
response = await client.request(method, url, **kwargs)
return response