mirror of
https://github.com/Evil0ctal/Douyin_TikTok_Download_API.git
synced 2025-04-12 03:37:05 +08:00
🔧: Use retry to increase stability of TikTok APP API
This commit is contained in:
parent
538dd590d0
commit
2980490444
@ -43,6 +43,9 @@ from crawlers.base_crawler import BaseCrawler
|
|||||||
from crawlers.tiktok.app.endpoints import TikTokAPIEndpoints
|
from crawlers.tiktok.app.endpoints import TikTokAPIEndpoints
|
||||||
from crawlers.utils.utils import model_to_query_string
|
from crawlers.utils.utils import model_to_query_string
|
||||||
|
|
||||||
|
# 重试机制
|
||||||
|
from tenacity import *
|
||||||
|
|
||||||
# TikTok接口数据请求模型
|
# TikTok接口数据请求模型
|
||||||
from crawlers.tiktok.app.models import (
|
from crawlers.tiktok.app.models import (
|
||||||
BaseRequestModel, FeedVideoDetail
|
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。")
|
# @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):
|
async def fetch_one_video(self, aweme_id: str):
|
||||||
# 获取TikTok的实时Cookie
|
# 获取TikTok的实时Cookie
|
||||||
kwargs = await self.get_tiktok_headers()
|
kwargs = await self.get_tiktok_headers()
|
||||||
|
@ -34,4 +34,5 @@ ua-parser==0.18.0
|
|||||||
user-agents==2.2.0
|
user-agents==2.2.0
|
||||||
uvicorn==0.29.0
|
uvicorn==0.29.0
|
||||||
websockets==12.0
|
websockets==12.0
|
||||||
gmssl==3.2.2
|
gmssl==3.2.2
|
||||||
|
tenacity~=9.0.0
|
Loading…
x
Reference in New Issue
Block a user