Instagram Profile Picture in Full-Resolution?

两盒软妹~` 提交于 2019-11-28 06:39:14

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.

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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!