Skip to content

Commit a139016

Browse files
committed
1.0.8
1 parent 3655bde commit a139016

File tree

3 files changed

+41
-5
lines changed

3 files changed

+41
-5
lines changed

rocketapi/instagramapi.py

+34-2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def search(self, query):
4848
- `search_hashtags`
4949
- `search_locations`
5050
- `search_audios`
51+
- `search_clips`
5152
5253
Args:
5354
query (str): The search query
@@ -102,7 +103,7 @@ def get_user_clips(self, user_id, count=12, max_id=None):
102103
103104
Args:
104105
user_id (int): User id
105-
count (int): Number of media to retrieve (max: 50)
106+
count (int): Number of media to retrieve (max: 12)
106107
max_id (str): Use for pagination
107108
108109
You can use the `max_id` parameter to paginate through the media (take from the `max_id` (!) field of the response).
@@ -375,14 +376,15 @@ def get_location_info(self, location_id):
375376
"""
376377
return self.request("instagram/location/get_info", {"id": location_id})
377378

378-
def get_location_media(self, location_id, page=None, max_id=None):
379+
def get_location_media(self, location_id, page=None, max_id=None, tab=None):
379380
"""
380381
Retrieve location media by location id.
381382
382383
Args:
383384
location_id (int): Location id
384385
page (int): Page number
385386
max_id (str): Use for pagination
387+
tab (str): Tab name: recent, ranked (default: recent)
386388
387389
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.
388390
@@ -393,6 +395,8 @@ def get_location_media(self, location_id, page=None, max_id=None):
393395
payload["page"] = page
394396
if max_id is not None:
395397
payload["max_id"] = max_id
398+
if tab is not None:
399+
payload["tab"] = tab
396400
return self.request("instagram/location/get_media", payload)
397401

398402
def get_hashtag_info(self, name):
@@ -500,6 +504,23 @@ def get_audio_media(self, audio_id, max_id=None):
500504
payload["max_id"] = max_id
501505
return self.request("instagram/audio/get_media", payload)
502506

507+
def get_audio_media_by_canonical_id(self, audio_canonical_id, max_id=None):
508+
"""
509+
Retrieve audio media by audio canonical id.
510+
511+
Args:
512+
audio_canonical_id (int): Audio canonical id
513+
max_id (str): Use for pagination
514+
515+
You can use the `max_id` parameter to paginate through media (take from the `next_max_id` field of the response).
516+
517+
For more information, see documentation: https://docs.rocketapi.io/api/instagram/audio/get_media_by_canonical_id
518+
"""
519+
payload = {"id": audio_canonical_id}
520+
if max_id is not None:
521+
payload["max_id"] = max_id
522+
return self.request("instagram/audio/get_media_by_canonical_id", payload)
523+
503524
def get_user_about(self, user_id):
504525
"""
505526
Obtain user details from «About this Account» section.
@@ -557,3 +578,14 @@ def search_audios(self, query):
557578
For more information, see documentation: https://docs.rocketapi.io/api/instagram/audio/search
558579
"""
559580
return self.request("instagram/audio/search", {"query": query})
581+
582+
def search_clips(self, query):
583+
"""
584+
Search for a specific clip with a caption that includes the query (max 12 results)
585+
586+
Args:
587+
query (str): The search query
588+
589+
For more information, see documentation: https://docs.rocketapi.io/api/instagram/media/search_clips
590+
"""
591+
return self.request("instagram/media/search_clips", {"query": query})

rocketapi/rocketapi.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@ 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.8"
1415
self.token = token
1516
self.max_timeout = max_timeout
1617

1718
def request(self, method, data):
1819
return requests.post(
1920
url=self.base_url + method,
2021
json=data,
21-
headers={"Authorization": f"Token {self.token}"},
22+
headers={
23+
"Authorization": f"Token {self.token}",
24+
"User-Agent": f"RocketAPI Python SDK/{self.version}",
25+
},
2226
timeout=self.max_timeout,
2327
).json()

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.7",
6+
version="1.0.8",
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.7.tar.gz",
12+
download_url="https://github.com/rocketapi-io/rocketapi-python/archive/refs/tags/v1.0.8.tar.gz",
1313
install_requires=["requests"],
1414
)

0 commit comments

Comments
 (0)