本文介绍了使用Instagram API获取标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下URL: https://api.instagram.com/v1/tags/snow/media/recent?access_token=x&min_id=x&max_id=x 来获取一些图像及其ID.它工作正常,但是如何获得更多图像?我想要成千上万张图像,但最多只能得到30张.我猜想它与min_id和max_id有关,但是我再也看不到图像了.有人可以帮我吗?

I am trying to use the following URL: https://api.instagram.com/v1/tags/snow/media/recent?access_token=x&min_id=x&max_id=x to fetch some images and their ID's. It's working fine, but how can I have more images? I want thousands of images, but I'm only getting about 30 at most. I'm guessing it has to do with the min_id and max_id, but I can't get any more images. Could anyone help me out?

我发现Instagram的结果数限制为20.是否有任何使用C#的方法可以让我获取较旧的图片,总共获得X张图片?

I found out that Instagram has a 20 result limit. Is there any way using C# that will allow me to fetch older pictures for a total of X amount of pictures?

推荐答案

您将需要在响应中使用分页属性来分页结果.在分页对象中查找next_url属性,以查找下一个要调用的URL.

You will need to use the pagination property in the response for paging through results. Look for the next_url property in the pagination object for the next url to call.

您可以在您的呼叫中添加一个count参数,以指定每个呼叫要接收的记录数.我认为,此count参数的最大值为50(或20),我不记得确切的数字了.

You can add a count parameter to your call to specify the number of records to receive for each call. This count parameter has a maximum value of 50 (or maybe 20) I think, I can't remember the exact number.

因此返回您的前20条记录,然后调用next_url属性以获取指定标签的后20张图像.

So return your first 20 records, then call the next_url property to get the next 20 images for the tag you specified.

查看您从Instagram返回的有关分页属性的回复:

Look in the response you get back from Instagram for the pagination property:

{

    pagination: {"next_max_tag_id": "12345678", "next_max_id": "12345678",
    "next_min_id": "12345678",
    "min_tag_id": "12345678",
    "next_url": "THE URL WILL BE HERE"}

    data: {}

}

这篇关于使用Instagram API获取标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 04:05