@@ -34,13 +34,21 @@ def request(self, method, data):
34
34
elif response ["response" ]["status_code" ] == 404 :
35
35
raise NotFoundException ("Instagram resource not found" )
36
36
else :
37
- raise BadResponseException ("Bad response from Instagram" )
38
- raise BadResponseException ("Bad response from RocketAPI" )
37
+ raise BadResponseException (
38
+ f"Bad response from Instagram ({ method } : { response ['response' ]['status_code' ]} )"
39
+ )
40
+ raise BadResponseException (f"Bad response from RocketAPI ({ method } )" )
39
41
40
42
def search (self , query ):
41
43
"""
42
44
Search for a specific user, hashtag or place.
43
45
46
+ As of September 2024, we no longer recommend using this method, as it now only returns a maximum of 5 users and leaves the places and hashtags arrays empty. Instead, please use the separate methods:
47
+ - `search_users`
48
+ - `search_hashtags`
49
+ - `search_locations`
50
+ - `search_audios`
51
+
44
52
Args:
45
53
query (str): The search query
46
54
@@ -76,7 +84,7 @@ def get_user_media(self, user_id, count=12, max_id=None):
76
84
77
85
Args:
78
86
user_id (int): User id
79
- count (int): Number of media to retrieve (max: 50 )
87
+ count (int): Number of media to retrieve (max: 12 )
80
88
max_id (str): Use for pagination
81
89
82
90
You can use the `max_id` parameter to paginate through the media (take from the `next_max_id` field of the response).
@@ -179,7 +187,7 @@ def get_user_followers(self, user_id, count=12, max_id=None):
179
187
180
188
Args:
181
189
user_id (int): User id
182
- count (int): Number of users to return (max: 100 )
190
+ count (int): Number of users to return (max: 50 )
183
191
max_id (str): Use for pagination
184
192
185
193
You can use the `max_id` parameter to paginate through followers (take from the `next_max_id` field of the response).
@@ -287,14 +295,14 @@ def get_media_info_by_shortcode(self, shortcode):
287
295
288
296
def get_media_likes (self , shortcode , count = 12 , max_id = None ):
289
297
"""
290
- Retrieve media likes by media shortcode.
298
+ Retrieve up to 1000 media likes by media shortcode.
291
299
292
300
Args:
293
301
shortcode (str): Media shortcode
294
- count (int): Number of likers to return (max: 50)
295
- max_id (str): Use for pagination
302
+ count (int): Not supported right now
303
+ max_id (str): Not supported right now
296
304
297
- You can use the `max_id` parameter to paginate through likers (take from the `next_max_id` field of the response) .
305
+ Pagination is not supported for this endpoint .
298
306
299
307
For more information, see documentation: https://docs.rocketapi.io/api/instagram/media/get_likes
300
308
"""
@@ -505,3 +513,47 @@ def get_user_about(self, user_id):
505
513
For more information, see documentation: https://docs.rocketapi.io/api/instagram/user/get_about
506
514
"""
507
515
return self .request ("instagram/user/get_about" , {"id" : user_id })
516
+
517
+ def search_users (self , query ):
518
+ """
519
+ Search for a specific user (max 50 results)
520
+
521
+ Args:
522
+ query (str): The search query
523
+
524
+ For more information, see documentation: https://docs.rocketapi.io/api/instagram/user/search
525
+ """
526
+ return self .request ("instagram/user/search" , {"query" : query })
527
+
528
+ def search_hashtags (self , query ):
529
+ """
530
+ Search for a specific hashtag (max 20 results)
531
+
532
+ Args:
533
+ query (str): The search query
534
+
535
+ For more information, see documentation: https://docs.rocketapi.io/api/instagram/hashtag/search
536
+ """
537
+ return self .request ("instagram/hashtag/search" , {"query" : query })
538
+
539
+ def search_locations (self , query ):
540
+ """
541
+ Search for a specific location (max 20 results)
542
+
543
+ Args:
544
+ query (str): The search query
545
+
546
+ For more information, see documentation: https://docs.rocketapi.io/api/instagram/location/search
547
+ """
548
+ return self .request ("instagram/location/search" , {"query" : query })
549
+
550
+ def search_audios (self , query ):
551
+ """
552
+ Search for a specific audio (max 10 results)
553
+
554
+ Args:
555
+ query (str): The search query
556
+
557
+ For more information, see documentation: https://docs.rocketapi.io/api/instagram/audio/search
558
+ """
559
+ return self .request ("instagram/audio/search" , {"query" : query })
0 commit comments