Skip to content

Instagram PHP Scraper. Get account information, photos, videos and comments without any authorization

Notifications You must be signed in to change notification settings

tamacroft/instagram-php-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

instagram-php-scraper

Usage

composer require raiym/instagram-php-scraper

use InstagramScraper\Instagram;

$instagram = new Instagram();

Get account info

$account = $instagram->getAccount('kevin');
/*
Available properties: 
    $username;
    $followsCount;
    $followedByCount;
    $profilePicUrl;
    $id;
    $biography;
    $fullName;
    $mediaCount;
    $isPrivate;
    $externalUrl;
*/
echo $account->followedByCount;

Search users by username

$medias = $instagram->searchAccountsByUsername('durov');
echo '<pre>';
echo json_encode($medias);
echo '</pre><br/>';

Get account medias

$medias = $instagram->getMedias('kevin', 150);

/*
Available properties: 
    $id;
    $createdTime;
    $type;
    $link;
    $imageLowResolutionUrl;
    $imageThumbnailUrl;
    $imageStandardResolutionUrl;
    $imageHighResolutionUrl;
    $caption;
    $videoLowResolutionUrl;
    $videoStandardResolutionUrl;
    $videoLowBandwidthUrl;
*/
echo $medias[0]->imageHighResolutionUrl;
echo $medias[0]->caption;

Get media by code

$media = $instagram->getMediaByCode('BDs9iwfL7XA');

Get media by url

$media = $instagram->getMediaByUrl('https://www.instagram.com/p/BDs9iwfL7XA/');
echo $media->owner->username;

Get media by id

$media = $instagram->getMediaById(1042815830884781756);

Search medias by tag name

$medias = $instagram->getMediasByTag('zara', 30);
echo json_encode($medias);

Get top medias by tag name

$medias = $instagram->getTopMediasByTagName('durov');

Convert media it to shortcode

echo 'CODE: ' . Media::getCodeFromId('1270593720437182847_3');
// OR
echo 'CODE: ' . Media::getCodeFromId('1270593720437182847');
// OR
echo 'CODE: ' . Media::getCodeFromId(1270593720437182847);
// CODE: BGiDkHAgBF_
// So you can do like this: instagram.com/p/BGiDkHAgBF_

Convert shortcode to media id

echo 'Media id: ' . Media::getIdFromCode('BGiDkHAgBF_');
// Media id: 1270593720437182847

About

Instagram PHP Scraper. Get account information, photos, videos and comments without any authorization

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 99.9%
  • ApacheConf 0.1%