Commit 51a1718

benny-dou <60535774+benny-dou@users.noreply.github.com>
2025-02-12 14:06:25
chore: disable retry for comments API
1 parent 8e70c61
Changed files (2)
src
src/preview/douyin.py
@@ -149,7 +149,7 @@ async def get_comments(aweme_id: str = "", platform: str = "douyin", douyin_comm
         api_url = api_urls.get(f"{platform}_tikhub")
         headers = {"authorization": f"Bearer {TOKEN.TIKHUB}", "accept": "application/json"}
         try:
-            resp = await hx_req(api_url, headers=headers, check_keys=["data"], check_kv={"code": 200})
+            resp = await hx_req(api_url, headers=headers, check_keys=["data"], check_kv={"code": 200}, max_retry=0, timeout=3)
             data = resp["data"].get("comments", [])
         except Exception:
             logger.warning(f"{platform} comments API [tikhub] failed")
src/preview/ytdlp.py
@@ -463,7 +463,7 @@ async def get_bilibili_comments(bvid: str | None, provider: str = PROVIDER.BILIB
         try:
             api = f"{API.TIKHUB_FREE}/api/bilibili/web/fetch_video_comments?bv_id={bvid}"
             headers = {"accept": "application/json"}
-            resp = await hx_req(api, headers={"accept": "application/json"}, check_keys=["data.data"], check_kv={"code": 200}, max_retry=0)
+            resp = await hx_req(api, headers={"accept": "application/json"}, check_keys=["data.data"], check_kv={"code": 200}, max_retry=0, timeout=3)
             data = resp["data"]["data"].get("replies", [])
             succ = True
         except Exception:
@@ -472,7 +472,7 @@ async def get_bilibili_comments(bvid: str | None, provider: str = PROVIDER.BILIB
         api_url = f"{API.TIKHUB}/api/v1/bilibili/web/fetch_video_comments?bv_id={bvid}"
         headers = {"authorization": f"Bearer {TOKEN.TIKHUB}", "accept": "application/json"}
         try:
-            resp = await hx_req(api_url, headers=headers, check_keys=["data.data"], check_kv={"code": 200})
+            resp = await hx_req(api_url, headers=headers, check_keys=["data.data"], check_kv={"code": 200}, max_retry=0, timeout=3)
             data = resp["data"]["data"].get("replies", [])
         except Exception:
             logger.warning("Bilibili comments API [tikhub] failed")