instagram-user-feed
instagram-user-feed copied to clipboard
Error when using getProfile()
Version(s) affected: 6.13
Description
Instagram\Exception\InstagramFetchException : Profile #2 : Unable to extract JSON data
at /app/vendor/pgrimaud/instagram-user-feed/src/Instagram/Transport/HtmlProfileDataFeed.php:64 60| 61| preg_match('/
64| throw new InstagramFetchException('Profile #2 : Unable to extract JSON data'); 65| } 66| 67| $data = json_decode($matches[1], false); 68|
This error was related to the Instagram profile you use to log in. You need to go to Instagram and check what it is connected with. In my case, when logging in, Instagram opened a modal window with a choice of date of birth, this was the problem
I am getting Profile #1 : Unable to extract JSON data :(
Hello,
I have the same issue since yesterday 8PM : Profile #1 : Unable to extract JSON data
(local environment and production server)
After investigation, it comes from this regex in /app/vendor/pgrimaud/instagram-user-feed/src/Instagram/Transport/HtmlProfileDataFeed.php:45
:
preg_match('/<script type="text\/javascript">window\._sharedData\s?=(.+);<\/script>/', $html, $matches);
- When I try to dump the HTML it parses ($html), I cannot found the string "_sharedData"
- I tried to go on the same URL myself with a browser and cannot find the string "_sharedData" either in the source code
Maybe Instagram updated its website and the regex should be updated ?
Hi, I have the same issue! I checked the above idea but I couldn't find a solution.
Hi Team, Even am facing same issue "Unable to extract JSON data" . Kindly let me know if any solution or update
Hello, I have the same issue since yesterday 8PM :
Profile #1 : Unable to extract JSON data
(local environment and production server) After investigation, it comes from this regex in/app/vendor/pgrimaud/instagram-user-feed/src/Instagram/Transport/HtmlProfileDataFeed.php:45
:
preg_match('/<script type="text\/javascript">window\._sharedData\s?=(.+);<\/script>/', $html, $matches);
- When I try to dump the HTML it parses ($html), I cannot found the string "_sharedData"
- I tried to go on the same URL myself with a browser and cannot find the string "_sharedData" either in the source code
Maybe Instagram updated its website and the regex should be updated ?
Yep, came to the exact same conclusion - following for updates. Will let you know also what I discover, if anything.
Some more information. I was using version 6.2.2 and currently scraping two accounts is failing with this error - three accounts are not. We scrape once every two hours. I then upgraded to the latest (currently 6.13.1) and while this did not solve it it did lead me to discover something that may help.
I found that with version 6.2.2 I am able to scrape this account https://www.instagram.com/bulletproofconvertible, but with 6.13.1 I am not (I get this same "Unable to extract JSON data" error)
However, regardless of which version I use I am unable to scrape my own feed https://www.instagram.com/gurubobnz, which gives the same message.
I have logged onto the Instagram account that I am using as the scraper and there are no alerts or requirements for date of birth of any other thing I can see that might affect this.
Some more information. We scrape the following URL's:
- https://www.instagram.com/falloonbuilders
- https://www.instagram.com/coach_jesse_the_body_architect
- https://www.instagram.com/bowalleyfreerange
- https://www.instagram.com/bulletproofconvertible
- https://www.instagram.com/snuggle_me_tight_baby_gifts
- https://www.instagram.com/roslynphysio
I upgraded to 6.13.1 and ALL of the above started to fail. Then when I rolled back to 6.2.2 the first four came right, with the final two still failing for the same reason. Perhaps this list will be helpful for someone else to verify whether they can or can't scrape those feeds.
These are listed in chronological order of when we set up the scraper. It may just be coincidence but it is the last two on the list that are failing - again, with 6.2.2 and 6.13.1. Surely if there is a chronological reason it's not to do with when we set up, but may have something to do with the creation date of the instagram account. Could be way off the mark, just throwing that out there as a possibility.
Hey @gurubobnz
I just release a new version (6.15.0). I updated getProfile()
method with last Instagram changes.
Could you try it?
Thanks
Hi, thank you for your prompt attention!
Yes, this has fixed the problem for me - all feeds that I listed above are now loading just fine.
Thanks heaps.
Glad to read it. :D
One final question please - even though 6.15.0 is the latest release on GitHub, when I install using composer I get 6.13.1 - is there a missing step to publish the latest version to the packagist database? I see that on https://packagist.org/packages/pgrimaud/instagram-user-feed it says "This package is auto-updated" - is it just a case of waiting?
One final question please - even though 6.15.0 is the latest release on GitHub, when I install using composer I get 6.13.1 - is there a missing step to publish the latest version to the packagist database? I see that on https://packagist.org/packages/pgrimaud/instagram-user-feed it says "This package is auto-updated" - is it just a case of waiting?
Damn, sometimes packagist doesn't auto update. I forced the update and it should work now
Excellent. Yep, all sorted. Merci!
Works also for me in development and production ! Thanks for the quick update 🚀
Upgrade solved the "Profile #1 : Unable to extract JSON data" error for me also. Thanks :)
This seems to be fixed in 6.16.6.