🔧: Use retry to increase stability of TikTok APP API
This commit is contained in:
parent
538dd590d0
commit
2980490444
2 changed files with 6 additions and 1 deletions
|
|
@ -43,6 +43,9 @@ from crawlers.base_crawler import BaseCrawler
|
|||
from crawlers.tiktok.app.endpoints import TikTokAPIEndpoints
|
||||
from crawlers.utils.utils import model_to_query_string
|
||||
|
||||
# 重试机制
|
||||
from tenacity import *
|
||||
|
||||
# TikTok接口数据请求模型
|
||||
from crawlers.tiktok.app.models import (
|
||||
BaseRequestModel, FeedVideoDetail
|
||||
|
|
@ -79,6 +82,7 @@ class TikTokAPPCrawler:
|
|||
|
||||
# 获取单个作品数据
|
||||
# @deprecated("TikTok APP fetch_one_video is deprecated and will be removed in a future release. Use Web API instead. | TikTok APP fetch_one_video 已弃用,将在将来的版本中删除。请改用Web API。")
|
||||
@retry(stop=stop_after_attempt(10), wait=wait_fixed(1))
|
||||
async def fetch_one_video(self, aweme_id: str):
|
||||
# 获取TikTok的实时Cookie
|
||||
kwargs = await self.get_tiktok_headers()
|
||||
|
|
|
|||
|
|
@ -34,4 +34,5 @@ ua-parser==0.18.0
|
|||
user-agents==2.2.0
|
||||
uvicorn==0.29.0
|
||||
websockets==12.0
|
||||
gmssl==3.2.2
|
||||
gmssl==3.2.2
|
||||
tenacity~=9.0.0
|
||||
Loading…
Reference in a new issue