Facebook gives diffrent like count for same url in php sdk and graph api - facebook

I am using php sdk fql and graph api both for counting facebook likes. When I pass url like http://mydemowebsite.com/city/id-12345.html it gives me correct count but when I pass url like
http://m.mydemowebsite.com/city/id-12345.html to both the apis, its giving me different like count, Although it is the same page. It also shows same count on browser for both the links.

Like Counts unique identifier is the URL, you maybe able to get around this but going to Facebook App Edit Settings and under website set the site domain to mydemowebsite.com. this allows for any subdomains of mydemowebsite.com to use the facebook api.

Related

Crawl Public Facebook Posts

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

Is it possible to get Facebook likes for any page other than FQL API?

I've read this post:
Get FB likes count for specific URL and page
But when I visit that URL, I got:
(#4) Application request limit reached.
I am using a VPN connection because Facebook has been blocked in China. I am not sure whether this is related. Anyway I can still see all the likes on any pages.
Is there any other approaches I can try?
Have a look at https://developers.facebook.com/docs/facebook-login/access-tokens#apptokens
Basically, you have to create your own app and use the app_id with the app_secret concatenated by a pipe symbol like this:
{app_id}|{app_secret}
which yields in
https://graph.facebook.com/?access_token={app_id}|{app_secret}&ids=http://www.your-website.com/

Find pages with facebook api

I need to Create or Make an FQL where search using 1 word can find facebook pages.
example:
Search>
"Soda Stereo"
Result:
....
..
Soda Stereo Fan page
Is posble create this with Facebook.
You can use the
/search?q={your_search_string}&type=page&access_token={app_access_token}
endpoint for that (https://developers.facebook.com/docs/graph-api/using-graph-api/v2.1#search), where {your_search_string} needs to be replaces with the actual search string (url encoded), and {app_access_token} with an actual app access token.
You don't need FQL to do that at all.

Facebook like and share create a fanpage

We are using the facebook like plugin with the share button. The URL points to a resource of our app. For example
http://apps.facebook.com/appname/resources/id
The first time this resource/url is shared or liked, everything works fine. The share for example holds the URL given above.
But if the same resource/url is shared again, an error occurs. Facebook did create a fanpage for that resource like
http://www.facebook.com/pages/appname
So from now on, share/likes refer to that page instead of the resource/url of our app.
The URL we use for the like plugin is correct and always points to the app resource URL. The fbappid in there is correct, too. Furthermore the page of the resource holds open graph meta tags like og:url, also pointing to the correct URL.
The facebook linter/debugger returns URLs to the correct app resource URLs, when checking the liked/shared resource.
Why is a fanpage created instead and the URL exchanged in shares/likes? How to fix it? We want the share to include the URL of the app resource and to increase the like count for that open graph object.
We want the share to include the URL of the app resource and to increase the like count for that open graph object.
If you just want to increase like count fo your OG object, why don’t you link your actual URL, and not a Facebook URL? I mean, your app should be accessible via yourdomain.example.com/something/resources/id, right? So why not like that, since it is the real Open Graph object …?
There is a related facebook bug for this:
http://developers.facebook.com/bugs/240986412684045?browse=search_4fe13eff357e29b43787690
So, apparently there is nothing we could do about it, but wait for facebook to fix it. The alternative would be what CBroe suggested and point to the ressource without using the canvas URL. But this would put the non-canvas URL in the shared message, which is not what we want.

Given a Facebook app's page/id, how do I find how many "likes" that app has?

farmville/frontierville/etc
How do I figure out how many "likes" these apps have?
The graph API does not work with apps.
The graph api below will show all the information related to the app
https://graph.facebook.com/159616034235/
result:
Call
https://graph.facebook.com/APP_ID
Try this example call in Graph Explorer:
https://graph.facebook.com/farmville
which will return a JSON reponse with id, name, picture, link and then likes as 5th value.
You can get the number of likes from Graph API by querying by Application id or Application namespace.
https://graph.facebook.com/APP_ID_OR_NAMESPACE
You can also limit results to be only constructed from id of an application and likes by using fields argument in URL:
https://graph.facebook.com/APP_ID_OR_NAMESPACE?fields=likes
Beware that not every application have a namespace defined and because name of application is not unique, it's better to use id of application to retrieve details from Graph API
You are wrong. The graph API does not work with apps.
http://www.facebook.com/dominodraw/
takes me to 'page not found'. So, dominodraw is not a valid facebook username.
Try graph.facebook.com/<your_app_id> and it will get likes for your app.
p.s. Just in case you are confused.
farmville is not only the name of app, but also they have registered farmville as facebook username.
So, they can do https://graph.facebook.com/farmville along with graph.facebook/208633805894647
If you havent set username for your app, you can only call graph api by app_id.