composer require raiym/instagram-php-scraper
use InstagramScraper\Instagram;
$account = Instagram::getAccount('kevin');
/*
Available properties:
$username;
$followsCount;
$followedByCount;
$profilePicUrl;
$id;
$biography;
$fullName;
$mediaCount;
$isPrivate;
$externalUrl;
*/
echo $account->followedByCount;
$account = Instagram::getAccountById(193886659);
echo $account->username;
$medias = Instagram::searchAccountsByUsername('durov');
echo '<pre>';
echo json_encode($medias);
echo '</pre><br/>';
$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;
$result = Instagram::getPaginateMedias('kevin');
$medias = $result['medias']
if($result['hasNextPage'] === true) {
$result = Instagram::getPaginateMedias('kevin', $result['maxId']);
$medias = array_merge($medias, $result['medias']);
}
echo json_encode($medias);
$media = Instagram::getMediaByCode('BDs9iwfL7XA');
$media = Instagram::getMediaByUrl('https://www.instagram.com/p/BDs9iwfL7XA/');
echo $media->owner->username;
$media = Instagram::getMediaById(1042815830884781756);
$medias = Instagram::getMediasByTag('zara', 30);
echo json_encode($medias);
$result = Instagram::getPaginateMediasByTag('zara');
$medias = $result['medias']
if($result['hasNextPage'] === true) {
$result = Instagram::getPaginateMediasByTag('zara', $result['maxId']);
$medias = array_merge($medias, $result['medias']);
}
echo json_encode($medias);
$medias = Instagram::getTopMediasByTagName('durov');
$media = Instagram::getMediaById(1270593720437182847)
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_
echo 'Media id: ' . Media::getIdFromCode('BGiDkHAgBF_');
// Media id: 1270593720437182847
$comments = Instagram::getMediaCommentsByCode('BG3Iz-No1IZ', 8000);
$comments = Instagram::getMediaCommentsById('1130748710921700586', 10000)
$medias = Instagram::getLocationById(1);
$medias = Instagram::getLocationTopMediasById(1);
$medias = Instagram::getLocationMediasById(1);