Created
April 6, 2018 13:53
-
-
Save char/4c9daec30c1d066aca5fb988ac870187 to your computer and use it in GitHub Desktop.
Full size Instagram profile picture fetcher
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
#!/usr/bin/env python3 | |
import requests | |
import json | |
def get_pp_url(username): | |
api_response = json.loads(requests.get(f"https://instagram.com/{username}/?__a=1").text) | |
user_id = api_response["graphql"]["user"]["id"] | |
user_api_response = json.loads(requests.get(f"https://i.instagram.com/api/v1/users/{user_id}/info/").text) | |
return user_api_response["user"]["hd_profile_pic_url_info"]["url"] | |
if __name__ == "__main__": | |
from optparse import OptionParser | |
(options, args) = OptionParser().parse_args() | |
username = " ".join(args) | |
print(get_pp_url(username)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment