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
881 stars 137 forks source link

Stories are not being retrieved #162

Closed AntonioCS closed 4 years ago

AntonioCS commented 4 years ago

Version(s) affected: 6.6.2

Description
I have the following code:

      $profile = $api->getProfile('brunapetrillo');
      $feedStories = $api->getStories($profile->getId());

      dd($feedStories);

This is returning:

^ Instagram\Model\ProfileStory^ {#687
  -allowedToReply: null
  -owner: null
  -reshareable: null
  -expiringDate: null
  -stories: []
}

Currently this user (https://www.instagram.com/brunapetrillo/) has 9 stories. Unsure if instagram changed something in their api.

UPDATE: Checking the calls on the browser I can see that the QUERY_HASH_STORIES is different from what I see in the code. This is the hash I saw in the request: 303a4ae99711322310f25250d988f3b7

I have updated it manually in the code (on file src/Instagram/Transport/JsonStoriesDataFeed.php) but that have the same empty results unfortunately.

UPDATE 2: Here is the full url: https://www.instagram.com/graphql/query/?query_hash=303a4ae99711322310f25250d988f3b7&variables={%22reel_ids%22:[%226302052%22],%22tag_names%22:[],%22location_ids%22:[],%22highlight_reel_ids%22:[],%22precomposed_overlay%22:false,%22show_story_viewer_list%22:true,%22story_viewer_fetch_count%22:50,%22story_viewer_cursor%22:%22%22,%22stories_video_dash_manifest%22:false}

This was produced by the script but returns nothing (on the script) but if I paste it in the browser I get:

{
    "data": {
        "reels_media": [
            {
                "__typename": "GraphReel",
                "id": "6302052",
                "latest_reel_media": 1604962842,
                "can_reply": true,
                "owner": {
                    "__typename": "GraphUser",
                    "id": "6302052",
                    "profile_pic_url": "https://scontent-lht6-1.cdninstagram.com/v/t51.2885-19/s150x150/121239891_183292949928930_8765189316638782197_n.jpg?_nc_ht=scontent-lht6-1.cdninstagram.com&_nc_ohc=W3ee7ayzB2cAX-yNQf4&_nc_tp=25&oh=031b5a5d0477ce3063c154a141770007&oe=5FD5FD7F",
                    "username": "brunapetrillo",
                    "followed_by_viewer": false,
                    "requested_by_viewer": false
                },
                "can_reshare": true,
.........<more data>......

So the code on my machine is using the new hash but still returning empty results. Might this be something wrong with how the session is maintained in the request? This is what I have for creating the instance: (this is in a function that returns the instance)

            $cachePool = new FilesystemAdapter('Instagram', 0, __DIR__ . '/../../cache');
            $this->instaApi = new InstaAPI($cachePool);
            $this->instaApi->login('username','password');

The cache directory gets created without issues and I see no exceptions.

UPDATE 3: This seems to be a problem with this particular user (https://www.instagram.com/brunapetrillo/) because when I put in a different one I am able to get the stories, even with the other hash tag.. So not sure if this is something to do with the user I am logged in is blocked for brunapetrillo

pgrimaud commented 4 years ago

Hi @AntonioCS

I have not problem to fetch brunapetrillo stories. I tried many times and don't get any error.

Is your logged account following this user?

AntonioCS commented 4 years ago

Apologies for this, might be some issue of my user. I will investigate further. Thanks for the quick reply.

AntonioCS commented 4 years ago

Hello again, Apologies for this, this might have been something completely on my side! Thanks again for the quick reply