Pagination info missing in instagram api

给你一囗甜甜゛ 提交于 2019-12-23 04:23:01

问题


I am using the most popular api via instagram api In the document, it saying something about pagination and next_url but when I use the link below with my app ID. I don't see any pagination info in the json. Am i missing something? https://api.instagram.com/v1/media/popular?client_id=CLIENT-ID or https://api.instagram.com/v1/media/popular?client_id=CLIENT-ID&count=10


回答1:


you should get the pagination info back in a an object callged "pagination"

"pagination": {
    "next_max_tag_id": "1335465136530",
    "deprecation_warning": "next_max_id and min_id are deprecated for this endpoint; use min_tag_id and max_tag_id instead",
    "next_max_id": "1335465136530",
    "next_min_id": "1335465556125",
    "min_tag_id": "1335465556125",
    "next_url": "https:\/\/api.instagram.com\/v1\/tags\/cats\/media\/recent?callback=jQuery17201362594123929739_1335440328560&_=133544032857&client_id=xxx&max_tag_id=1335465136530"
}

Which has the next_url you are looking for




回答2:


The pagination information will be empty if the requested user's feed has fewer posts than the default query count. In other words, if the instagram account only has five pictures, there is no pagination info.




回答3:


There is not a lot of documentation around pagination on the official API.

Check out this tutorial for more guidance and depth.

http://eduvoyage.com/search-instagram-pagination.html

You need to use the "min_tag_id" and "max_tag_id" to get the images you want.

As your using the endpoint to get popular images, you might want to try something like this. https://api.instagram.com/v1/tags/cats/media/recent?callback=?&client_id=YOURID&max_tag_id=1364206789229

But if you are after a specific tag, try something like this. https://api.instagram.com/v1/tags/cats/media/recent?callback=?&client_id=YOURID&max_tag_id=1364206789229




回答4:


media/popular endpoint does not have a pagination object. As Ryan Ore explained some endpoints provide pagination and some dot not.

You check whether the endpoint has a pagination or not by "pagination": {} object. If the object exists the endpoint has pagination.



来源:https://stackoverflow.com/questions/15504014/pagination-info-missing-in-instagram-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!