MIT License

项目介绍

postaddictme/instagram-php-scraper 是一个托管在 GitHub 上的开源项目,主要使用 PHP 编写,采用 MIT License 许可证,目前获得 3.4k 个 Star、771 次 Fork。

仓库全名
postaddictme/instagram-php-scraper
开源许可证
MIT License
Star 数
3.4k
Fork 数
771
未关闭 Issue
61

README 摘要

Instagram PHP Scraper This library is based on the Instagram web version. We develop it because nowadays it is hard to get an approved Instagram application. The purpose is to support every feature that the web desktop and mobile version support. Dependencies PHP >= 7.2 PSR-16 PSR-18 Code Example Some methods do not require authentication: If you use authentication it is recommended to cache the user session. In…

完整内容见 GitHub 原始 README 或本页 。

常见问题

instagram-php-scraper 用什么语言开发?

主要使用 PHP 编写,采用 MIT License 许可证,目前有 3.4k 个 Star。

instagram-php-scraper 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 instagram-php-scraper 的源码?

可以直接克隆仓库:git clone https://github.com/postaddictme/instagram-php-scraper.git,默认分支为 master;安装与运行步骤见仓库 README。

instagram-php-scraper 最近还在维护吗?

仓库最近一次更新为 2025年5月29日,当前有 61 个未关闭 Issue;Star 数为 3.4k,可作为社区活跃度的参考。

简要分析

热度分
5059
价值分
2258
活跃状态
活跃

语言占比

PHP

Release

README

Instagram PHP Scraper

This library is based on the Instagram web version. We develop it because nowadays it is hard to get an approved Instagram application. The purpose is to support every feature that the web desktop and mobile version support.

Dependencies

Code Example

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();

Some methods do not require authentication:

$instagram = new \InstagramScraper\Instagram(new \GuzzleHttp\Client());
$nonPrivateAccountMedias = $instagram->getMedias('kevin');
echo $nonPrivateAccountMedias[0]->getLink();

If you use authentication it is recommended to cache the user session. In this case you don’t need to run the $instagram->login() method every time your program runs:

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();

Using proxy for requests:

// 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');

Installation

Using composer

composer.phar require raiym/instagram-php-scraper phpfastcache/phpfastcache

or

composer require raiym/instagram-php-scraper phpfastcache/phpfastcache

If you don’t have composer

You can download it here.

Examples

See examples here.

Other

Java library: https://github.com/postaddictme/instagram-java-scraper

评论

暂无评论