ping / instagram_private_api

A Python library to access Instagram's private API.
MIT License
2.95k stars 612 forks source link

Implementation of "storyPollVoters" method #366

Closed Rotzke closed 2 years ago

Rotzke commented 2 years ago

Which client are you using?


Describe your Question/Issue:

Hi! First of all, thanks a lot for you library, it helps a lot.

I am in need of using the storyPollVoters endpoint to gather all voters of particular story, but was only able to find a story_viewers method, which is the closest match to what I am looking for.

I was wondering if you are planning to implement the endpoint or I can do a PR with it, and if you know at least the exact endpoint on private API of Instagram to get the data? Because call to reels_tray returns max_id param for voters, so I guess Instagram supports the pagination and endpoint for polls (or direct for polls' voters).

Thanks in advance for your answer!

UPDATE: the endpoint is /api/v1/media/${mediaId}/${pollId}/story_poll_vote/


Rotzke commented 2 years ago

So, I can not create a branch, but the task is done, will just leave it here if someone needs it as well:

Path: instagram_private_api/endpoints/media.py Code:

def story_voters(self, media_id, poll_id, **kwargs):
    """
    Get list of story' poll voters

    :param media_id: ID of the media (story)
    :param poll_id: ID of the poll
    :param kwargs:
        **max_id**: For pagination
    :return:
    """
    endpoint = 'media/{media_id!s}/{poll_id!s}/story_poll_voters/'.format(
        media_id=media_id,
        poll_id=poll_id)
    return self._call_api(endpoint, query=kwargs)