Instagram个人资料图片是否具有完整分辨率? [英] Instagram Profile Picture in Full-Resolution?

查看:114
本文介绍了Instagram个人资料图片是否具有完整分辨率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取完整分辨率的instagram个人资料的个人资料图片? (旧的URL方案今天停止工作.)

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 ._-/:] *),'

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

正在处理320像素的图片,但仅此而已. 150x150 img的前缀不同,但是带有jpg的URL的ID/结尾是相同的.

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.

谢谢

推荐答案

好的,我找到了最终解决方案:

Okay guys I found a final solution:

  1. 使用此链接user_id noreferrer> https://www.instagram.com/{name}/?__ a = 1

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

使用上面 https://i.instagram.com/api/v1/users/{user_id}/info/ 完整的个人资料图片链接可以在 [hd_profile_pic_url_info] [url]

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]

就是这样! :)

如果步骤 1 不起作用,我的PHP解决方案将获取用户ID :

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"];
}

我正在HTML文档中搜索用户ID.

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

这篇关于Instagram个人资料图片是否具有完整分辨率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆