pgrimaud / instagram-user-feed

This is a scrapper to easily fetch any feed and interact with Instagram (like, follow, etc.) without OAuth for PHP.
MIT License
880 stars 137 forks source link

Error while getting profile data #361

Closed d35k closed 10 months ago

d35k commented 10 months ago

Version(s) affected: ^6.16

Description
We started to get error that shown before. I made little investigation and found that some of the nodes are not send or sent empty.

How to reproduce
This problem occurs while fetching the profile data

Screenshot 2023-12-20 at 20 03 29

image

cookieguru commented 10 months ago

Specifically, this line is failing: https://github.com/pgrimaud/instagram-user-feed/blob/eef6f0b140e5038f178c0c6e18aee01627f2559d/src/Instagram/Hydrator/ProfileHydrator.php#L87

I can confirm that several accounts are missing that property in the $data object. Assuming this change only affects some accounts we'll need some isset() calls around it, until the lib can be upgraded to only allow 8.0.0 or higher and we can use the nullsafe operator


The related function hydrateMedias(): https://github.com/pgrimaud/instagram-user-feed/blob/eef6f0b140e5038f178c0c6e18aee01627f2559d/src/Instagram/Hydrator/ProfileHydrator.php#L73 ...is not failing, but accounts are returning this:

    [edge_owner_to_timeline_media] => stdClass Object
        (
            [count] => 396
            [page_info] => stdClass Object
                (
                    [has_next_page] => 1
                    [end_cursor] =>
                )

            [edges] => Array
                (
                )

        )

So it looks like we're going to need to make more calls to retrieve data

d35k commented 10 months ago

@cookieguru, thank you for fast and detailed response.

First I got this error, I've updated with the nullsafe operator directly in the vendor, and I am happy to help to contribute this package about this issue with a pull request.

Do you have any suggestions in order to receive the account media?

cookieguru commented 10 months ago

Click around in the UI and see which actions get the data, and then incorporate those same calls into the library