Commit 2455efb

benny-dou <60535774+benny-dou@users.noreply.github.com>
2025-09-02 12:48:19
fix(twitter): fix error handling
1 parent 8e4c288
Changed files (1)
src
preview
src/preview/twitter.py
@@ -245,7 +245,7 @@ async def get_tweet_info_via_tikhub(url: str = "", post_id: str = "", quote_info
     else:
         headers = {"authorization": f"Bearer {TOKEN.TIKHUB}", "accept": "application/json"}
         resp = await hx_req(api_url, headers=headers, proxy=PROXY.TWITTER, check_keys=["data.author.screen_name"], check_kv={"data.id": post_id})
-        if resp.get("hx_error"):
+        if resp.get("hx_error") or glom(resp, "data.author.screen_name") is None:
             logger.error("Failed to get tweet info via TikHub")
             return {}
         data: dict = resp["data"]