raiym / instagram-php-scraper
Instagram PHP 爬虫。无需任何授权即可获取账户信息、照片和视频
v0.12.9
2022-11-19 19:26 UTC
Requires
- php: >=7.2
- ext-curl: *
- ext-json: *
- guzzlehttp/psr7: ^1.7
- psr/http-client: ~1.0
- psr/simple-cache: >=1.0
Requires (Dev)
- guzzlehttp/guzzle: ^7.2
- phpfastcache/phpfastcache: ^7.1
- phpunit/phpunit: ^7.0
- dev-master
- v0.12.9
- v0.12.8
- v0.12.7
- v0.12.6
- v0.12.5
- v0.12.4
- v0.12.3
- v0.12.2
- v0.12.1
- v0.12.0
- v0.11.2
- v0.11.1
- v0.11.0
- v0.10.1
- v0.10.0
- v0.9.14
- v0.9.13
- v0.9.12
- v0.9.11
- v0.9.10
- v0.9.9
- v0.9.8
- v0.9.7
- v0.9.6
- v0.9.5
- v0.9.4
- v0.9.3
- v0.9.2
- v0.9.1
- v0.9.0
- v0.8.35
- v0.8.34
- v0.8.33
- v0.8.32
- v0.8.31
- v0.8.30
- v0.8.29
- v0.8.28
- v0.8.27
- v0.8.26
- v0.8.25
- v0.8.24
- v0.8.23
- v0.8.22
- v0.8.21
- v0.8.20
- v0.8.19
- v0.8.18
- v0.8.17
- v0.8.16
- v0.8.15
- v0.8.14
- v0.8.13
- v0.8.12
- v0.8.11
- v0.8.10
- v0.8.9
- v0.8.8
- v0.8.7
- v0.8.6
- v0.8.5
- v0.8.4
- v0.8.3
- v0.8.2
- v0.8.1
- v0.8.0
- v0.7.2
- v0.7.1
- v0.7.0
- v0.6.1
- v0.6.0
- v0.5.9
- v0.5.8
- v0.5.7
- v0.5.6
- v0.5.5
- v0.5.4
- v0.5.3
- v0.5.2
- v0.5.1
- v0.5.0
- v0.4.8
- v0.4.7
- v0.4.6
- v0.4.5
- v0.4.4
- v0.4.3
- v0.4.2
- v0.4.1
- v0.4.0
- v0.3.5
- v0.3.4
- 0.3.3
- v0.3.2
- v0.3.1
- v0.3.0
- v0.2.6
- v0.2.5
- v0.2.4
- v0.2.3
- v0.2.2
- v0.2.1
- v0.2.0
- v0.1.4
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1.0
- v0.0.6
- v0.0.5
- v0.0.4
- v0.0.3
- v0.0.2
- v0.0.1
This package is auto-updated.
Last update: 2024-09-22 23:38:38 UTC
README
这个库基于 Instagram 网页版本。我们开发它是因为现在很难获得一个批准的 Instagram 应用程序。目的是支持网页桌面和移动版本的所有功能。
依赖
代码示例
use Phpfastcache\Helper\Psr16Adapter; $instagram = \InstagramScraper\Instagram::withCredentials(new \GuzzleHttp\Client(), 'username', 'password', new Psr16Adapter('Files')); $instagram->login(); $account = $instagram->getAccountById(3); echo $account->getUsername();
某些方法不需要认证
$instagram = new \InstagramScraper\Instagram(new \GuzzleHttp\Client()); $nonPrivateAccountMedias = $instagram->getMedias('kevin'); echo $nonPrivateAccountMedias[0]->getLink();
如果您使用认证,建议缓存用户会话。在这种情况下,您不需要每次程序运行时都运行 $instagram->login()
方法
use Phpfastcache\Helper\Psr16Adapter; $instagram = \InstagramScraper\Instagram::withCredentials(new \GuzzleHttp\Client(), 'username', 'password', new Psr16Adapter('Files')); $instagram->login(); // will use cached session if you want to force login $instagram->login(true) $instagram->saveSession(); //DO NOT forget this in order to save the session, otherwise have no sense $account = $instagram->getAccountById(3); echo $account->getUsername();
使用代理请求
// https://docs.guzzlephp.org/en/stable/request-options.html#proxy $instagram = new \InstagramScraper\Instagram(new \GuzzleHttp\Client(['proxy' => 'tcp://localhost:8125'])); // Request with proxy $account = $instagram->getAccount('kevin'); \InstagramScraper\Instagram::setHttpClient(new \GuzzleHttp\Client()); // Request without proxy $account = $instagram->getAccount('kevin');
安装
使用 composer
composer.phar require raiym/instagram-php-scraper phpfastcache/phpfastcache
或
composer require raiym/instagram-php-scraper phpfastcache/phpfastcache
如果您没有 composer
您可以从这里下载它 这里.
示例
查看示例 这里.
其他
Java 库: https://github.com/postaddictme/instagram-java-scraper