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

Consideration: Add Facebook support #64

Open
absentio opened this issue Mar 12, 2019 · 8 comments
Open

Consideration: Add Facebook support #64

absentio opened this issue Mar 12, 2019 · 8 comments

Comments

@absentio
Copy link

It would be great to add Facebook Video support, as it is one of the most used video uploading platform.

@tw2113
Copy link
Member

tw2113 commented Mar 12, 2019

Do you have any examples of FB videos that would be embed-able in WordPress content? I tried one but it didn't work and threw errors. We'd also need some sort of static image API endpoint to fetch content from by unique ID. Vimeo and Youtube provide those, which is why they're the two that get the most focus.

We don't generate the images themselves, we simply fetch and programmatically upload existing video screenshots.

@absentio
Copy link
Author

absentio commented Mar 12, 2019

Thank you for replying. I was trying to help you making this, I am not an advanced developer but I am studying computer engineering and I know a bit of PHP.
Facebook content is automatically embedded in a wordpress article if the url is pasted into the content.
To get Facebook thumbnail you have to look at:
https://graph.facebook.com/VIDEOID/picture?redirect=false
EDIT: In this way,without having an facebook appID , you can only get the small thumbnail. To get the big thumbnails you have to use facebook API.

This is regex for facebook video urls:

function wds_check_for_facebook( $content ) {
	if ( preg_match( '^(?:(?:https?:)?\/\/)?(?:www\.)?facebook\.com\/[a-zA-Z0-9\.]+\/videos\/(?:[a-zA-Z0-9\.]+\/)?([0-9]+)', $content, $facebook_matches ) ) {
		return $facebook_matches[1];
	}

	return false;
}

@tw2113
Copy link
Member

tw2113 commented Mar 12, 2019

An example of a video that will work as a whole, though won't be playable in the editor screen:

https://www.facebook.com/PetSemataryMovie/posts/2218578548192717

Extra note about the graph URL, you can append &height=XYZ and get larger images.

@absentio if you can point us to the right part of FB's documentation for API and Graph stuff that would show how to do the image fetching without requiring apps set up, we could look into this much more readily. We're not going to be able to do much if they do require an app, and I'd really rather not try to tie WebDevStudios to provide one for all the users.

@absentio
Copy link
Author

If you use the post link instead of the video link the /picture won't work.
the &height=XYZ doesn't seem to work without a Facebook access token. I tried doing some online researches but it seems to be impossible without having a Facebook APP. You could let the users use their own app ID and access tokens, so you won't have any problems. This is what most Facebook wordpress plugins do. I would like to help you and I've tried my best, I will keep searching for new solutions. Sorry for my English but I am not a native English or American speaker.

@tw2113
Copy link
Member

tw2113 commented Mar 12, 2019

You've communicated well enough that I haven't scratched my head going "what?". We can definitely leave this open as well as more information gets found and whatnot. Ideally we would want this as seamless as possible, so avoiding app needs would be a benefit. Alternatively, that could be its own extending plugin as well. There's room to work here.

@absentio
Copy link
Author

absentio commented Mar 12, 2019

Using Graph 3.2 I've found VIDEOID/thumbnails?access_token=YOURACCESS_TOKEN you will get a json with all the video thumbnails. The one with the field "is_preferred": true will be the real video thumbnail, but we will have to do the filtering on our own as it is not possible through the API. I never coded for WordPress before, I've rarely made some modifications to themes and plugins, I don't think it will be hard to add it as we only have to get the URL of the thumbnail, in my free time I will begin studying git so it will be easier to cooperate!

@tw2113 tw2113 changed the title Add Facebook support Consideration: Add Facebook support Jun 6, 2024
@tw2113
Copy link
Member

tw2113 commented Jun 6, 2024

We have more requests for this, as well as some example code over at https://wordpress.org/support/topic/facebook-video-embed/

I think the biggest things are going to be:

  1. Setting up and wiring up an authentication method to get the necessary access tokens, as well as keep those refreshed and renewed.
  2. Making sure we keep up with Facebook's ongoing changes with their graph platform.

One nice thing that's been evident for a long time with Vimeo and Youtube is that those endpoints have simply not changed at all, allowing for a lot of stability with the plugin.

@tlock878
Copy link

tlock878 commented Jun 7, 2024

I appreciate you guys looking into this - wish they made it as simple as YT and Vimeo does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants