如何使用Instagram graphql?

时间:2017-08-20 21:38:39

标签: 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索引

结果中是否包含query_id的{​​{1}}

1 个答案:

答案 0 :(得分:3)

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

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

https://www.instagram.com/<ig_username>/?__a=1

这是我的RubyOnRails设置:

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

...现在抓住你的变量:

轮廓。[ 'graphql'] [ '用户'] [ 'profile_pic_url']

轮廓。[ 'graphql'] [ '用户'] [ '传记']

轮廓。[ 'graphql'] [ '用户'] [ 'external_url']

轮廓。[ 'graphql'] [ '用户'] [ 'edge_followed_by'] [ '计数']

轮廓。[ 'graphql'] [ '用户'] [ 'edge_follow'] [ '计数']

轮廓。[ 'graphql'] [ '用户'] [ 'ID']

轮廓。[ 'graphql'] [ '用户'] [ 'edge_owner_to_timeline_media'] [ '计数']

轮廓。[ 'graphql'] [ '用户'] [ 'profile_pic_url']

轮廓。[ 'graphql'] [ '用户'] [ 'profile_pic_url_hd']

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