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

查看:107
本文介绍了如何使用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?

推荐答案

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/<ig_username>/?__a=1

这是我的RubyOnRails设置:

Here is my RubyOnRails setup:

profile = JSON.parse(open("https://www.instagram.com/<ig_username>/?__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天全站免登陆