Hi I'm a web developer and a client has asked me if I can build an app that displays the information contained inside the OrderedFriendsListInitialData. This information is found when you view the source code on your Facebook news feed.
The Facebook Terms of Service is very clear about NOT scraping Facebook pages, so I would need to access the data via the API. The idea is to allow users to see this list in a convenient way though a Facebook app.
Also, if this is NOT possible, then would Facebook make an exception to scraping this singular element for the sole purpose of displaying it to the user it was generated for.
I.e. not showing it to other people, only scraping the data to show it directly to the user without saving it to any database.
There is no API available to return the coefficient-ranked friends list - if your app needs to organise friends based on the user's relationship to the friends, a popular method to do this is to examine the user's photo tags and/or news feed and likes to choose friends most closely associated with the user
Related
I am working on an application that needs to allow users to access the Facebook posts of their friends. However, the Facebook API does not allow access to the posts of other people.
I am aware that scraping the users web page for the data is illegal, and was curious if it would be unethical to simply display the Facebook page with the relevant information, rather than to scrape the data and integrate it directly in my app?
I don't see why this would be illegal, but I also don't see much of a difference between just displaying the web page, and reading the web page for the relevant data.
I'm using Facebook graph Api to search users and data that i get is kinda different from that i get from Facebook UI. For example search response of User interface is friends, mutual friends and other related data in first. How can i query to get related data for current user ( i.e friends and mutual friends in first place).
Here is query that i'm using to search users.
https://graph.facebook.com/v2.5/search?fields=id,name,picture.type(normal)&limit=50&q={q}&type=user&access_token={token}
and data that i get is kinda different from that i get from Facebook UI
That’s because those are two completely different things.
The search functionality offered via the UI is called Graph Search. But the powerful possibilities that offers are not exposed via API. (To protect user privacy, and keep apps from doing extended user profiling via that data.)
Searching via API is limited to what is listed here: https://developers.facebook.com/docs/graph-api/using-graph-api/#search
That’s not much – but it’s all you get.
I'm using Facebook graph Api to search users and data that i get is kinda different from that i get from Facebook UI. For example search response of User interface is friends, mutual friends and other related data in first. How can i query to get related data for current user ( i.e friends and mutual friends in first place).
Here is query that i'm using to search users.
https://graph.facebook.com/v2.5/search?fields=id,name,picture.type(normal)&limit=50&q={q}&type=user&access_token={token}
and data that i get is kinda different from that i get from Facebook UI
That’s because those are two completely different things.
The search functionality offered via the UI is called Graph Search. But the powerful possibilities that offers are not exposed via API. (To protect user privacy, and keep apps from doing extended user profiling via that data.)
Searching via API is limited to what is listed here: https://developers.facebook.com/docs/graph-api/using-graph-api/#search
That’s not much – but it’s all you get.
2 Part question
1) So I am trying to figure out the difference between "liking" something on pinterest vs "liking" a business. Is it the same thing?
2) I want to implement people "liking" different pages on my website (such as pinterest) and track which page has the most likes. Do I have to save and track that in my database or facebook API will let me see which pages has most likes based on some criteria?
TLDR: Yes, they are the same thing.
A Facebook "Like" is what is an Open Graph Action. Liking something from within the Facebook web interface or via one of the Facebook plugins allows an easy implementation path. Pinterest uses a custom script that initiates a built-in like action.
Both types of like require there to be an object with open graph metadata that Facebook can scrape to get the information that will be shared on a timeline. That metadata could be served by Facebook on an internal page, or by an external page.
As for getting the number of likes, yes you can. Each canonical open graph URL gets an id within the Facebook system. This includes objects within the Facebook system.
So, the Pinterest Facebook page has an id of 253591661347566. You can find this by querying https://graph.facebook.com/pinterest?fields=id
The Pinterest home page has an id of 185629821512802 according to https://graph.facebook.com/http://pinterest.com?fields=id. (Not urlencoded for clarity). You could replace http://pinterest.com with any other url, and get that pages id.
For any object that you know the id, you can get information on the number of likes it has by adding likes to the fields querystring.
If you've marked up your pages with an app id and admin information, you can see all of this and more through Facebook's Insights.
I am building a social application, users post data to the website, which is saved in our database.
This creates a record on the site, which is searchable and creates the basic content and function of the site (the purpose is not relevant at this point)
When a record is saved to our database, I want to "spread the word" and send this data out to social networks. Currently, I'm looking at Facebook in isolation.
So, I know how to create a post through the Graph API and post this content to the users Timeline, or indeed to a business page associated with the APP/Website.. but I am not sure how, or if indeed one should, maintain continuity.
What I mean... if a user creates a record on my website, and then the website/App creates a post on my business page, and also asks the user to post it in their Timeline, how do I stop this being two separate posts, and instead one post which has been shared?
I want to achieve:
User posts on website
>
Website posts to Page
>
Post on Page is "Shared" to users Timeline
As opposed to:
User posts on website
>
Website posts to Page
>
Website posts an additional post to users Timeline
The reason I want to do this, is that on the website, I want to be able to show shares, likes and comments from Facebook by tracking the ID of the initial post created when first entered onto my website.
Or am I trying to reinvent the wheel and should just use Facebook's comment plugin?
When you create the post on facebook on the Page, store the returned post ID in your data model.
From what I can tell, there is no way to access the normal user share directly through the API. If you insist on doing it programmatically without popping up any dialog for your user, you can make a post to the user's page which has (the start of) the Page post and a linkback to the Page post as an attachment. This is probably to prevent abuse.
However, if you don't mind relying on an undocumented and deprecated endpoint, you can use the old sharer.php endpoint, so long as you have a fully qualified link to the post you want to share (you can retrieve the url through the api). This will also require your user to enter anything appropriate in their share and then click "share."
The endpoint is
http://www.facebook.com/sharer.php
Call it with the u parameter filled in with the url, so
http://www.facebook.com/sharer.php?u=[URL encoded URL of the post you wanted to call]
You can try this with any facebook post (go to a post, copy the url, past in as the parameter), it's still working (I just tried it) but there are no guarantees. See the top answer to Facebook API: "Share" a post already posted on a page's wall?.
You can still access likes, comments, etc for that post id through the Graph API (and you can provide your users a direct link to the post). Cache/update them as recommended and display them on your own page. You are basically mirroring back onto your own site what is happening on facebook in regards to the post you made.
I would go this route especially if you are at all planning on branching into other services. That way you can do an aggregated display of statistics/likes/etc from the multiple services you are having your platform repost to. This is also good for (at least an impression of) data integrity for your users: they know that your service represents everything they have done in case anything happens to their facebook/etc accounts.
This could especially be noteworthy if they are worried about facebook/etc deleting any of their posts, or for recovering from any issues where a post/comment/etc is not properly stored by facebook/etc (for example, comments have a maximum length which, at least via the main FB UI, silently drops anything above the maximum length in a non recoverable way for the user).