To fetch a Facebook page videos I use the code below:
new GraphRequest(mAccessToken, "Page_ID/videos", params, HttpMethod.GET, new GraphRequest.Callback(){}
What I want is to fetch the 'Featured video' of a Facebook page, but according to Facebook documentation in the link below, 'featured_video' parameter is visible only to the page admin, What is the logic behind setting this parameter to be only read by the page admin?
https://developers.facebook.com/docs/graph-api/reference/page/
Where can I report / ask Facebook to get this parameter result allowed to be read by others than the page admin?
Graph API /{page-id}/featured_videos_collection gives Featured Videos Collection for a Facebook Page. You need to use page-access token with page-id.
See for more info. I have not tested that API. Check if it is working.
You need to use {page-id}/featured_videos_collection edge to get featured video with normal user with page-access-token. While authenticating user, you need to get user_pages permission. Admin can get featured_video in directly without giving user_pages permission in {page-d} edge only. May be because of that Facebook have kept different edge for getting featured video of a page and 'featured_video' parameter is visible only to the page admin
Related
I made a website where people can post links for other websites and then the backend generates a preview of the link (by using curl and parsing out the open graph tags available on most websites / by picking the first image, html title etc). Now, fine after some tweaking but sometimes I get some kind of rate limit.
Here is one example of a link I want to parse: https://www.facebook.com/HBR/posts/10157131816732787
I can parse it 4 ou 5 times and get a title, image etc but then if I repeat it I get sent to the login page of facebook. How can I avoid this?
I tried to parse the link at https://developers.facebook.com/tools/debug/sharing however it says "Facebook URLs cannot be crawled". So my question is: how am I even supposed to parse those links if they don't even allow it on their debugger?
Is there any kind of API that allows me to get this information without user login? I don't want to parse entire facebook pages, profiles etc, just get a preview for a link that my users might post on the website.
You MUST use the Facebook Graph API if you want to get data of Facebook Pages (or anything else on Facebook), scraping is not allowed.
In order to get data of Pages you do not own, you need to apply for Page Public Content Access: https://developers.facebook.com/docs/apps/review/feature/#reference-PAGES_ACCESS
An App Access Token (without Login) is sufficient in that case.
API Reference for Pages: https://developers.facebook.com/docs/graph-api/reference/page/
I dont think show.You can crawl post on public group using python selenium and beautiful soup
Im using the following to retrieve information about Facebook pages that I'm the admin of. Specifically the number of likes.
// Get User ID
$page = $facebook->api($id);
return $page['likes'];
This works fine for 20 Facebook pages that I admin but I've run into one case where it does not. This is the error that I'm getting in response.
Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api
I have checked that the Id being used is correct by viewing the Facebook Id Page under the admin settings. http://findmyfacebookid.com/ also runs into an error when entering the pages url.
Has anyone else experienced this? Is this a bug?
I am pretty sure you are not using an Access Token to grab the Page likes, and that one Page is restricted by age or country. Either that, or it is unpublished. Also, calling the return value "$user" may be misleading, it is not a User object, it is a Page object, right?
For restricted Pages you MUST use a User or Page Access Token of a User who can access the Page.
I am new to Facebook API but I have to get all photos from a Facebook page. I managed to get a graph api query that returns all pictures of only the first ever created album on the page which is the profile picture album. For example:
https://graph.facebook.com/227843870675663/photos
But I need to do the same for all other existing albums in the page. Any pointers are really appreciated.
Try this and let me know how it goes for you. I've successfully pulled all photos from a Facebook page.
Ensure that you are an Admin of the Facebook Page.
Go to:
http://developers.facebook.com/tools/explorer
In the API Navigator, you can access /me to bring up the basic information of yourself.
Try typing in /me/accounts to see if you can see anything. It should give you an error.
You need to enable certain permissions to make this Graph query. Choose the relevant permissions in the right sidebar. According to this doc you need the pages_show_list and pages_read_engagement permissions for this query.
Click on "Get Access Token" which will give you a new token with the updated permissions. You may get a popup window where you have to confirm which page(s) you would like this access token to be able to see.
Now try /me/accounts again. You should see a list of pages that you enabled access for, inside the viewing window.
Find the Facebook Page you want to query, and click on the "id" field. This ID is needed for making any queries related to this page.
Next, on the left window, you can see "Node: " and a + sign. Click on the + sign to see what options you have.
Click on the + sign and scroll down to "connections" and select "Albums"
The child-level, select "Photos"
The "Photos" child-level, select "source"
Now click "Submit" on the right hand side.
If the above doesn't work, you can try copying the following URL into the API explorer:
YOUR_PAGE_ID/?fields=albums.fields(photos.fields(source))
You will see a JSON returned with the URL of some/all of the photos in your selected Facebook Page.
Click "Get Code" and it will show you the Javascript or raw URL used to access this information.
The "cURL" tab will show the URL which will look something like this:
https://graph.facebook.com/v15.0/YOUR_PAGE_ID?fields=albums.fields(photos.fields(source))&access_token=YOUR_ACCESS_TOKEN_HERE
You can copy that URL and plug it into your browser. You should see a JSON of all your photos, and each photo's corresponding URL on Facebook's CDN.
Getting photos posted to the feed, not just photo albums
To do that, you need to run a slightly different query:
https://graph.facebook.com/v15.0/YOUR_PAGE_ID/feed?fields=attachments
Getting high resolution imagery
Many of the image URLs provided by the queries above will only provide resolutions up to 720px. If you want higher resolution images, then you need to find the target.id for each subattachment, and perform a separate graph query for each image to obtain the other resolutions. It looks like this:
https://graph.facebook.com/v15.0/YOUR_IMAGE_ID?fields=images
Watch out for expiring tokens
The token generated above will only work for approximately 1-2 hours. If you want a longer lasting token, follow the steps in this post here.
When you get your Facebook user, you can:
get the list of all its
albums
get the user's profile
picture
get the
photos
the user (or friend) is tagged in
They respectively need those permissions:
user_photos or friends_photos
not needed
user_photos or friends_photos
UPDATE:
If you want to get those information from a Facebook page:
Photos - The Page's uploaded photos.
Albums -
The photo albums the Page has uploaded.
Permissions are: any valid access_token or user access_token
I want to use open graph to query the og:image and og:description value for a web page for which I am not an administrator.
I've tried using open graph and fql with both the id of the page and the url, but neither return that information.
I figured that since both values were "public" (they can be viewed in the source of the page) that they would also be public in OpenGraph.
Short of parsing the page myself, is this possible?
I took http://www.southparkstudios.com/ and checked the data returned by the Facebook Object Debugger and varified it had the description and image properties, then I simply clicked the Graph API url of the object (at the bottom of the page, Urls section) and received the site data, and it contained the image and description properties.
Based on that check, if you have the id of the web page then it should give you that info using the graph api, all you need is an active access token, even an application token will probably do the trick.
What did you get when you queried for that data? Did you get an error? just a smaller subset of the data?
Also, can you show the code of how you tried to get that data, both graph api and fql.
I've been trying to use the Like button generator to get a Like button for some content on my fan page: http://www.facebook.com/photo.php?fbid=363385833679921&set=a.314588171893021.85085.305618229456682&type=1
What I want to do is show the likes this photo got on Facebook in the like button on my site and vice versa.
This seems to work for the actual fan page url but doesn't work for individual photos (haven't tested other objects).
You are able to see the likes the object on Facebook got through the graph API call: http://graph.facebook.com/363385833679921. So shouldn't that be available on non-Facebook sites as well?
Anyone know a solution to this without having to make a custom handler to show and post likes on site?
Why don't you just use the API to read the comments and likes on the object? Any user's access token will work if that user can see the object