【发布时间】:2018-10-03 15:32:39
【问题描述】:
有没有办法根据http://instagram.com/username 上的公开个人资料页面来确定个人资料是私人的还是公开的。
我知道有很多方法,但它们都需要 CLIENT_ID,我不是在说。我需要一种方法来区分私人和公共个人资料与个人资料网页的来源。
我不介意它是否需要从 Instagram 上抓取数据。
【问题讨论】:
有没有办法根据http://instagram.com/username 上的公开个人资料页面来确定个人资料是私人的还是公开的。
我知道有很多方法,但它们都需要 CLIENT_ID,我不是在说。我需要一种方法来区分私人和公共个人资料与个人资料网页的来源。
我不介意它是否需要从 Instagram 上抓取数据。
【问题讨论】:
如果 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';
}
【讨论】: