Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Instagram Profile Picture in Full-Resolution?

Tags:

instagram

how do I get the profile picture of an instagram profile in full-res? (The old URL scheme stopped working today).

regex='profile_pic_url_hd":"([0-9a-zA-Z._-/:]*)",'

Is working for 320px pictures, but nothing else. The prefix to the 150x150 img is different, but the ID/ending of the url with jpg is the same.

Thanks

like image 651
Simon Avatar asked Mar 23 '18 21:03

Simon


People also ask

How do you make your profile picture full resolution on Instagram?

Go to Instagram's website on your mobile or PC browser (any browser will work), and then log in with your credentials. As you can't click on a picture directly from your feed, visit the user's profile, and then open the photo that you want to see. Hit Enter, and you'll see the picture in full size.

What resolution is Instagram profile picture?

Instagram profile picture size: 320 x 320 pixels Instagram profile photos are displayed at 110 x 100 pixels, but the image files are stored at 320 x 320 pixels, so make sure to upload an image that's least that big. Even though the dimensions are in a square format, Instagram profile photos are displayed as a circle.


2 Answers

Okay guys I found a final solution:

  1. Get the user_id of the account using this link https://www.instagram.com/{name}/?__a=1

  2. Visit this JSON-API with the user_id above https://i.instagram.com/api/v1/users/{user_id}/info/ The full size profile picture link can be found in [hd_profile_pic_url_info][url]

Thats it! :)

[EDIT]

If step 1 doesn't work, my Php solution to get the user-id:

$name = "{username}";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.instagram.com/$name/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
$http = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if($http=="200") {
  $doc = new DOMDocument();
  $doc->loadHTML($result);
  $xpath = new DOMXPath($doc);
  $js = $xpath->query('//body/script[@type="text/javascript"]')->item(0)->nodeValue;
  $start = strpos($js, '{');
  $end = strrpos($js, ';');
  $json = substr($js, $start, $end - $start);
  $data = json_decode($json, true);
  $user_id = $data["entry_data"]["ProfilePage"][0]["graphql"]["user"]["id"];
}

I'm searching in the HTML document for user-id.

like image 170
xC0dex Avatar answered Oct 24 '22 00:10

xC0dex


If you view the source html and run a simple find text search for logging_page_id, it will have profilePage_, then a number. That number is the user id.

e.g.:

logging_page_id":"profilePage_123456789

The user id is: 123456789

like image 44
bax Avatar answered Oct 24 '22 00:10

bax