def delete_comment(self, media, comment): media_id = to_media_id(media) comment_id = to_comment_id(comment) log.debug(f"delete_comment with media_id={media_id} and " f"comment_id={comment_id}") self._send_request(f"media/{media_id}/comment/{comment_id}/delete/", {})
def get_media_comments(self, media, pages=1): media_id = to_media_id(media) log.debug(f"get_media_comments for media_id={media_id}, pages={pages}") url = f"media/{media_id}/comments/?" comments = self._load_items(url, pages, "comments") return [types.InstagramComment(comment) for comment in comments]
def add_comment(self, media, text): media_id = to_media_id(media) log.debug(f"add_comment to media_id{media_id} with text '{text}'") _, raw = self._send_request(f"media/{media_id}/comment/", {'comment_text': text}) return types.InstagramComment(raw["comment"])
def get_media(self, media): media_id = to_media_id(media) log.debug(f"get_media for media_id={media_id}") _, raw = self._send_request(f"media/{media_id}/info/") return [types.InstagramMedia(item) for item in raw["items"]]
def delete_like(self, media): media_id = to_media_id(media) log.debug(f"delete_like for media_id={media_id}") print(self._send_request(f"media/{media_id}/unlike/", {}))
def add_like(self, media): media_id = to_media_id(media) log.debug(f"add_like for media_id={media_id}") self._send_request(f"media/{media_id}/like/", {'media_id': media_id})
def get_media_likers(self, media): media_id = to_media_id(media) log.debug(f"get_media_likers for media_id={media_id}") likers = self._send_request('media/{media_id}/likers/?') return [types.InstagramUser(liker) for liker in likers]