我可以从没有Instagram API或Access令牌的Instagram个人资料中获取图像吗?
您可以获取所有图像。只是迭代它们page_info
。另外,还有一种更方便的获取json的方法:
$otherPage = 'nasa';
$profileUrl = "https://www.instagram.com/$otherPage/?__a=1";
$iterationUrl = $profileUrl;
$tryNext = true;
$limit = 100;
$found = 0;
while ($tryNext) {
$tryNext = false;
$response = file_get_contents($iterationUrl);
if ($response === false) {
break;
}
$data = json_decode($response, true);
if ($data === null) {
break;
}
$media = $data['user']['media'];
$found += count($media['nodes']);
var_dump($media['nodes']);
if ($media['page_info']['has_next_page'] && $found < $limit) {
$iterationUrl = $profileUrl . '&max_id=' . $media['page_info']['end_cursor'];
$tryNext = true;
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句