Created
November 2, 2017 17:25
-
-
Save onurmatik/0ac9ce2bca4dd56a76d3f66da5aaaa45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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