Profixied Instagram PHP Scraper. Get account information, photos and videos without any authorization, via smart proxy balancer.


This repo contains RapidApi proxified version of Instagram 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:

This is a fork. If you need original non-profixied version of scraper, please use original package!

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


Code Example

$instagram = \InstagramScraper\Instagram();
$account = $instagram->getAccountById(3);
echo $account->getUsername();

Some methods do not require authentication:

$instagram = new \InstagramScraper\Instagram();
$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('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 (not needed for public endpoints like getAccount() and getMedias() since they go through RapidAPI, so only makes sense for private endpoints requiring login):

$instagram = new \InstagramScraper\Instagram();
    'address' => '',
    'port'    => '8080',
    'tunnel'  => true,
    'timeout' => 30,
// Request with proxy
$account = $instagram->getAccount('kevin');
// Request without proxy
$account = $instagram->getAccount('kevin');


Using composer

composer require restyler/instagram-php-scraper

If you don't have composer

You can download it here.


See examples here.