Facebook onebox


(runixo) #1

Hola!

first of all, thanks for Discourse. It looks great.

I found strange that there isn’t a Facebook oneboxer so I started hacking my own. Basically, for each Xhttp://www.facebook.com/foo URL, I ask the Graph API for a node named foo ( Xhttp://graph.facebook.com/foo ) and I construct a simple onebox from it.

It has a few features missing (ie, what to do when there’s no node named foo and a better regex to find what FB urls could be a node - right now is catching everything).

Also, since there’re many FB ‘node types’, but the type cannot be inferred from the URL, I suspect this onebox will grow huge (support for ‘user nodes’, ‘page nodes’, etc).

Do you think it makes sense to include this onebox on the master discourse, when it’s ready?

Thanks

pd: sorry I had to break the urls before with the “Xhttp://” but “new users can post up to 2 links” :slight_smile:


Facebook Video Support in Onebox?
(Brentley Jones) #2

It isn’t supported out of the box if you simply add facebook to the whitelist?

If not, I think this would be a great addition to master, since we already have facebook login.


(J Phani Mahesh) #3

Awesome sauce!

I noticed yesterday that facebook oneboxes were missing and was thinking of making one myself. But I’ve been surviving on practically no sleep for the past week, so I figured it’s best I add it to my ever-growing TODO list and let it be. :stuck_out_tongue:

Hopefully, I’ll be able to make time to hack on this one. I’m sure the discourse team will welcome this addition.


(runixo) #4

Well, if you add it to the whitelist and paste the URL, it does something. Brings the title of the page and I think not much more.

I think a specific oneboxer is better. But I’m worried about the size of the class since lots of different node types (with different attributes) can be added…


(J Phani Mahesh) #5

Which whitelist are you referring to?


(Jeff Atwood) #6

What exactly are you going to onebox on Facebook? Almost all the interesting content is private and behind a login wall.


(runixo) #7

This one


(runixo) #8

Arepas La Juanita - Home | Facebook => http://graph.facebook.com/ArepasLaJuanita

Not sure if it’s interesting to you, but we run a food-related forum :wink:


(Jeff Atwood) #9

All I see is a giant login box with a timeline underneath. How can we onebox a timeline?


(runixo) #10

That node (“Arepas La Juanita - Home | Facebook”) is a Page.
Pages have some public metadata which makes makes sense to include in the onebox when you link the page from your post.

The URL for the node’s timeline is different: Arepas La Juanita - Home | Facebook


(Jeff Atwood) #11

Can you provide some examples of Facebook pages that would make sense to
onebox? I know of virtually none, because as I said, 99.9% of the site is
private and behind a login wall.


(runixo) #12

Restaurants

Xhttps://www.facebook.com/NobuWestHollywood
Xhttp://graph.facebook.com/78949505516
Xhttp://graph.facebook.com/AstridyGastonBA

I can lookup more, if you want :slight_smile:


(Brentley Jones) #13

Businesses in general?


(J Phani Mahesh) #14

Yep that, but unfortunately, more and more (private) content is being shared publicly.

Facebook has become an integral part of online identity to many. I could not keep away from it for more than 6 months. And I would like to have facebook oneboxes on discourse.

If the content is public, gather what is relevant and display. If it is private, just drop a note that the content is private and needs login to facebook, or do not show the onebox at all. (disable oneboxing)

Since the facebook oneboxing logic can get lengthy, a piece for each type of ‘post’ , and will (very likely) have constant change, it is probably best if the facebook oneboxing remains as a separate plugin, but with ease of integration.


(runixo) #15

+1

Shall I follow this plugin tutorial or there’s anything newer/better/shinnier?


(Ilya Kuchaev) #16

Oneboxing does not work for Facebook statuses

And personal pages :frowning:
https://www.facebook.com/grahamwilliamphillips?fref=nf

And Groups!


(Jeff Atwood) #19

I can’t remember, in the last 5 years of using the Internet, the last time I have seen someone link to those sub pages in Facebook. Public shared links to facebook are quite rare since they are usually login required to see anything. So that stuff is not a priority based on lack of public sharing (and public share experience is awful on Facebook in general).

Also, please do not post 3 trivial things in a row. Use the edit button please.


(Sam Saffron) #20

Groups is behind the paywall it seems, personal pages perhaps should be oneboxed if there is an api.

I have seen some restaurants etc have a “visit our facebook page” thingy which may be useful. None of this seems high priority, but if someone feels like working on it feel free.


(Dean Taylor) #21

Just had a quick look at this again - just some notes here

There is an embedding API which basically comes down to this code snippet…

##Example 1
To embed this:

<div id="fb-root"></div><script>(function(d, s, id) {  var js, fjs = d.getElementsByTagName(s)[0];  if (d.getElementById(id)) return;  js = d.createElement(s); js.id = id;  js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1";  fjs.parentNode.insertBefore(js, fjs);}(document, 'script', 'facebook-jssdk'));</script>

Coupled with a per item code of:

<div class="fb-post" data-href="https://www.facebook.com/video.php?v=870810963005850" data-width="466">
    <div class="fb-xfbml-parse-ignore"><a href="https://www.facebook.com/video.php?v=870810963005850">Post</a> by <a
            href="https://www.facebook.com/SpotifyUK">Spotify</a>.
    </div>
</div>

Users can get the Embed code in multiple places

But I wouldn’t imagine the user would need to use the “Embed” links in this way - if the “public” status of an object link can be found via Open Graph it could be automatic.

##Example 2
Using the following link - just copied from the browsers address bar:

And the following non-script part of the

<div class="fb-post" data-href="https://www.facebook.com/thejohncleese/photos/pb.8844096691.-2207520000.1424802582./10151875670346692/?type=1&theater
" data-width="466">
</div>

Gives me this:

##Example can’t be displayed
If the post is not embeddable the following is displayed:

##Thoughts
I haven’t seen Facebook links in the wild much as @codinghorror has mentioned.
But this is probably in part because they don’t work as the user expects permissions wise.

When people do put in Facebook links it seems its usually followed with - “I can’t see it”, “does’t work for me”.

If the Onebox preview clearly indicated if it wouldn’t be available to the public this would help.

I currently still don’t think this is worth development time to me personally…
… but I can see that a corporate wanting to get more views / likes on their pages and Facebook videos would want this.


(Oroton) #22

Hate to dredge up old topics,
How do I put this on the white list?

In australia, many companies only have a facebook page now, or do all the advertising on that.
For my forum, it would be imperative that you can use the mobile, (share as url) link and have it embed
as a post. This is something we have with PhpBB and is amazing.

If you can ‘share’ a pages update/video or something in facebook, generally speaking its a public status.
But you can tell by the globe icon next to the page whether or not it’s public.

I would need this feature in order to function with Discourse.
Are there any other apps that handle the embed, if OneBox wont/doesn’t?