我想问你,如果有可能使用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();
提前感谢Laurenz Strauch
答案 0 :(得分:-2)
可能是由分页造成的。
添加
<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>
试试这段代码。