Instagram粉丝数
问题描述:
几天前,页面https://www.instagram.com/<username>/?__a=1
返回403错误.还有另一种简单的方法来吸引帐户关注者吗?
For few days ago page https://www.instagram.com/<username>/?__a=1
returns 403 error. Is there another easy way to get account followers?
答
这是未记录的终结点之一,必须停止在某个点,因为它不应该公开访问.确实建议不要在应用程序中使用这些未记录的终结点,而应使用Instagram API.
This was one of the undocumented endpoints it has to be stopped at some point because it was not supposed to be accessible to public. It is really recommend to not to use these undocumented endpoints in your app instead use Instagram API.
但是,您可以使用此php解决方案来获取edge_followed_,但我尚未对其进行测试,但是您可以尝试:-
However You can get edge_followed_by using this php solution, I haven't tested it but you can try :-
$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"]["edge_followed_by"]["count"];
}