Skip to content

Instantly share code, notes, and snippets.

@onurmatik
Created November 2, 2017 17:25
Show Gist options
  • Save onurmatik/0ac9ce2bca4dd56a76d3f66da5aaaa45 to your computer and use it in GitHub Desktop.
Save onurmatik/0ac9ce2bca4dd56a76d3f66da5aaaa45 to your computer and use it in GitHub Desktop.
# instagram endpoint that would return the users who have liked a post
endpoint = 'https://www.instagram.com/graphql/query/?query_id=17864450716183058&variables=%s'
likers = []
for shortcode in shortcodes:
url = endpoint % json.dumps({
'shortcode': shortcode,
'first': 1000, # fetch the last 1,000 likers; you should paginate through results to fetch all likers
})
response = requests.get(url)
data = json.loads(response.text)
likers.append([
edge['node']['username'] for edge in data['data']['shortcode_media']['edge_liked_by']['edges']
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment