Giter VIP home page Giter VIP logo

instagram-php-scraper's Introduction

instagram-php-scraper

Usage

composer require raiym/instagram-php-scraper

use InstagramScraper\Instagram;

Get account info

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

Get account info by userId

$account = Instagram::getAccountById(193886659);
echo $account->username;

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;

Paginate medias

$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);

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

Paginate medias by tag name

$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);

Get top medias by tag name

$medias = Instagram::getTopMediasByTagName('durov');

Get media by id

$media = Instagram::getMediaById(1270593720437182847)

Convert media id 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

Get media comments by shortcode

$comments = Instagram::getMediaCommentsByCode('BG3Iz-No1IZ', 8000);

Get media comments by id

$comments = Instagram::getMediaCommentsById('1130748710921700586', 10000)

Get location id

$medias = Instagram::getLocationById(1);

Get location top medias by location id

$medias = Instagram::getLocationTopMediasById(1);

Get location medias by location id

$medias = Instagram::getLocationMediasById(1);

instagram-php-scraper's People

Contributors

raiym avatar alexpablo avatar wrinkleydog avatar drthief avatar shota avatar 350d avatar

Watchers

James Cloos avatar dev.with avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.