【问题标题】:there any way to show more than 20 photos of the instagram API?有什么方法可以显示 20 多张 instagram API 的照片?
【发布时间】:2012-09-20 21:19:21
【问题描述】:

我正在尝试在这样的网站中显示 20 多张照片供稿:

http://snap20.com.br/instagram/

有什么方法可以展示吗?

【问题讨论】:

  • 如果你接受答案,人们会更愿意帮助你...

标签: instagram


【解决方案1】:

简单。只需在您的 api 调用后面附加 &count=-1 即可。 例如:

https://api.instagram.com/v1/tags/YOURTAG/media/recent?access_token=YOURACCESSTOKEN&count=-1

* 2014 年 4 月更新(来源:@user1406691):count=-1 不再可用。回应:

{"meta":{"error_type":"APIInvalidParametersError","code":400,
"error_message":"Count must be larger than zero."}}

您可能希望改用它:

https://api.instagram.com/v1/tags/YOURTAG/media/recent?access_token=YOURACCESSTOKEN&count=35

还有另一种通过 rss + db 的方法,但它更长,虽然它不限于 30 次调用/小时。

【讨论】:

  • 2014 年 4 月 count=-1 被禁用
  • 我不知道从什么时候开始,但现在即使您在 api 调用中输入 count 值,它也会返回最多 33 个结果。我认为最好对下一组结果实施分页。
【解决方案2】:

实际上,有机会获得接下来的 20 张图片,然后再获得接下来的 20 张,以此类推... 在 JSON 响应中有一个“pagination”数组:

 "pagination":{
      "next_max_tag_id":"1411892342253728",
      "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":"1411892342253728",
      "next_min_id":"1414849145899763",
      "min_tag_id":"1414849145899763",
      "next_url":"https:\/\/api.instagram.com\/v1\/tags\/lemonbarclub\/media\/recent?client_id=xxxxxxxxxxxxxxxxxx\u0026max_tag_id=1411892342253728"
 }

这是有关特定 API 调用的信息,对象“next_url”显示获取接下来 20 张图片的 URL,因此只需获取该 URL 并为接下来的 20 张图片调用它...

有关 Instagram API 的更多信息,请查看:https://medium.com/@KevinMcAlear/getting-friendly-with-instagrams-api-abe3b929bc52

【讨论】:

    【解决方案3】:

    Instagram 对其 API 有 20 张图片限制,请查看此线程和我的回答:

    What is the maximum number of requests for Instagram?

    另外,请查看此链接以绕过分页并显示所有结果:

    http://thegregthompson.com/displaying-instagram-images-ignoring-page-pagination/

    【讨论】:

    • 嗯,我可以使用 count= 选项和 client_id= 选项获得更多信息。
    • greg thompson 链接不再有效。如果您找到它,请在此处更新信息,因为每个人似乎都引用了该链接,但没有人总结其内容。
    • 另外值得注意的是,如果您是沙盒,则计数参数中的任何数字都不会让您获得超过前 20 张图像。分页不起作用。
    猜你喜欢
    • 1970-01-01
    • 2014-07-01
    • 2015-08-27
    • 2016-11-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-20
    相关资源
    最近更新 更多