Instagram API 有超过 20 张图片

Instagram API with more than 20 images

我想问你,是否有可能使用 API.

从 Instagram 获取超过 20 张全分辨率图像
<script type="text/javascript">
var feed = new Instafeed({
    get: 'user',
    userId: '2201292293',
    clientId: 'MY_CLIENT_ID',
    accessToken:`'MY_ACCESS_TOKEN',
    limit: '364',
    sortBy: 'most-liked',
    template: '<a href="{{image}}" class="popup"><img src="{{image}}"></a>{{likes}}',
    resolution: 'standard_resolution'
});
feed.run();

提前谢谢你,劳伦茨·斯特劳赫

可能是分页导致的

添加

<button id="load-more">
  Load more
</button>

给你的html。每次单击按钮时,都会调用 feed.next() 并获取更多图像(如果存在)。

<script type="text/javascript">
    var loadButton = document.getElementById('load-more');
    var feed = new Instafeed({
        get: 'user',
        userId: '2201292293',
        clientId: 'MY_CLIENT_ID',
        accessToken:`'MY_ACCESS_TOKEN',
        limit: '364',
        sortBy: 'most-liked',
        template: '<a href="{{image}}" class="popup"><img src="{{image}}"></a>{{likes}}',
        resolution: 'standard_resolution'

        // every time we load more, run this function
        after: function() {
            // disable button if no more results to load
            if (!this.hasNext()) {
                loadButton.setAttribute('disabled', 'disabled');
            }
        },
    });

    // bind the load more button
    loadButton.addEventListener('click', function() {
        feed.next();
    });

    // run our feed!
    feed.run();
</script>

试试这个代码。