我使用以下查询
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}}
答案 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']