Skip to content

Commit 23ada9f

Browse files
committed
1.0.11
1 parent 61d7d34 commit 23ada9f

File tree

3 files changed

+69
-13
lines changed

3 files changed

+69
-13
lines changed

rocketapi/instagramapi.py

+66-10
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,30 @@ def search(self, query):
5757
"""
5858
return self.request("instagram/search", {"query": query})
5959

60+
def get_web_profile_info(self, username):
61+
"""
62+
Retrieve user web profile information by username.
63+
64+
Args:
65+
username (str): Username
66+
67+
For more information, see documentation: https://docs.rocketapi.io/api/instagram/user/get_web_profile_info
68+
"""
69+
return self.request(
70+
"instagram/user/get_web_profile_info", {"username": username}
71+
)
72+
6073
def get_user_info(self, username):
6174
"""
6275
Retrieve user information by username.
76+
This is an alias for get_web_profile_info.
6377
6478
Args:
6579
username (str): Username
6680
6781
For more information, see documentation: https://docs.rocketapi.io/api/instagram/user/get_info
6882
"""
69-
return self.request("instagram/user/get_info", {"username": username})
83+
return self.get_web_profile_info(username)
7084

7185
def get_user_info_by_id(self, user_id):
7286
"""
@@ -97,6 +111,24 @@ def get_user_media(self, user_id, count=12, max_id=None):
97111
payload["max_id"] = max_id
98112
return self.request("instagram/user/get_media", payload)
99113

114+
def get_user_media_by_username(self, username, count=12, max_id=None):
115+
"""
116+
Retrieve user media by username.
117+
118+
Args:
119+
username (str): Username
120+
count (int): Number of media to retrieve (max: 12)
121+
max_id (str): Use for pagination
122+
123+
You can use the `max_id` parameter to paginate through the media (take from the `next_max_id` field of the response).
124+
125+
For more information, see documentation: https://docs.rocketapi.io/api/instagram/user/get_media_by_username
126+
"""
127+
payload = {"username": username, "count": count}
128+
if max_id is not None:
129+
payload["max_id"] = max_id
130+
return self.request("instagram/user/get_media_by_username", payload)
131+
100132
def get_user_clips(self, user_id, count=12, max_id=None):
101133
"""
102134
Retrieve user clips (videos from "Reels" section) by id.
@@ -294,24 +326,39 @@ def get_media_info_by_shortcode(self, shortcode):
294326
"instagram/media/get_info_by_shortcode", {"shortcode": shortcode}
295327
)
296328

297-
def get_media_likes(self, shortcode, count=12, max_id=None):
329+
def get_media_likes_by_shortcode(self, shortcode):
298330
"""
299331
Retrieve up to 1000 media likes by media shortcode.
300332
301333
Args:
302334
shortcode (str): Media shortcode
303-
count (int): Not supported right now
304-
max_id (str): Not supported right now
305335
306336
Pagination is not supported for this endpoint.
307337
308338
For more information, see documentation: https://docs.rocketapi.io/api/instagram/media/get_likes
309339
"""
310-
payload = {"shortcode": shortcode, "count": count}
311-
if max_id is not None:
312-
payload["max_id"] = max_id
340+
payload = {"shortcode": shortcode}
313341
return self.request("instagram/media/get_likes", payload)
314342

343+
def get_media_likes(self, shortcode, count=12, max_id=None):
344+
"""
345+
Retrieve up to 1000 media likes by media shortcode.
346+
This is an alias for get_media_likes_by_shortcode.
347+
348+
Note: The parameters count and max_id are kept for backward compatibility but are no longer supported.
349+
350+
Args:
351+
shortcode (str): Media shortcode
352+
count (int): DEPRECATED - No longer supported
353+
max_id (str): DEPRECATED - No longer supported
354+
355+
Pagination is not supported for this endpoint.
356+
357+
For more information, see documentation: https://docs.rocketapi.io/api/instagram/media/get_likes
358+
"""
359+
# Ignoring count and max_id parameters as they're no longer supported
360+
return self.get_media_likes_by_shortcode(shortcode)
361+
315362
def get_media_likes_by_id(self, media_id):
316363
"""
317364
Retrieve up to 1000 media likes by media id.
@@ -434,14 +481,15 @@ def get_hashtag_info(self, name):
434481
"""
435482
return self.request("instagram/hashtag/get_info", {"name": name})
436483

437-
def get_hashtag_media(self, name, page=None, max_id=None):
484+
def get_hashtag_media(self, name, page=None, max_id=None, tab=None):
438485
"""
439486
Retrieve hashtag media by hashtag name.
440487
441488
Args:
442489
name (str): Hashtag name
443490
page (int): Page number
444491
max_id (str): Use for pagination
492+
tab (str): Tab name: recent, top, or clips (default: recent)
445493
446494
In order to use pagination, you need to use both the `max_id` and `page` parameters. You can obtain these values from the response's `next_page` and `next_max_id` fields.
447495
@@ -452,6 +500,8 @@ def get_hashtag_media(self, name, page=None, max_id=None):
452500
payload["page"] = page
453501
if max_id is not None:
454502
payload["max_id"] = max_id
503+
if tab is not None:
504+
payload["tab"] = tab
455505
return self.request("instagram/hashtag/get_media", payload)
456506

457507
def get_highlight_stories_bulk(self, highlight_ids):
@@ -611,13 +661,19 @@ def search_audios(self, query):
611661
"""
612662
return self.request("instagram/audio/search", {"query": query})
613663

614-
def search_clips(self, query):
664+
def search_clips(self, query, max_id=None):
615665
"""
616666
Search for a specific clip with a caption that includes the query (max 12 results)
617667
618668
Args:
619669
query (str): The search query
670+
max_id (str): Use for pagination
671+
672+
You can use the max_id parameter to paginate through following (take from the reels_max_id field of the response).
620673
621674
For more information, see documentation: https://docs.rocketapi.io/api/instagram/media/search_clips
622675
"""
623-
return self.request("instagram/media/search_clips", {"query": query})
676+
payload = {"query": query}
677+
if max_id is not None:
678+
payload["max_id"] = max_id
679+
return self.request("instagram/media/search_clips", payload)

rocketapi/rocketapi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def __init__(self, token, max_timeout=30):
1111
For more information, see documentation: https://docs.rocketapi.io/api/
1212
"""
1313
self.base_url = "https://v1.rocketapi.io/"
14-
self.version = "1.0.10"
14+
self.version = "1.0.11"
1515
self.token = token
1616
self.max_timeout = max_timeout
1717

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33

44
setuptools.setup(
55
name="rocketapi",
6-
version="1.0.10",
6+
version="1.0.11",
77
author="RocketAPI",
88
author_email="[email protected]",
99
description="RocketAPI Python SDK",
1010
packages=["rocketapi"],
1111
url="https://github.com/rocketapi-io/rocketapi-python",
12-
download_url="https://github.com/rocketapi-io/rocketapi-python/archive/refs/tags/v1.0.10.tar.gz",
12+
download_url="https://github.com/rocketapi-io/rocketapi-python/archive/refs/tags/v1.0.11.tar.gz",
1313
install_requires=["requests"],
1414
)

0 commit comments

Comments
 (0)