feat: 补全短剧全量清单并接入 DramaBox 官网登录

This commit is contained in:
Nixevol
2026-10-22 02:20:16 +08:00
parent 39774ad9cc
commit 00e78661a7
22 changed files with 894 additions and 194 deletions
+5
View File
@@ -19,6 +19,7 @@ USER_AGENT = (
class DramaBoxClient:
def __init__(self) -> None:
self.token = ""
self.web_token = ""
self.language = DEFAULT_LANGUAGE
self.build_id = ""
self.profile: dict = {}
@@ -34,6 +35,7 @@ class DramaBoxClient:
if not isinstance(data, dict):
return
self.token = str(data.get("token") or "")
self.web_token = str(data.get("web_token") or "")
language = str(data.get("language") or "").strip()
if language:
try:
@@ -49,6 +51,7 @@ class DramaBoxClient:
STATE_DIR.mkdir(parents=True, exist_ok=True)
payload = {
"token": self.token,
"web_token": self.web_token,
"language": self.language,
"build_id": self.build_id,
"profile": self.profile,
@@ -62,6 +65,7 @@ class DramaBoxClient:
self.language = locale["id"]
if not self.token:
self.token = secrets.token_hex(16)
self.web_token = ""
self.profile = {
"id": locale["id"],
"username": locale["id"],
@@ -85,6 +89,7 @@ class DramaBoxClient:
def clear(self) -> None:
self.token = ""
self.web_token = ""
self.profile = {}
self.save()