NicklasWallgren / instagram-api

Instagram Private API
MIT License
147 stars 46 forks source link

how get user media(post) count #72

Open mohammad-rj opened 2 years ago

mohammad-rj commented 2 years ago

i get this response with trying getUser(), i need count post of user. how can get that? i can feed by user and loop until end and counting media but this is a bad solution, is there any other way ?

Instagram\SDK\Response\Responses\Users\UserInformationResponse Object
(
    [user:Instagram\SDK\Response\Responses\Users\UserInformationResponse:private] => Instagram\SDK\Response\DTO\General\User Object
        (
            [id:Instagram\SDK\Response\DTO\General\User:private] => 7431104989
            [username:Instagram\SDK\Response\DTO\General\User:private] => krammpus_nacht
            [fullName:Instagram\SDK\Response\DTO\General\User:private] => Krammpus Nacht
            [isPrivate:Instagram\SDK\Response\DTO\General\User:private] =>
            [profilePictureUrl:Instagram\SDK\Response\DTO\General\User:private] =>
            [friendshipStatus:Instagram\SDK\Response\DTO\General\User:private] =>
            [isVerified:Instagram\SDK\Response\DTO\General\User:private] =>
            [hasAnonymousProfilePicture:Instagram\SDK\Response\DTO\General\User:private] =>
            [followerCount:Instagram\SDK\Response\DTO\General\User:private] => 908
            [followingCount:Instagram\SDK\Response\DTO\General\User:private] => 475
            [client:Instagram\SDK\Response\DTO\General\User:private] => Instagram\SDK\Client\Client Object
                (
                )

        )

    [client:Instagram\SDK\Response\Responses\Users\UserInformationResponse:private] => Instagram\SDK\Client\Client Object
        (
        )

    [status:protected] => ok
    [errorType:protected] =>
    [message:protected] =>
    [invalidCredentials:protected] =>
)
AndersonRezende commented 2 years ago

I got it using the following command: sizeof($instagram->feedByUser($instagram->userByName("username")->getUser()->getId())->getItems());