feat: 补全短剧全量清单并接入 DramaBox 官网登录
This commit is contained in:
@@ -13,6 +13,36 @@ def home_index(language: str | None = None) -> list[dict]:
|
||||
return data if isinstance(data, list) else []
|
||||
|
||||
|
||||
_ALL_LABELS: dict[str, str] = {}
|
||||
|
||||
|
||||
def all_label(language: str | None = None) -> str:
|
||||
locale = resolve(language or client.language)["id"]
|
||||
cached = _ALL_LABELS.get(locale)
|
||||
if cached:
|
||||
return cached
|
||||
url = f"https://infocdn.dramaboxdb.com/seo/dramaboxapp/locales/{locale}/common.json"
|
||||
label = ""
|
||||
try:
|
||||
response = http.send(
|
||||
"GET",
|
||||
url,
|
||||
headers={"User-Agent": USER_AGENT, "Referer": f"{SITE}/", "Accept": "application/json"},
|
||||
timeout=20.0,
|
||||
)
|
||||
response.raise_for_status()
|
||||
payload = response.json()
|
||||
browse_text = payload.get("browse") if isinstance(payload, dict) else None
|
||||
if isinstance(browse_text, dict):
|
||||
label = str(browse_text.get("all") or "").strip()
|
||||
except Exception:
|
||||
label = ""
|
||||
if not label:
|
||||
label = "All"
|
||||
_ALL_LABELS[locale] = label
|
||||
return label
|
||||
|
||||
|
||||
def browse(page: int, type_id: int, language: str | None = None, page_size: int = 18) -> dict:
|
||||
data = _webfic(
|
||||
"POST",
|
||||
|
||||
Reference in New Issue
Block a user