Closed dev-erem closed 3 years ago
I see the same problem, I did some digging and it seems that this is caused by the fact that Facebook redirects to /login for all posts, even public posts. This causes the $embed->get('https://facebook.com/.../posts/...')
call to fail silently. This wouldn't be a problem if the getOEmbed()
call would still work. However in that method the wrong url is used, i.e. the one of the login page, instead of the original url. This happens here https://github.com/oscarotero/Embed/blob/68fe4badda2b088660415f3bbb07c4957867e7dd/src/Adapters/Facebook/OEmbed.php#L23
I saw that for the 3.x branch this was also an issue (https://github.com/oscarotero/Embed/issues/415), but I couldn't yet figure out how to apply a similar mechanism to the 4.x branch.
I would be happy to work on a fix if @oscarotero could give me some hint as to where to start... is there a similar 'Redirect' detection feature as in 3.x branch? Or should it be fixed in the getUri()
call of the Facebook Extractor class? Or ??
Also please note that Facebook changed their OEmbed feature, it looks like the API works the same but as a developer we know have to request a specific oembed:read permission before we can use it. I guess this also means we have to use the 11.0 version of the endpoints (this packages uses the 8.0 version so that would probably require updating as well). See here for details: https://developers.facebook.com/docs/plugins/oembed/
Hi, @JanMisker Thanks for yor help here. The Facebook OEndpoint is here: https://github.com/oscarotero/Embed/blob/master/src/Adapters/Facebook/OEmbed.php
You can update the OEmbed endpoints and here we can change the uri parameter: https://github.com/oscarotero/Embed/blob/master/src/Adapters/Facebook/OEmbed.php#L23
As I can see in the demo the login url includes the final url in the parameter next
.
https://www.facebook.com/login/?next=https%3A%2F%2Fwww.facebook.com%2Fpermalink.php%3Fstory_fbid%3D2746690642272585%26id%3D100007950288639&_fb_noscript=1
So, maybe we can use that parameter.
Facebook embed not working i.e, permalink.php?story_fbid=2746690642272585&id=100007950288639