How to use Instagram graphql?

后端 未结 1 1942

I\'m using the following query https://www.instagram.com/graphql/query/?query_id=17851374694183129&id={acountId}&first=1000&after={cursor} to get an us

1条回答
  •  梦谈多话
    2021-02-06 14:34

    This query_id code https://www.instagram.com/graphql/query/?query_id=17851374694183129&id=&first=1000&after= 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//?__a=1

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

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

    0 讨论(0)
提交回复
热议问题