我可以通過公共API獲取Instagram的照片與下面的代碼(如How to get all images of hashtag in Instagram without API?看到)獲取所有用戶的媒體 - Instagram的
<?php
$baseUrl = 'https://www.instagram.com/explore/tags/girls/?__a=1';
$url = $baseUrl;
while(1) {
$json = json_decode(file_get_contents($url));
print_r($json->tag->media->nodes);
if(!$json->tag->media->page_info->has_next_page) break;
$url = $baseUrl.'&max_id='.$json->tag->media->page_info->end_cursor;
}
然而,這個代碼返回給我的只有95媒體,即使用戶有1000+媒體(任何用戶)
有什麼問題嗎?
感謝
將字面上的所有媒體發送給你的開銷成本對於instagram來說是不值得的。我認爲95應該足夠多,但是應該有一種通過它分頁的方式。你知道他是如何獲得這種聯繫的,我從來沒有見過它。 – Neil
不要重新發明輪子:https://github.com/postaddictme/instagram-php-scraper –
嗯...我會看看。謝謝:) –