2020年instagram api变更后,如何从instagram公共帐户中获取instagram粉丝数量?

2020年instagram api变更后,如何从instagram公共帐户中获取instagram粉丝数量?,instagram,instagram-api,Instagram,Instagram Api,我试图仅使用用户的instagram句柄(又名@myusername)检索追随者数量。我读到了几个答案,你可以访问“https://www.instagram.com/{username}/?\uuu a=1“检索包含所有详细信息的json块。然而,当我在api更改后的2020年尝试这样做时,url只是将我重定向到登录页面 我也看过instagram basic display/graph api,但我似乎找不到一种方法来获取其他用户的关注人数 来自官方ig基本显示api文档: 此api仅允许您

我试图仅使用用户的instagram句柄(又名@myusername)检索追随者数量。我读到了几个答案,你可以访问“https://www.instagram.com/{username}/?\uuu a=1“检索包含所有详细信息的json块。然而,当我在api更改后的2020年尝试这样做时,url只是将我重定向到登录页面

我也看过instagram basic display/graph api,但我似乎找不到一种方法来获取其他用户的关注人数

来自官方ig基本显示api文档:
此api仅允许您获取帐户类型、id、ig id(即将弃用)、媒体计数和用户名。(没有跟随者计数的迹象)

从官方ig graph api文档中:
“API无法访问Intagram消费者帐户(即非商业或非创建者Instagram帐户)。如果您正在为消费者用户构建应用程序,请改用Instagram Basic Display API。”

由于我的程序假设从不一定专业的帐户中检索追随者数量,我似乎不知道该怎么做

总之:

  • 我已经尝试过网络抓取->重定向到登录页面
  • 基本显示api->无法获取跟随者计数
  • Graph api->无法访问消费者帐户
有人能解决这个问题吗

谢谢大家!

您可以使用Python模块。 以下是一个quic示例:

import instaloader
L = instaloader.Instaloader()
user = "IG_USERNAME"
password = "IG_PASSWORD"
L.login(user, password)
profile = instaloader.Profile.from_username(L.context, user)

print(profile.followees) #number of following
print(profile.followers) #number of followers
print(profile.full_name) #full name
print(profile.biography) #bio
print(profile.profile_pic_url)  #profile picture url 
print(profile.get_posts()) #list of posts
print(profile.get_followers()) #list of followers
print(profile.get_followees()) #list of followees

Instagram阻止了你的IP。。。你需要使用未被检测到的代理从Instagram中获取这些信息,通常是通过住宅IP

将HTTP请求发送到IG API end>如果收到JSON响应,则该请求良好且未检测到,否则该请求已检测到代理,且不适用于Instagram

代码(在c#中,但可以遵循python中的相同逻辑):


如果你问为什么Instagram会屏蔽一些IP?Instagram拥有一个庞大的数据库,其中包含过去发送超过允许限制请求的IP。。。他们这样做是为了防止刮伤。

@Hyunk你有什么解决办法吗?嘿@hyun seok cho你找到解决办法了吗?谢谢,我会尽力把结果反馈给你!使用fiddler或类似工具捕获带有状态代码的HTTP响应,查看它们是否仍然阻止您的IP。。。
var httpClientHandler = new HttpClientHandler()
            {
                Proxy = new WebProxy("127.0.0.1:8080", false),
                UseProxy = true
            };

            var client = new HttpClient(handler: httpClientHandler, disposeHandler: true);
            var response = await client.GetAsync("https://www.instagram.com/instagram/?__a=1");

        
            if ( response.Content.Headers.ContentType.MediaType == "application/json")
            {
                // Not detected proxy and good for Instagram

            }
            else
            {
               // Detected proxy and not good for Instagram
            }