我如何从instagram标签中获取下一页数据 [英] How do I get the next page of data from a instagram tag look up
问题描述
我可以输入以下网址以通过/请求以下端点来获取所有带有#losangeles标签的IG帖子:
I can enter the following url to get all the IG posts with the #losangeles tag in them by going/requesting the following endpoint:
https://www.instagram.com/explore/tags/losangeles/?__a=1
在从该URL返回的json数据中,我可以看到page_info属性,并且其中包含has_next_page属性,该属性设置为true.我的问题是如何修改上面的URL以便到达下一页,然后到达下一页,因此直到我检查has_next_page并且它为false.
In the json data returned from this url i can see the page_info attribute and within it there is the has_next_page attribute and that is set equal to true. My question is how do I ammend the above url to get to the next page, and the one after that, and so until I check has_next_page and it is false.
尝试似乎很直观
https://www.instagram.com/explore/tags/losangeles/?__a=2
和
https://www.instagram.com/explore/tags/losangeles/?__b=1
但是似乎都不起作用.我怀疑从原始url返回的数据中的end_cursor属性可能是关于我需要进入下一页的url的线索,但不确定.有人知道该怎么做吗?
But neither seem to work. I suspect maybe the end_cursor attribute in the data returned from the original url may be a clue as to what url I need to go to to get to the next page but am not sure. Does anyone know how to do this?
推荐答案
这是可能的.每个响应都包含一个 end_cursor
参数.在您的下一个请求中,使用 end_cursor
的值添加一个 max_id
参数,如下所示: https://www.instagram.com/explore/tags/losangeles/?__ a = 1& max_id =<值>
.
This is possible. Each response includes an end_cursor
parameter. In your next request add a max_id
parameter using the value of end_cursor
, like so: https://www.instagram.com/explore/tags/losangeles/?__a=1&max_id=<value>
.
我这里有一个用react/axios编写的工作示例: https://codepen.io/ghostreef/pen/ZrKrXX .我的示例来自一个用户帐户,因此我的响应xml是不同的.标签的end_cursor位于 data.graphql.hashtag.edge_hashtag_to_media.page_info.end_cursor
,图像数据位于 data.graphql.hashtag.edge_hashtag_to_media.edges
必须遍历节点.
I have a working example here written in react/axios: https://codepen.io/ghostreef/pen/ZrKrXX. My example pulls from a user account, so my response xml is different. The end_cursor for tags is at data.graphql.hashtag.edge_hashtag_to_media.page_info.end_cursor
and the image data is at data.graphql.hashtag.edge_hashtag_to_media.edges
and you'll have to iterate over the nodes.
这篇关于我如何从instagram标签中获取下一页数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!