raiym / instagram-php-scraper
Instagram PHP Scraper. Get account information, photos and videos without any authorization
Installs: 1 012 311
Dependents: 9
Suggesters: 0
Security: 0
Stars: 3 089
Watchers: 159
Forks: 800
Open Issues: 59
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-10-22 23:46:39 UTC
README
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