如何在full-res中获取Instagram个人资料的个人资料照片? (旧的URL方案今天停止了工作)。
正则表达式=' profile_pic_url_hd":"([0-9A-ZA-Z ._- /:] *)"'
正在为320px图片工作,但没有别的。 150x150 img的前缀不同,但是带jpg的url的ID /结尾是相同的。
由于
答案 0 :(得分:12)
Okay guys I found a final solution:
Get the user_id of the account using this link https://www.instagram.com/{name}/?__a=1
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.
答案 1 :(得分:2)
如果您查看源html并对logging_page_id
运行简单的查找文本搜索,则会有profilePage_
,然后是一个数字。该号码是用户ID。
e.g:
logging_page_id":"profilePage_123456789
用户ID为:123456789
答案 2 :(得分:2)
在Instagram api中更新后,它不再起作用