robert-grubb / insta-scraper
Instagram PHP爬虫。无需授权即可获取账户信息、照片和视频
v1.60
2019-08-09 14:41 UTC
Requires
- php: >=5.4.0
- mashape/unirest-php: 3.0.*
- phpfastcache/phpfastcache: 5.0.*
Requires (Dev)
- phpunit/phpunit: 5.5.*
README
感谢postaddictme/instagram-php-scraper提供基础
安装
composer.phar require robert-grubb/insta-scraper
或者
composer require robert-grubb/insta-scraper
实例化
use InstaScraper\Insta;
$Instagram = new Insta();
文档
对于主包文档:https://github.com/postaddictme/instagram-php-scraper
分支信息
此分支包含以下内容
-
getMediaWithTag()
- 此方法将查找具有特定标签的第一条媒体。
-
修复了getMedias问题(因为Instagram删除了/media页面)
- 现在通过graphql请求从他们的时间线数据中拉取,然后抓取每个数组项的数据。(增加加载时间,但不会太多)
-
更好的异常处理
- 为了更好地理解错误发生时实际发生的情况,抛出InstagramEncodedException。您可以捕获此异常并使用
InstagramEncodedException->getDecodedMessage()
,这将返回以下内容
- 为了更好地理解错误发生时实际发生的情况,抛出InstagramEncodedException。您可以捕获此异常并使用
[
[error] => true,
[error_code] => 404,
[error_reason] => 'User does not exist'
]
获取具有特定标签的媒体项
use InstaScraper\Insta;
$Instagram = new Insta();
$post = $Instagram->getMediaWithTag('test', '#awesome');
var_dump($post); // Returns InstaScraper\Model\Media Object