@@ -10,12 +10,145 @@ class InstagramWeb:
10
10
def __init__ (self , client : APIClient ):
11
11
self .client = client
12
12
13
- # 获取用户信息 | Fetch user info
14
- async def fetch_user_info (self , username : str ):
15
- endpoint = "/api/v1/instagram/web/user_info "
13
+ # 根据用户名获取用户数据 | Get user data by username
14
+ async def fetch_user_info_by_username (self , username : str ):
15
+ endpoint = "/api/v1/instagram/web_app/fetch_user_info_by_username "
16
16
data = await self .client .fetch_get_json (f"{ endpoint } ?username={ username } " )
17
17
return data
18
18
19
+ # 根据用户ID获取用户数据 | Get user data by user ID
20
+ async def fetch_user_info_by_user_id (self , user_id : str ):
21
+ endpoint = "/api/v1/instagram/web_app/fetch_user_info_by_user_id"
22
+ data = await self .client .fetch_get_json (f"{ endpoint } ?user_id={ user_id } " )
23
+ return data
24
+
25
+ # 根据用户名获取用户数据V2 | Get user data by username V2
26
+ async def fetch_user_info_by_user_id_v2 (self , username : str ):
27
+ endpoint = "/api/v1/instagram/web_app/fetch_user_info_by_user_id_v2"
28
+ data = await self .client .fetch_get_json (f"{ endpoint } ?user_id={ username } " )
29
+ return data
30
+
31
+ # 根据用户ID获取用户数据V2 | Get user data by user ID V2
32
+ async def fetch_user_info_by_id_v2 (self , user_id : str ):
33
+ endpoint = "/api/v1/instagram/web_app/fetch_user_info_by_user_id_v2"
34
+ data = await self .client .fetch_get_json (f"{ endpoint } ?user_id={ user_id } " )
35
+ return data
36
+
37
+ # 根据用户ID获取用户数据关于信息 | Get user data about by user ID
38
+ async def fetch_user_about_info_by_user_id (self , user_id : str ):
39
+ endpoint = "/api/v1/instagram/web_app/fetch_user_about_info_by_user_id"
40
+ data = await self .client .fetch_get_json (f"{ endpoint } ?user_id={ user_id } " )
41
+ return data
42
+
43
+ # 根据用户名获取用户网页接口的个人信息 | Get user info by username web API
44
+ async def fetch_user_info_by_username_web (self , username : str ):
45
+ endpoint = "/api/v1/instagram/web_app/fetch_user_info_by_username_web"
46
+ data = await self .client .fetch_get_json (f"{ endpoint } ?username={ username } " )
47
+ return data
48
+
49
+ # 根据用户名获取用户的粉丝数据 | Get user followers by username
50
+ async def fetch_user_followers_by_username (self , username : str , pagination_token : str = None ):
51
+ endpoint = "/api/v1/instagram/web_app/fetch_user_followers_by_username"
52
+ data = await self .client .fetch_get_json (f"{ endpoint } ?username={ username } &pagination_token={ pagination_token } " )
53
+ return data
54
+
55
+ # 根据用户名获取用户的正在关注的用户数据 | Get user followings by username
56
+ async def fetch_user_following_by_username (self , username : str , pagination_token : str = None ):
57
+ endpoint = "/api/v1/instagram/web_app/fetch_user_following_by_username"
58
+ data = await self .client .fetch_get_json (f"{ endpoint } ?username={ username } &pagination_token={ pagination_token } " )
59
+ return data
60
+
61
+ # 根据用户ID获取用户发布的帖子 | Get user posts by user ID
62
+ async def fetch_user_posts_by_user_id (self , user_id : str , count : int = 12 , end_cursor : str = None ):
63
+ endpoint = "/api/v1/instagram/web_app/fetch_user_posts_by_user_id"
64
+ data = await self .client .fetch_get_json (f"{ endpoint } ?user_id={ user_id } &count={ count } &end_cursor={ end_cursor } " )
65
+ return data
66
+
67
+ # 根据用户ID获取用户发布的快拍 | Get user reels by user ID
68
+ async def fetch_user_reels_by_user_id (self , user_id : str , count : int = 12 , max_id : str = None ):
69
+ endpoint = "/api/v1/instagram/web_app/fetch_user_reels_by_user_id"
70
+ data = await self .client .fetch_get_json (f"{ endpoint } ?user_id={ user_id } &count={ count } &max_id={ max_id } " )
71
+ return data
72
+
73
+ # 根据用户ID获取用户被标记的帖子 | Get user tagged posts by user ID
74
+ async def fetch_user_tagged_posts_by_user_id (self , user_id : str , count : int = 12 , end_cursor : str = None ):
75
+ endpoint = "/api/v1/instagram/web_app/fetch_user_tagged_posts_by_user_id"
76
+ data = await self .client .fetch_get_json (f"{ endpoint } ?user_id={ user_id } &count={ count } &end_cursor={ end_cursor } " )
77
+ return data
78
+
79
+ # 根据用户ID获取与用户相关的其他用户 | Get user related users by user ID
80
+ async def fetch_related_users_by_user_id (self , user_id : str ):
81
+ endpoint = "/api/v1/instagram/web_app/fetch_related_users_by_user_id"
82
+ data = await self .client .fetch_get_json (f"{ endpoint } ?user_id={ user_id } " )
83
+ return data
84
+
85
+ # 根据用户名获取相似的账户数据 | Get similar accounts by username
86
+ async def fetch_similar_accounts_by_username (self , username : str ):
87
+ endpoint = "/api/v1/instagram/web_app/fetch_similar_accounts_by_username"
88
+ data = await self .client .fetch_get_json (f"{ endpoint } ?username={ username } " )
89
+ return data
90
+
91
+
92
+ # 根据关键词搜索用户 | Search users by query
93
+ async def fetch_search_users_by_keyword (self , keyword : str ):
94
+ endpoint = "/api/v1/instagram/web_app/fetch_search_users_by_keyword"
95
+ data = await self .client .fetch_get_json (f"{ endpoint } ?keyword={ keyword } " )
96
+ return data
97
+
98
+ # 根据URL获取帖子数据 | Get post data by URL
99
+ async def fetch_post_info_by_url (self , url : str ):
100
+ endpoint = "/api/v1/instagram/web_app/fetch_post_info_by_url"
101
+ data = await self .client .fetch_get_json (f"{ endpoint } ?url={ url } " )
102
+ return data
103
+
104
+ # 根据帖子ID获取帖子数据 | Get post data by post ID
105
+ async def fetch_post_info_by_post_id (self , post_id : str ):
106
+ endpoint = "/api/v1/instagram/web_app/fetch_post_info_by_post_id"
107
+ data = await self .client .fetch_get_json (f"{ endpoint } ?post_id={ post_id } " )
108
+ return data
109
+
110
+ # 根据帖子URL获取媒体数据 | Get media data by URL
111
+ async def fetch_post_media_by_url (self , url : str ):
112
+ endpoint = "/api/v1/instagram/web_app/fetch_post_media_by_url"
113
+ data = await self .client .fetch_get_json (f"{ endpoint } ?url={ url } " )
114
+ return data
115
+
116
+ # 根据音乐ID获取音乐数据 | Get music data by music ID
117
+ async def fetch_music_info_by_music_id (self , music_id : str ):
118
+ endpoint = "/api/v1/instagram/web_app/fetch_music_info_by_music_id"
119
+ data = await self .client .fetch_get_json (f"{ endpoint } ?music_id={ music_id } " )
120
+ return data
121
+
122
+ # 根据关键词搜索话题数据 | Search hashtags by query
123
+ async def fetch_search_hashtags_by_keyword (self , keyword : str ):
124
+ endpoint = "/api/v1/instagram/web_app/fetch_search_hashtags_by_keyword"
125
+ data = await self .client .fetch_get_json (f"{ endpoint } ?keyword={ keyword } " )
126
+ return data
127
+
128
+ # 根据关键词获取话题帖子 | Get hashtag posts by query
129
+ async def fetch_hashtag_posts_by_keyword (self , keyword : str , end_cursor : str = None ):
130
+ endpoint = "/api/v1/instagram/web_app/fetch_hashtag_posts_by_keyword"
131
+ data = await self .client .fetch_get_json (f"{ endpoint } ?keyword={ keyword } &end_cursor={ end_cursor } " )
132
+ return data
133
+
134
+ # 根据关键词搜索地点数据 | Search locations by query
135
+ async def fetch_search_locations_by_keyword (self , keyword : str ):
136
+ endpoint = "/api/v1/instagram/web_app/fetch_search_locations_by_keyword"
137
+ data = await self .client .fetch_get_json (f"{ endpoint } ?keyword={ keyword } " )
138
+ return data
139
+
140
+ # 根据地点ID获取地点相关的帖子 | Get location posts by location ID
141
+ async def fetch_location_posts_by_location_id (self , location_id : str , max_id : str = None ):
142
+ endpoint = "/api/v1/instagram/web_app/fetch_location_posts_by_location_id"
143
+ data = await self .client .fetch_get_json (f"{ endpoint } ?location_id={ location_id } &max_id={ max_id } " )
144
+ return data
145
+
146
+ # 综合搜索 | Search all by query
147
+ async def fetch_global_search (self , keyword : str ):
148
+ endpoint = "/api/v1/instagram/web_app/fetch_global_search"
149
+ data = await self .client .fetch_get_json (f"{ endpoint } ?keyword={ keyword } " )
150
+ return data
151
+
19
152
20
153
if __name__ == "__main__" :
21
154
import asyncio
@@ -28,7 +161,7 @@ async def main():
28
161
instagram_web = InstagramWeb (client )
29
162
30
163
# 获取用户信息 | Fetch user info
31
- data = await instagram_web .fetch_user_info ("instagram" )
164
+ data = await instagram_web .fetch_user_info_by_username ("instagram" )
32
165
print (data )
33
166
34
167
0 commit comments