forked from postaddictme/instagram-php-scraper
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from postaddictme/master
Update with fork origin
- Loading branch information
Showing
18 changed files
with
1,045 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
require __DIR__ . '/../vendor/autoload.php'; | ||
|
||
$instagram = \InstagramScraper\Instagram::withCredentials('username', 'password', 'path/to/cache/folder'); | ||
$instagram->login(); | ||
sleep(2); // Delay to mimic user | ||
|
||
$username = 'kevin'; | ||
$followers = []; | ||
$account = $instagram->getAccount($username); | ||
sleep(1); | ||
$followers = $instagram->getFollowing($account->getId(), 1000, 100, true); // Get 1000 followings of 'kevin', 100 a time with random delay between requests | ||
echo '<pre>' . json_encode($followers, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . '</pre>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
require __DIR__ . '/../vendor/autoload.php'; | ||
|
||
function printMediaInfo(\InstagramScraper\Model\Media $media, $padding = '') { | ||
echo "${padding}Id: {$media->getId()}\n"; | ||
echo "${padding}Shotrcode: {$media->getShortCode()}\n"; | ||
echo "${padding}Created at: {$media->getCreatedTime()}\n"; | ||
echo "${padding}Caption: {$media->getCaption()}\n"; | ||
echo "${padding}Number of comments: {$media->getCommentsCount()}\n"; | ||
echo "${padding}Number of likes: {$media->getLikesCount()}\n"; | ||
echo "${padding}Get link: {$media->getLink()}\n"; | ||
echo "${padding}High resolution image: {$media->getImageHighResolutionUrl()}\n"; | ||
echo "${padding}Media type (video/image/sidecar): {$media->getType()}\n"; | ||
} | ||
|
||
// If account is public you can query Instagram without auth | ||
$instagram = new \InstagramScraper\Instagram(); | ||
|
||
// If account is private and you subscribed to it firstly login | ||
$instagram = \InstagramScraper\Instagram::withCredentials('username', 'password', '/path/to/cache/folder'); | ||
$instagram->login(); | ||
|
||
$media = $instagram->getMediaByUrl('https://www.instagram.com/p/BQ0lhTeAYo5'); | ||
echo "Media info:\n"; | ||
printMediaInfo($media); | ||
|
||
$padding = ' '; | ||
echo "Sidecar medias info:\n"; | ||
foreach ($media->getSidecarMedias() as $sidecarMedia) { | ||
printMediaInfo($sidecarMedia, $padding); | ||
echo "\n"; | ||
} | ||
|
||
$account = $media->getOwner(); | ||
echo "Account info:\n"; | ||
echo "Id: {$account->getId()}\n"; | ||
echo "Username: {$account->getUsername()}\n"; | ||
echo "Full name: {$account->getFullName()}\n"; | ||
echo "Profile pic url: {$account->getProfilePicUrl()}\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
require __DIR__ . '/../vendor/autoload.php'; | ||
|
||
$instagram = \InstagramScraper\Instagram::withCredentials('username', 'password', '/path/to/cache/folder'); | ||
$instagram->login(); | ||
|
||
$stories = $instagram->getStories(); | ||
print_r($stories); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
<?php | ||
|
||
require_once __DIR__ . '/InstagramScraper/Instagram.php'; | ||
require_once __DIR__ . '/InstagramScraper/Endpoints.php'; | ||
require_once __DIR__ . '/InstagramScraper/InstagramQueryId.php'; | ||
require_once __DIR__ . '/InstagramScraper/Traits/ArrayLikeTrait.php'; | ||
require_once __DIR__ . '/InstagramScraper/Traits/InitializerTrait.php'; | ||
require_once __DIR__ . '/InstagramScraper/Model/AbstractModel.php'; | ||
require_once __DIR__ . '/InstagramScraper/Model/Account.php'; | ||
require_once __DIR__ . '/InstagramScraper/Model/CarouselMedia.php'; | ||
require_once __DIR__ . '/InstagramScraper/Model/Comment.php'; | ||
require_once __DIR__ . '/InstagramScraper/Model/Location.php'; | ||
require_once __DIR__ . '/InstagramScraper/Model/Media.php'; | ||
require_once __DIR__ . '/InstagramScraper/Model/Tag.php'; | ||
require_once __DIR__ . '/InstagramScraper/Model/AbstractModel.php'; | ||
require_once __DIR__ . '/InstagramScraper/Exception/InstagramException.php'; | ||
require_once __DIR__ . '/InstagramScraper/Exception/InstagramAuthException.php'; | ||
require_once __DIR__ . '/InstagramScraper/Exception/InstagramNotFoundException.php'; | ||
require_once __DIR__ . '/InstagramScraper/Traits/ArrayLikeTrait.php'; | ||
require_once __DIR__ . '/InstagramScraper/Traits/InitializerTrait.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.