本文介绍了Instagram ?__a=1&max_id=<end_cursor>不适用于公共用户提要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用 Instagram 未公开的 API https://www.instagram.com/<user>/?__a=1 来获取公共用户提要.

I've been using Instagram's undocumented API https://www.instagram.com/<user>/?__a=1 to get a public user feed.

我还可以通过他们的 max_id 查询参数获取多个页面,如下所示:https://www.instagram.com/<user>/?__a=1&max_id=

I was also able to get multiple pages via their max_id query parameter like so: https://www.instagram.com/<user>/?__a=1&max_id=<end_cursor>

end_cursor = json_response.graphql.user.edge_owner_to_timeline_media.page_info.end_cursor

(是的,has_next_page"为真)

(yes, "has_next_page" is true)

他们最近对 JSON 格式进行了更改,我认为他们可能破坏了其他功能.

They had a recent change to their JSON format and I think they might have broken other functionality.

end_cursor"仍然存在,但是当我使用它时,我只会返回相同的 Instagram 帖子,就好像我没有使用它一样.

The "end_cursor" is still there but when I use it I just get back the same Instagram posts as if I wasn't using it.

为了确保我清楚,我的问题是 max_id= 似乎不再适用于公共用户提要.我仍然可以获得前 12 个帖子,但之后就没有了.

Just to make sure I'm clear, my issue is that the max_id=<end_cursor> doesn't seem to work anymore for a public user feed. I can still get the first 12 posts, but no more after that.

还有其他人看到这个问题吗?

Anyone else seeing this problem?

这是我的意思的 JSFiddle 示例:https://jsfiddle.net/LLsg91ja/33/

here's a JSFiddle example of what I mean:https://jsfiddle.net/LLsg91ja/33/

推荐答案

04-14-2018 - 不再工作 - INSTAGRAM 弃用了'?__a=1' &'?query_id=17888483320059182' - 这不再有效!

04-14-2018 - NO LONGER WORKING - INSTAGRAM DEPRECATED THE '?__a=1' & '?query_id=17888483320059182' - THIS NO LONGER WORKS!

好的,看看这个媒体分页:

Okay take a look at this for media pagination:

https://instagram.com/graphql/query/?query_id=17888483320059182&id=<user_id>&first=12&after=<end_cursor>

返回:

['data']['user']['edge_owner_to_timeline_media']['page_info']['end_cursor']

['data']['user']['edge_owner_to_timeline_media']['page_info']['end_cursor']

和媒体:

['数据']['用户']['edge_owner_to_timeline_media']['edges']

['data']['user']['edge_owner_to_timeline_media']['edges']

'query_id' 现在是静态的,所以只需使用:17888483320059182

the 'query_id' is static now so just use: 17888483320059182

'id' 是instagram 用户 ID",所以你必须使用 ?__a=1 来抓取 ['graphql']['user']['id']

'id' is the "instagram user id" so you have to use ?__a=1 to grab ['graphql']['user']['id']

'first' 是您希望返回的照片数量.只需使用 12 即可保持媒体返回不变.

'first' is the number of photos you desire returned. Just use 12 to keep the media return the same.

'after' 是用于使用的新 'max_id' ['data']['user']['edge_owner_to_timeline_media']['page_info']['end_cursor']

'after' is the new 'max_id' for use ['data']['user']['edge_owner_to_timeline_media']['page_info']['end_cursor']

我会测试更多,稍后回复.

I'll test more and respond later.

稍后回复:

据信使用 ?__a=1 的分页"已被弃用.如果为真,则没有答案可以使用 ?__a=1 为 Instagram 分页解决操作员的直接问题.

It is believed 'pagination' using ?__a=1 has been deprecated. If true then there is no answer which can solve the op's direct question using ?__a=1 for Instagram pagination.

但是此答案中提供的代码将提供 Instagram 媒体的分页,这确实提供了操作员寻求的结果.

But the code provided in this answer will provide the pagination of Instagram media which does provide the results the op was seeking.

答案包含了instagram graphql api",它是当前的 api(而不是 json ?__a=1 hack),所以这个答案现在应该提供一些稳定性.

The answer incorporates the 'instagram graphql api' which is the current api (and not the json ?__a=1 hack) so this answer should provide some stability for now.

在我的实时网站上使用:

As used on my live site:

在 Instagram 媒体请求之前获取 id=:

Grab the id=<instagram_user_id> prior the Instagram media request:

profile = https://www.instagram.com//?__a=1

media = https://instagram.com/graphql/query/?query_id=17888483320059182&id=<profile['graphql']['user']['id']>&first=12&after=

这篇关于Instagram ?__a=1&amp;max_id=&lt;end_cursor&gt;不适用于公共用户提要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 21:25
查看更多