【问题标题】:Check if Instagram profile is private without authentication [duplicate]检查Instagram个人资料是否未经身份验证是私人的[重复]
【发布时间】:2018-10-03 15:32:39
【问题描述】:

有没有办法根据http://instagram.com/username 上的公开个人资料页面来确定个人资料是私人的还是公开的。

我知道有很多方法,但它们都需要 CLIENT_ID,我不是在说。我需要一种方法来区分私人和公共个人资料与个人资料网页的来源。

我不介意它是否需要从 Instagram 上抓取数据。

【问题讨论】:

    标签: php api instagram


    【解决方案1】:

    如果 instagram 个人资料是私人的,网页将包含以下文本:"is_private":true

    所以要确定没有client_id 的帐户是私有的,请执行以下操作:

        $instagramPage = strip_tags(file_get_contents('http://instagram.com/raiym'));
        if (strpos($instagramPage,'"is_private":true') !== false) {
            return 'Account is private';
        } else {
            return 'Account is public';
        }
    

    或者你可以使用php库:https://github.com/raiym/instagram-php-scraper

    $instagram = new Instagram();
    $account = $instagram->getAccount('kevin');
    if ($account->isPrivate) {
        echo 'Account is private';
    } else {
        echo 'Account is public';
    }
    

    【讨论】:

      猜你喜欢
      • 2015-06-12
      • 1970-01-01
      • 2018-10-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-01
      • 2011-06-13
      • 2016-11-12
      相关资源
      最近更新 更多