How to use Instagram graphql?

若如初见. 提交于 2019-12-03 09:44:54

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.

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

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

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']

And your followed_by_count is now ['graphql']['user']['edge_followed_by']['count']

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!