获取所有用户媒体 - Instagram

时间:2017-03-09 23:51:31

标签: php instagram instagram-api

我可以使用以下代码通过公共API获取Instagram照片(如How to get all images of hashtag in Instagram without API?中所示)

<?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多个媒体(任何用户)

有什么问题?

由于

1 个答案:

答案 0 :(得分:2)

为什么不使用instagram-php-scraper

您可以通过//I think these variable declarations,first allocate fuzz & buzz memory //,then execute assignment.so const fuzz=buzz can works //,because buzz be found in memory const fuzz = buzz;//undefined const buzz = 'buzz'; //in this case,buzz has not allocate memory,so it can't be found by assignment. const fuzz = buzz;//throws an exception: fuzz is not defined 进行安装。在服务器上创建一个新目录,并在控制台上键入以下内容:

composer

然后简单地使用:

composer require raiym/instagram-php-scraper

检查所有可用的方法:

https://github.com/postaddictme/instagram-php-scraper/blob/master/README.md