restyler / instagram-php-scraper
Profixied Instagram PHP Scraper. Get account information, photos and videos without any authorization, via smart proxy balancer.
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-proxified
- v2.0.1
- v1.0.3
- v1.0.2
- v1.0.1
- 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
- dev-postaddictme-master
- dev-master
- dev-instaproxy
- dev-dev-proxy
This package is auto-updated.
Last update: 2022-04-29 12:00:19 UTC
README
Getting broken Instagram images when viewed in browser? (Apr 2021)
Take a look at https://github.com/postaddictme/instagram-php-scraper/issues/903#issuecomment-827537360
This repo contains RapidApi proxified version of Instagram scraper https://github.com/postaddictme/instagram-php-scraper due to difficulties with bypassing Instagram firewalls from regular data center ip ranges.
Why not just use residential proxy?
Even good residential proxies are banned by Instagram all the time. This scraper generally works much better than just using residential or mobile proxies with original scraper, because this one uses big network of high quality proxies, and retries and response quality control are handled automatically.
RapidAPI subscription page:
https://rapidapi.com/restyler/api/instagram40
This is a fork. If you need original non-profixied version of scraper, please use original package! https://github.com/postaddictme/instagram-php-scraper
RapidAPI proxy handles balancing and bypasses Instagram firewalls intelligently. Currently only public methods (not requiring auth, like analyzing public accounts and their posts and comments) of API are proxified, since Instagram may track ip addresses of login and mark your account as suspicious when proxy balancer switches ip address. So use withCredentials() with caution. See examples/getAccountByUsername.php and examples/getAccountMediasByUsername.php as safe examples of using proxified version.
Proxified methods:
- getAccount()
- getAccountById()
- getMedias()
- getMediasByTag()
- getMediaByUrl()
- getMediaByCode()
- getCurrentTopMediasByLocationId()
- getCurrentTopMediasByTagName()
- getLocationById()
Dependencies
Code Example
Get account info by instagram user id
require_once 'vendor/autoload.php'; $instagram = new \InstagramScraper\Instagram(new \GuzzleHttp\Client()); $instagram->setRapidApiKey('YOUR-RAPID-API-KEY'); $account = $instagram->getAccountById(3); echo $account->getUsername();
Get account medias by instagram username
$instagram = new \InstagramScraper\Instagram(new \GuzzleHttp\Client()); $instagram->setRapidApiKey('YOUR-RAPID-API-KEY'); $nonPrivateAccountMedias = $instagram->getMedias('kevin'); echo $nonPrivateAccountMedias[0]->getLink();
ATTENTION: do not use this proxified version for authenticated calls via withCredentials() method, please use original scraper instead!
This won't work and throw an exception in a proxified scraper:
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();
Installation
Using composer
composer require guzzlehttp/guzzle restyler/instagram-php-scraper
If you don't have composer
You can download it here.
Examples
See examples here.