nassajis / instagram-php-scraper
Instagram PHP爬虫。无需授权即可获取账户信息、照片和视频
v1.0.2
2018-10-20 15:44 UTC
Requires
- php: >=5.4.0
- ext-curl: *
- ext-json: *
- mashape/unirest-php: 3.0.*
- phpfastcache/phpfastcache: 5.0.*
Requires (Dev)
- phpunit/phpunit: 5.5.*
This package is not auto-updated.
Last update: 2024-09-30 00:47:34 UTC
README
这是从 postaddictme/instagram-php-scraper
仓库分叉而来的。原始描述
这个库基于Instagram网页版。我们开发它是因为现在很难获得Instagram应用程序的批准。目的是支持网页桌面版和移动版支持的所有功能。
代码示例
$instagram = Instagram::withCredentials('username', 'password'); $instagram->login(); $account = $instagram->getAccountById(3); echo $account->getUsername();
一些方法不需要认证
$instagram = new Instagram(); $nonPrivateAccountMedias = $instagram->getMedias('kevin'); echo $nonPrivateAccountMedias[0]->getLink();
如果你使用认证,建议缓存用户会话。在这种情况下,你不需要每次程序运行时都运行 $instagram->login()
方法
$instagram = Instagram::withCredentials('username', 'password', '/path/to/cache/folder/'); $instagram->login(); // will use cached session if you can force login $instagram->login(true) $account = $instagram->getAccountById(3); echo $account->getUsername();
使用代理进行请求
$instagram = new Instagram(); Instagram::setProxy([ 'address' => '0.0.0.0', 'port' => '8080', 'tunnel' => true, 'timeout' => 30, ]); // Request with proxy $account = $instagram->getAccount('kevin'); Instagram::disableProxy(); // Request without proxy $account = $instagram->getAccount('kevin');
安装
使用composer
composer.phar require nassajis/instagram-php-scraper
或者
composer require nassajis/instagram-php-scraper
如果你没有composer
你可以从这里下载它 这里。
示例
查看示例 这里。