Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getMediaByUrl() and getMediaByCode() not working #677

Closed
zaivst opened this issue May 21, 2020 · 21 comments
Closed

getMediaByUrl() and getMediaByCode() not working #677

zaivst opened this issue May 21, 2020 · 21 comments
Labels

Comments

@zaivst
Copy link

zaivst commented May 21, 2020

It seems that getMediaByUrl() and getMediaByCode() not working now.

I see [InstagramScraper\Exception\InstagramException] Media with this code does not exist (500) error for both functions

@fonclub
Copy link
Contributor

fonclub commented May 21, 2020

Same error..

@bulhosa-git
Copy link

Same! Sometimes it works, sometimes it doesn't...

@jordipolo87
Copy link

Same error, I think that it's related with the IP that made the call but not sure yet.

@btworld-tr
Copy link

btworld-tr commented May 22, 2020

Maybe it is related with ip but I saw some new generated media codes like that https://www.instagram.com/p/Bqj2ER_lsaqx8hNTQ8xa3FjmpPNyGReGKhSF7E0
I think, they are making test for some regions or IPs. This urls are not for all post media at now but it seems it will be at the future.
Other hand, cdninstagram.com can have some DNS problems. When i requested this domain I got 500 status code error on browser.

@kctteam
Copy link

kctteam commented May 22, 2020

Same error...

@congkv
Copy link
Contributor

congkv commented May 22, 2020

Instagram no longer allows to view posts without logging in. You need to login.

@zaivst
Copy link
Author

zaivst commented May 22, 2020

Seems they soon will not allows to use instagram with login too )))

@sergshyn
Copy link

sergshyn commented May 22, 2020

The same problem, I experienced with a redirect to a login page https://www.instagram.com/accounts/login/?next=/p/CAcbAKahSnz/%3F__a%3D1

@movAX13h
Copy link

movAX13h commented May 22, 2020

@congkv Not sure if that's true ... I can still load public accounts and posts in the browser without being logged-in. https://www.instagram.com/redbull/ and https://www.instagram.com/p/B0YKatOontz/
Only navigation via click requires login.

@juangrimm
Copy link

the same problem here, but the curious is that in my local, all work, the response is OK, and have all data that i need, but when i put this in my Digital Ocean server, with the same configs, doesn't work.

@juangrimm
Copy link

juangrimm commented May 23, 2020

Same error, I think that it's related with the IP that made the call but not sure yet.

I think it's not true dude, because i'm using proxy here, and nothing works.

@hrmoh
Copy link

hrmoh commented May 24, 2020

I'm getting some kind of 404 errors for a code working previously. I've checked with sample instagram posts mentioned here (getting errors) and I updated instagram-php-scraper to the latest version (v0.9.10) and the error persists.

This is my exception (my app path is replaced by [MyAppPath]):

Fatal error: Uncaught exception 'InstagramScraper\Exception\InstagramException' with message 'Media with this code does not exist' in [MyAppPath]/vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php:590 Stack trace: #0 [MyAppPath]/index.php(125): InstagramScraper\Instagram->getMediaByUrl('https://www.ins...') #1 {main} thrown in [MyAppPath]//vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php on line 590

and this is the code I'm using (no user is logged on):

require DIR . '/vendor/autoload.php';
$instagram = new \InstagramScraper\Instagram();
$media = $instagram->getMediaByUrl($instagram_url);
$img = $media->getImageHighResolutionUrl();
$relText = $media->getCaption();

@congkv
Copy link
Contributor

congkv commented May 25, 2020

@congkv Not sure if that's true ... I can still load public accounts and posts in the browser without being logged-in. https://www.instagram.com/redbull/ and https://www.instagram.com/p/B0YKatOontz/
Only navigation via click requires login.

@movAX13h Actually Instagram don't implement it for all. It depends on the region. I tried with proxy Japan then I got results like yours.

@nteath
Copy link

nteath commented May 25, 2020

I am facing the same issue as well. When I visit a public account from browser I have no problem viewing its content, eg: https://www.instagram.com/p/CAf2RyvpsHG/ . When using the library I get an error 'Media with this code does not exist (500)'.

I tried using raw curl and instagram responds with 302 Redirect to login page. I don't know if instagram does an IP detection or agent but it seems like it is blocking bots.
Maybe it's relevant but I am using Digital Ocean as well.

@psegovias
Copy link

psegovias commented May 26, 2020

Just to you know, i have the same issue, but now i try in my local PC and works like a charms, maybe is time to use Proxy?

Anyone know how to use it?

@jordipolo87
Copy link

Just to you know, i have the same issue, but now i try in my local PC and works like a charms, maybe is time to use Proxy?

Anyone know how to use it?

No, as @congkv says, it seems that depends on the region or other aspects like the IP, the number of people that have logged in from this IP or something like this. We are currently using a pool of around 30 proxies and we are experiencing the same issues.

You have an example of how to use a proxy in the repository readme.md

@psegovias
Copy link

Just to you know, i have the same issue, but now i try in my local PC and works like a charms, maybe is time to use Proxy?
Anyone know how to use it?

No, as @congkv says, it seems that depends on the region or other aspects like the IP, the number of people that have logged in from this IP or something like this. We are currently using a pool of around 30 proxies and we are experiencing the same issues.

You have an example of how to use a proxy in the repository readme.md

Are u using residential proxy?

@sergshyn
Copy link

Just to you know, i have the same issue, but now i try in my local PC and works like a charms, maybe is time to use Proxy?
Anyone know how to use it?

No, as @congkv says, it seems that depends on the region or other aspects like the IP, the number of people that have logged in from this IP or something like this. We are currently using a pool of around 30 proxies and we are experiencing the same issues.
You have an example of how to use a proxy in the repository readme.md

Are u using residential proxy?
It works good with residential proxies, but it is not cheap. Looks like IG bans the most popular hosting IPs.

@jordipolo87
Copy link

After some tests with different residential proxy providers and with some of our own proxy servers I observed that the 500 error is only returned from some countries. I don't know if the restrictions are only deployed in some countries for some reason or the deploy is still pending.
For example, the restrictions are applied in USA and France but not in Canada and Italy.

@ghost
Copy link

ghost commented Jun 3, 2020

#694 Use this PR to fix this problem after logging in.

@stale
Copy link

stale bot commented Aug 3, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Aug 3, 2020
@stale stale bot closed this as completed Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests