Created
January 25, 2020 18:20
-
-
Save ig0r74/f29bdf1389d9e2c14279a891b8aadb35 to your computer and use it in GitHub Desktop.
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
<?php | |
require MODX_CORE_PATH . 'components/modinstagram/vendor/autoload.php'; | |
use Phpfastcache\Helper\Psr16Adapter; | |
// If account is public you can query Instagram without auth | |
$instagram = \InstagramScraper\Instagram::withCredentials('user', 'password', new Psr16Adapter('Files')); | |
$instagram->login(); | |
$account = $instagram->getAccount('ig0r74'); | |
// Available fields | |
echo "Account info:\n"; | |
echo "Id: {$account->getId()}\n"; | |
echo "Username: {$account->getUsername()}\n"; | |
echo "Full name: {$account->getFullName()}\n"; | |
echo "Biography: {$account->getBiography()}\n"; | |
echo "Profile picture url: {$account->getProfilePicUrl()}\n"; | |
echo "External link: {$account->getExternalUrl()}\n"; | |
echo "Number of published posts: {$account->getMediaCount()}\n"; | |
echo "Number of followers: {$account->getFollowsCount()}\n"; | |
echo "Number of follows: {$account->getFollowedByCount()}\n"; | |
echo "Is private: {$account->isPrivate()}\n"; | |
echo "Is verified: {$account->isVerified()}\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment