如何使用 Instagram graphql? [英] How to use Instagram graphql?

查看:23
本文介绍了如何使用 Instagram graphql?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下查询https://www.instagram.com/graphql/query/?query_id=17851374694183129&id={acountId}&first=1000&after={cursor}获得用户关注者.我需要的信息是 followed_by_count 索引,该索引仅在 https://www.instagram.com/{username}?__a=1

I'm using the following query https://www.instagram.com/graphql/query/?query_id=17851374694183129&id={acountId}&first=1000&after={cursor} to get an user followers. The information I need is the followed_by_count index that's only available per user on https://www.instagram.com/{username}?__a=1

结果中是否有包含 followed_by_countquery_id?

Is there a query_id that includes the followed_by_count in the result?

推荐答案

这个query_id代码https://www.instagram.com/graphql/query/?query_id=17851374694183129&id=<user_id>&first=1000&after=<end_cursor> 旨在仅返回不包括用户个人资料数据的媒体数据.

This query_id code https://www.instagram.com/graphql/query/?query_id=17851374694183129&id=<user_id>&first=1000&after=<end_cursor> is designed to return ONLY media data it does NOT include user profile data.

最简单的解决方案是使用 IG 在初始页面请求上使用的内容:

The simplest solution is to use what IG uses on initial page requests:

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

这是我的 RubyOnRails 设置:

Here is my RubyOnRails setup:

profile = JSON.parse(open("https://www.instagram.com//?__a=1").read)

...现在获取您的变量:

... now grab your variables:

profile.['graphql']['user']['profile_pic_url']
 
profile.['graphql']['user']['biography']

profile.['graphql']['user']['external_url']

profile.['graphql']['user']['edge_followed_by']['count']

profile.['graphql']['user']['edge_follow']['count']

profile.['graphql']['user']['id']

profile.['graphql']['user']['edge_owner_to_timeline_media']['count']

profile.['graphql']['user']['profile_pic_url']

profile.['graphql']['user']['profile_pic_url_hd']

你的 followed_by_count 现在是 ['graphql']['user']['edge_followed_by']['count']

这篇关于如何使用 Instagram graphql?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆