Is there any way of retrieving a list of poll voters from Instagram stories?
Yes, but not using the Instagram Platform API (via https://www.instagram.com/developer) but rather the new Instagram Graph API
Your account must also be a business account or else you won't have access to the end point.
The endpoint is: /user/stories
and can be found in the following documentation
I hope this helps someone, I wasn't able to find a good answer so here's to knowledge-filling.
To be honest I'm not familiar with the Instagram API,
I tried to find the AJAX request on my story, and find out that it is as follow:
https://www.instagram.com/graphql/query/?query_hash=<_QUERY_HASH_>&variables=%7B%22reel_ids%22%3A%5B%22<_USER_ID_>%22%5D%2C%22tag_names%22%3A%5B%5D%2C%22location_ids%22%3A%5B%5D%2C%22highlight_reel_ids%22%3A%5B%5D%2C%22precomposed_overlay%22%3Afalse%2C%22show_story_viewer_list%22%3Atrue%2C%22story_viewer_fetch_count%22%3A50%2C%22story_viewer_cursor%22%3A%22%22%7D
'variables' is just a URL encode of:
{"reel_ids":["<_USER_ID_>"],"tag_names":[],"location_ids":[],"highlight_reel_ids":[],"precomposed_overlay":false,"show_story_viewer_list":true,"story_viewer_fetch_count":50,"story_viewer_cursor":""}
Note, you need to replace <_USER_ID_> with your user ID, And for me <_QUERY_HASH_> was some constant string,
Then, the response JSON can be parsed using a small Python program:
import json
def parse_instagram_json(json_as_str):
data = json.loads(json_as_str)
if ("data" not in data) or ("reels_media" not in data["data"]):
print "Invalid JSON"
return
for media in data["data"]["reels_media"]:
for media_item in media["items"]:
print "You have {} views".format(media_item["edge_story_media_viewers"]["count"])
viewer = []
for v in media_item["edge_story_media_viewers"]["edges"]:
viewer.append("{} ({})".format(v["node"]["username"], v["node"]["id"]))
if 0 < len(viewer):
print ", ".join(viewer)
I'm not sure if I'm getting the viewer list or the voter list,
The JSON fields suggest it is the former but you can give it a try and maybe it will be what you was looking for...