mpratt / Embera

A Oembed consumer library, that gives you information about urls. It helps you replace urls to youtube or vimeo for example, with their html embed code. It has advanced features like offline support, responsive embeds and caching support.
MIT License
335 stars 59 forks source link

Facebook is problematic #84

Closed billtomczak closed 3 years ago

billtomczak commented 3 years ago

For posts, the height is too big and the result isn't responsive.

For pages, a url like https://www.facebook.com/<USER> always seems to return the dreaded 'This Facebook post is no longer available'

Videos seem to be okay and responsive, if not necessarily what might be desired.

We've spent quite bit of time trying to figure out how to fix the height issues in posts with little success. The one thing that seems to make everything work better was to skip the modifyResponse() method entirely and unset the provider name. We have a subclass to do this:

public function modifyResponse(array $response = [])
{
    unset($response['embera_provider_name']);

    return $response;
}

Pages - now are accessible, if unresponsive and the height is correct Posts - no change other than the height problem is fixed, still not responsive Videos - The video is now fully embedded without the FB user/share links and still responsive

I'm having trouble wrapping my brain around what the intent behind FaceBook::modifyResponse() code is. I assume the idea is to make the non-responsive response responsive. But it doesn't do that for posts and makes pages not work.

For now our lame patch does what we need it to do, but it doesn't strike me as a particularly good fix.

I'd be happy to work on a patch, but I'm unclear how to approach this.

mpratt commented 3 years ago

Hi @billtomczak Nice find! I will remove the the modifyResponse method from the Facebook Provider since it came from the older version of the library and it doesnt make sense to continue using it.

Thanks for the report!

billtomczak commented 3 years ago

Your welcome!

It seems that class then also needs to change to

protected $responsiveSupport = true;

that seems to fix everything up.

-bill

billtomczak commented 3 years ago

See https://github.com/mpratt/Embera/pull/85

mpratt commented 3 years ago

Thanks @billtomczak for the report and guidance. I made the changes, will be releasing a new version in half an hour or so. :+1: