-
-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
2,052 additions
and
1,241 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Instagram\Api; | ||
use Instagram\Exception\InstagramException; | ||
|
||
use Psr\Cache\CacheException; | ||
use Symfony\Component\Cache\Adapter\FilesystemAdapter; | ||
|
||
require realpath(dirname(__FILE__)) . '/../vendor/autoload.php'; | ||
$credentials = include_once realpath(dirname(__FILE__)) . '/credentials.php'; | ||
|
||
$cachePool = new FilesystemAdapter('Instagram', 0, __DIR__ . '/../cache'); | ||
|
||
try { | ||
$api = new Api($cachePool); | ||
$api->login($credentials->getLogin(), $credentials->getPassword()); | ||
|
||
$profile = $api->getProfile('wendyswan'); | ||
|
||
printIgtvs($profile->getIgtvs()); | ||
|
||
do { | ||
$profile = $api->getMoreIgtvs($profile); | ||
printIgtvs($profile->getIgtvs()); | ||
|
||
// avoid 429 Rate limit from Instagram | ||
sleep(1); | ||
} while ($profile->hasMoreIgtvs()); | ||
|
||
} catch (InstagramException $e) { | ||
print_r($e->getMessage()); | ||
} catch (CacheException $e) { | ||
print_r($e->getMessage()); | ||
} | ||
|
||
function printIgtvs(array $medias) | ||
{ | ||
foreach ($medias as $media) { | ||
echo 'ID : ' . $media->getId() . "\n"; | ||
echo 'Caption : ' . $media->getCaption() . "\n"; | ||
echo 'Link : ' . $media->getLink() . "\n"; | ||
echo 'Likes : ' . $media->getLikes() . "\n"; | ||
echo 'Date : ' . $media->getDate()->format('Y-m-d h:i:s') . "\n\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
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Instagram\Model; | ||
|
||
class Comment | ||
|
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,5 +1,7 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Instagram\Model; | ||
|
||
use Instagram\Utils\InstagramHelper; | ||
|
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Instagram\Model; | ||
|
||
class Reels | ||
|
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
Oops, something went wrong.