File tree Expand file tree Collapse file tree 2 files changed +21
-10
lines changed Expand file tree Collapse file tree 2 files changed +21
-10
lines changed Original file line number Diff line number Diff line change @@ -71,12 +71,12 @@ from tikhub import Client
7171
7272``` python
7373client = Client(base_url = " https://api.tikhub.io" ,
74- api_key = " YOUR_API_TOKEN" ,
75- proxies = None ,
76- max_retries = 3 ,
77- max_connections = 50 ,
78- timeout = 10 ,
79- max_tasks = 50 )
74+ api_key = " YOUR_API_TOKEN" ,
75+ proxies = None ,
76+ max_retries = 3 ,
77+ max_connections = 50 ,
78+ timeout = 10 ,
79+ max_tasks = 50 )
8080```
8181
8282- 请求用户数据示例
@@ -129,6 +129,9 @@ self.InstagramWeb = InstagramWeb(self.client)
129129
130130# Weibo
131131self .WeiboWeb = WeiboWeb(self .client)
132+
133+ # Captcha Solver
134+ self .CaptchaSolver = CaptchaSolver(self .client)
132135```
133136
134137- 使用` DouyinAppV1 ` 的` fetch_one_video ` 方法调用接口获取单一视频数据。
@@ -142,8 +145,16 @@ print(video_data)
142145- 我们已经使用HTTPX的对大多数端点进行了异步封装,如果你的代码是同步执行的,你可以使用下面的代码防止异步传染。
143146
144147``` python
145- # 使用asyncio.run防止异步传染到其他代码 | Use asyncio.run to prevent asynchronous infection to other code
146- video_data = asyncio.run(client.DouyinAppV1.fetch_one_video(aweme_id = " 7345492945006595379" ))
148+ import asyncio
149+
150+ # 获取抖音单一视频数据 | Get a single video data from Douyin
151+ def fetch_one_video (aweme_id : str ):
152+ # 使用asyncio.run防止异步传染到其他代码
153+ # Use asyncio.run to prevent asynchronous infection to other code
154+ return asyncio.run(client.DouyinAppV1.fetch_one_video(aweme_id = aweme_id))
155+
156+
157+ video_data = fetch_one_video(aweme_id = " 7372484719365098803" )
147158print (video_data)
148159```
149160
Original file line number Diff line number Diff line change 2727
2828class Client :
2929 def __init__ (self ,
30- base_url : str = 'https://beta .tikhub.io' ,
30+ base_url : str = 'https://api .tikhub.io' ,
3131 api_key : str = None ,
3232 proxies : dict = None ,
3333 max_retries : int = 3 ,
3434 max_connections : int = 50 ,
35- timeout : int = 10 ,
35+ timeout : int = 60 ,
3636 max_tasks : int = 50
3737 ):
3838 # Base URL
You can’t perform that action at this time.
0 commit comments