Exemple #1
0
    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/",
                           {})
Exemple #2
0
    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]
Exemple #3
0
    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"])
Exemple #4
0
    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"]]
Exemple #5
0
    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/", {}))
Exemple #6
0
    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})
Exemple #7
0
    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]