feat: DramaBox 全量走 App 接口,清单可停止并避免卡死
分类按 App 翻页,精选走推荐接口。清单顶部显示进度,停止后不再拉新剧,已拿到的封面继续加载。列表只绘制可见卡片,避免大量剧目占满主线程。
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
from pathlib import Path
|
||||
|
||||
from server.services.downloads import DownloadManager, _plain_text
|
||||
from server.services.dramabox import api
|
||||
from server.services.dramabox.app_api import book_brief
|
||||
from server.services.dramabox.client import USER_AGENT, client
|
||||
from server.services.dramabox.covers import covers
|
||||
from server.services.dramabox.private_mp4 import decrypt_file_if_needed
|
||||
from server.services.dramabox import playlist as db_playlist
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[3]
|
||||
@@ -21,16 +22,13 @@ def _write_intro(folder: Path, drama_id: str, title: str, _token: str, _device)
|
||||
tags = ""
|
||||
count = ""
|
||||
try:
|
||||
detail = api.book_detail(str(drama_id))
|
||||
book = detail.get("book") if isinstance(detail, dict) else None
|
||||
if isinstance(book, dict):
|
||||
fetched = str(book.get("bookName") or "").strip()
|
||||
if fetched:
|
||||
name = fetched
|
||||
desc = _plain_text(book.get("introduction") or "")
|
||||
language = str(book.get("simpleLanguage") or language)
|
||||
tags = "、".join(str(item) for item in (book.get("typeTwoNames") or []) if item)
|
||||
count = str(book.get("chapterCount") or "")
|
||||
detail = book_brief(str(drama_id))
|
||||
fetched = detail.get("name") or ""
|
||||
if fetched:
|
||||
name = fetched
|
||||
desc = _plain_text(detail.get("introduction") or "")
|
||||
tags = detail.get("tags") or ""
|
||||
count = detail.get("count") or ""
|
||||
profile = client.profile or {}
|
||||
country = str(profile.get("country") or "")
|
||||
except Exception:
|
||||
@@ -65,4 +63,5 @@ downloads = DownloadManager(
|
||||
read_cover=_read_cover,
|
||||
current_auth=_auth,
|
||||
headers={"User-Agent": USER_AGENT, "Referer": "https://www.dramaboxapp.com/", "Origin": "https://www.dramaboxapp.com"},
|
||||
prepare_file=decrypt_file_if_needed,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user