Commit 67c390f
Changed files (1)
src
preview
src/preview/douyin.py
@@ -70,6 +70,9 @@ async def preview_douyin(
logger.error("❌抖音解析失败, 尝试第三方Bot...")
await send_to_social_media_bridge(client, message, url, platform, **kwargs)
return
+ if not succ:
+ await modify_progress(text="❌抖音解析失败", force_update=True, **kwargs)
+ return
texts = ""
if author := data.get("author"):
texts += f"\n🎶**[{author}]({url})**"
@@ -102,6 +105,7 @@ async def parse_via_direct(url: str = "", platform: str = "douyin", proxy: str |
if platform == "tiktok":
return False, {}
try:
+ logger.trace(f"{platform} API [direct] for: {url}")
video_id = Path(url).stem
api_url = f"https://www.iesdouyin.com/share/video/{video_id}" if platform == "douyin" else url
resp = await hx_req(api_url, mobile=True, rformat="content", proxy=proxy, max_retry=0, timeout=3)
@@ -128,6 +132,7 @@ async def parse_via_direct(url: str = "", platform: str = "douyin", proxy: str |
await modify_progress(text=f"⏬正在下载:\n{summay_media(media)}", force_update=True, **kwargs)
media = await download_media(media, **kwargs)
if not media:
+ logger.warning(f"{platform} API [direct] media download failed")
return False, {}
return True, {
"aweme_id": info.get("aweme_id", video_id),
@@ -136,6 +141,7 @@ async def parse_via_direct(url: str = "", platform: str = "douyin", proxy: str |
"create_time": info.get("create_time"),
"desc": info.get("desc"),
}
+ logger.warning(f"{platform} API [direct] matched nothing")
except Exception:
logger.warning(f"{platform} API [direct] failed")
return False, {}
@@ -151,6 +157,7 @@ async def parse_via_tikhub(url: str = "", platform: str = "douyin", proxy: str |
{"aweme_id": str, "media": list[dict], "author": str, "create_time": int, "desc": str}
"""
try:
+ logger.trace(f"{platform} API [{provider}] for: {url}")
api_url = f"{API.TIKHUB_FREE}/api/hybrid/video_data?url={url}" if provider == "free" else f"{API.TIKHUB}/api/v1/hybrid/video_data?url={url}"
headers = {"accept": "application/json"}
if provider == "tikhub":
@@ -178,6 +185,7 @@ async def parse_via_tikhub(url: str = "", platform: str = "douyin", proxy: str |
await modify_progress(text=f"⏬正在下载:\n{summay_media(media)}", force_update=True, **kwargs)
media = await download_media(media, **kwargs)
if not media:
+ logger.warning(f"{platform} API [{provider}] media download failed")
return False, {}
return True, {
"aweme_id": info.get("aweme_id", Path(url).stem),