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
71
71
72
72
``` python
73
73
client = 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 )
80
80
```
81
81
82
82
- 请求用户数据示例
@@ -129,6 +129,9 @@ self.InstagramWeb = InstagramWeb(self.client)
129
129
130
130
# Weibo
131
131
self .WeiboWeb = WeiboWeb(self .client)
132
+
133
+ # Captcha Solver
134
+ self .CaptchaSolver = CaptchaSolver(self .client)
132
135
```
133
136
134
137
- 使用` DouyinAppV1 ` 的` fetch_one_video ` 方法调用接口获取单一视频数据。
@@ -142,8 +145,16 @@ print(video_data)
142
145
- 我们已经使用HTTPX的对大多数端点进行了异步封装,如果你的代码是同步执行的,你可以使用下面的代码防止异步传染。
143
146
144
147
``` 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" )
147
158
print (video_data)
148
159
```
149
160
Original file line number Diff line number Diff line change 27
27
28
28
class Client :
29
29
def __init__ (self ,
30
- base_url : str = 'https://beta .tikhub.io' ,
30
+ base_url : str = 'https://api .tikhub.io' ,
31
31
api_key : str = None ,
32
32
proxies : dict = None ,
33
33
max_retries : int = 3 ,
34
34
max_connections : int = 50 ,
35
- timeout : int = 10 ,
35
+ timeout : int = 60 ,
36
36
max_tasks : int = 50
37
37
):
38
38
# Base URL
You can’t perform that action at this time.
0 commit comments