Skip to content

Commit

Permalink
Merge pull request #1279 from dheeraj009joshi/master
Browse files Browse the repository at this point in the history
added follow/unfollow hashtag
  • Loading branch information
adw0rd authored Apr 20, 2023
2 parents 1347c9f + 5c7d108 commit a30163a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions instagrapi/mixins/hashtag.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,3 +424,38 @@ def hashtag_medias_recent(self, name: str, amount: int = 27) -> List[Media]:
except ClientError:
medias = self.hashtag_medias_recent_v1(name, amount)
return medias



def hashtag_follow(self, hashtag: str, unfollow: bool = False) -> bool:
"""
Follow to hashtag
Parameters
----------
hashtag: str
Unique identifier of a Hashtag
disable: bool, optional
Unfollow when True
Returns
-------
bool
A boolean value
"""
assert self.user_id, "Login required"
name = "unfollow" if unfollow else "follow"
result = self.private_request(f"web/tags/{name}/{hashtag}/")
return result["status"] == "ok"

def hashtag_unfollow(self, hashtag: str) -> bool:
"""
Unfollow to hashtag
Parameters
----------
hashtag: str
Unique identifier of a Hashtag
Returns
-------
bool
A boolean value
"""
return self.hashtag_follow(hashtag, unfollow=True)

0 comments on commit a30163a

Please sign in to comment.