Im interested to know if there is a way using API to get list of consolidated comments for an URL shared in facebook.
What I have tried is using following API to get object_ID of an URL "http://graph.facebook.com/?id={URL}"
and then used "{object_ID}/comments". As a result, I got following output and not able to figure out what I have missed.
{ "data": [ ] }
Thanks for your answer.
Related
I am exhausted looking for the solution in the google forum, Stack and AWS help and thus posting a new question.
I have a webservice through which I am generating a presigned POST url for my s3 bucket. I have tested it with python request.post module and it works just fine.
all I'm trying to upload are simple small csv string data. e.g. "a,1,b,2,c,3"
incase the image above is not readable : it looks like this:
url,https://genome-analytics-scratch-space.s3.amazonaws.com/;;AWSAccessKeyId,AKZZZZZZZZZZQ;;ContentType,multipart/form-data;;acl,public-read;;key,slaik/somejson.json;;signature,+IZZZZZZZZZZZZZZM=;;policy,eyZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZJ9;;x-amz-server-side-encryption,AES256;;
I have an absolutely simple ai2 app with just 1 button, 1 web component and a label to show the output.
The block i have designed looks like this.
The output I'm getting is :
I have tried setting my fields & conditions values to for the presigned POST url as mentioned below.
fields = {"acl": "public-read",
"ContentType": "multipart/form-data",
"x-amz-server-side-encryption": "AES256"}
# Ensure that the ACL isn't changed and restrict the user to a length
# between 10 and 100.
conditions = [
{"acl": "public-read"},
["content-length-range", 0, 10485760],
{"ContentType": "multipart/form-data"},
{"x-amz-server-side-encryption": "AES256"}
I have also tried setting content type to text/csv. But all I'm getting is this same error and I have written so much code for the download and other features, a lot is hanging on cracking this for me.
Any guidance, observation, link, clues would be greatly appreciated.
Thanks.
I am working on some data analysis regarding beverage manufacturers in the US and would like to grab posts from the company facebook pages to mine some data using the standard facebook graph API. I am new to the facebook API and I am hoping to get some clarifications here that I can't find in the developer docs.
For a simple example lets look at 2 companies FB pages:
https://www.facebook.com/CocaColaUnitedStates
https://www.facebook.com/BellsBreweryInc
Now per the API documentation, I should be able to retrieve the posts on those public company pages via a URL as follows:
https://graph.facebook.com/COMPANYFBNAMEHERE/feed?access_token=MYTOKEN
or
https://graph.facebook.com/v2.5/COMPANYFBNAMEHERE/feed?access_token=MYTOKEN
This works for CocaCola: https://graph.facebook.com/v2.5/CocaColaUnitedStates/feed?access_token=MYTOKEN
This returns data as I would expect:
{
"data": [
{
"message": "The French \"yes! yes! yes!\" sounds like \"we! we! we!\" (lettered \"oui.\") \"C'est la vie\" sounds like (homonym) \"say LOVIE\" (like lovie dovie).\n\nSong of (rather than \"by\") Robbie Nevil: C'est La Vie\nhttp://www.youtube.com/watch?v=CGtf9QfITQw",
"created_time": "2016-02-06T02:52:17+0000",
"id": "820882001277849_452698638250376"
},
etc....
However when I try this for Bell's: https://graph.facebook.com/v2.5/BellsBreweryInc/feed?access_token=MYTOKEN
I get this:
{
"error": {
"message": "Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100,
"fbtrace_id": "AWTxWye6vub"
}
}
I am not understanding why I am getting an error on Bell's page? It's a publicly available company FB page, so I can't imagine it's a restriction, but I can't understand why it wouldn't be returning the posts like CocaCola?
It sounds like the owner of the token you are using is below the legal drinking age. BellsBreweryInc is a page in the alcohol category so no data will be returned for users under the legal age. This is something BellsBreweryInc would have set in their page settings.
Age restircted websites require a user access token from a user account that meets the page requirements. I was using an app access token which is why it didn't work.
I needed to log into my account and generate a user access token and use that token in the URL.
Also, just realized that token expires in a couple hours. Anyone wanting to do this may also want to read this: How to extend facebook access token in python
i have set of articles on my website where people can comment using facebook.
The fix is I have to find the most commented article and show, say 5 of them, on webpage.
I have tried looking into facebook api, and googled it out for 2-3 days without having any luck.please help
You can query this info from the Facebook API - I'll explain the process to do it, but I'm not a django expert, so you'll need to turn this into Python.
Basically, you need to grab the URLs for each of your articles and hit the Graph API requesting the comments and a summary of them for that URL like this: https://graph.facebook.com/comments/?ids=YOUR-URL&summary=1
Change the YOUR-URL part of the above to the link you want to check. You can even specify more than one link at at time if you like: https://graph.facebook.com/comments/?ids=YOUR-URL1,YOUR-URL2&summary=1
So if you query the example.com comments:
Hit this URL https://graph.facebook.com/comments/?ids=http://example.com/comments&summary=1
You should get back some JSON data which looks like this (I trimmed the middle bit):
{
"http://example.com/comments": {
"comments": {
"data": [
...
],
"paging": {
"cursors": {
"after": "NDc4OQ==",
"before": "NDgyMg=="
},
"next": "https://graph.facebook.com/10150107083136229/comments?summary=1&limit=25&after=NDc4OQ\u00253D\u00253D"
},
"summary": {
"order": "ranked",
"total_count": 4822
}
}
}
}
In the "summary" section you can see there is a total_count which is the number of comments made on that URL.
So your process will be:
Loop through all the links you want to check
Hit the Facebook Graph API for that URL Extract the total_count response in the JSON and
store it (perhaps in a table)
Order the results on the number of comments descending, limiting to
only the first 5 results (if you're using MySQL then something like
SELECT * FROM whatever ORDER BY total_count DESC LIMIT 5)
Trying to create a wall post with photo attached. Photo is a Facebook-hosted photo within some album.
Problem here - Facebook won't allow including facebook-hosted content in posts ((#100) FBCDN image is not allowed in stream )
From the Web UI, it's possible to "Share" a photo on my wall - that's almost what i need but i don't know the Graph API equivalent for that operation (if there's any)
Any help appreciated.
The answer is "me/links"
passing http://www.facebook.com/photo.php?fbid=** as a link
With the Graph API you can share the photo as a link.
this is the documentation:
https://developers.facebook.com/docs/reference/api/user/#links
You need send a POST request to me/feed/. And indeed send the link: http://www.facebook.com/photo.php?fbid=[the id of the photo]
Make sure the publish_stream permission is allowed for the access_token.
with Jquery this is an example:
$.post(
'http://www.facebook.com/me/feed',
{
link: 'http://www.facebook.com/photo.php?fbid=[THE_PHOTO_ID],
access_token: [YOUR_ACCESS_TOKEN]
},
function(result) { console.log('shared'); },
'text'
);
This seems like a pretty obvious, basic thing to expect from the Graph API, but I'm having serious difficulty with it. All I want to do is get the ID for any particular URL. They have a method for this:
https://graph.facebook.com/?ids=http://www.imdb.com/title/tt0117500/
And that works great. But if I try another URL, say for my blog,
https://graph.facebook.com/?ids=http://dusda.vox.com
it doesn't give me back a numerical ID like all of the examples do. Instead, this:
{"http:\/\/dusda.vox.com":{"id":"http:\/\/dusda.vox.com"}}
If I try to use that "id", I get jack (probably because the query string looks impossible to parse):
Request: https://graph.facebook.com/http://dusda.vox.com/likes
Response: {"id":"http:\/\/dusda.vox.com\/likes"}
So what's up with this? Is the Graph API just selectively reliable, or am I misunderstanding something? I've tried it on URLs that I know are popular on Facebook, too, and I've gotten mixed results.
Try FQL for this;
http://graph.facebook.com/fql?q=select%20url%2C%20id%2C%20type%2C%20site%20from%20object_url%20where%20url%20%3D%20%22http%3A%2F%2Fkriek.hu%2F%22
returns:
{
"data": [
{
"url": "http://kriek.hu/",
"id": 497425470154,
"type": "link",
"site": "kriek.hu"
}
]
}
For more information, see object_url.
I hope it helps!
The ID is given by Facebook only to pages which have a fbshare/like button. Else the API returns the number of shares and the request URL.
If I use the facebook object debugger page I can scrape every url, for example:
https://developers.facebook.com/tools/debug/og/object?q=ddnl.de
The page give me back an url with ID and so I can get every needed parameters.
In this case https://graph.facebook.com/10150164108649475
But I don't get this ID or url with FQL or otherwise?
Very old question, but here's what I found works for me as none of the answers here really resolved my issue:
If you have a custom object tied to a url, the method suggested by Pepe only gives the id FB assigns to the url where type=link. (Which is not tied to any comments)
In my case, I need my custom object id so that I could pull associated comments from it. You can get the object id using FQL by doing a select on 'comments_fbid' from the 'link_stat' table. (This will return the object id even if no comments have been added so it should work for other cases)
api.facebook.com
At this time no of the suggested solutions work for all urls. Only the Debugger is able to get the Graph ID correctly
For example
Debugger:
https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.amazon.de%2Fgp%2Fproduct%2F3810510793%2F
For URL:
www.amazon.de/gp/product/3442465583/
Result:
https://graph.facebook.com/10150771435736113
{
"url": "http://www.amazon.de/dp/3810510793/ref=tsm_1_fb_lk",
"type": "book",
"title": "Die unwahrscheinliche Pilgerreise des Harold Fry: Roman",
"image": [
{
"url": "http://ecx.images-amazon.com/images/I/51I4E81xrRL._SL160_.jpg"
}
],
"description": "Die unwahrscheinliche Pilgerreise des Harold Fry: Roman",
"site_name": "Amazon.de",
"updated_time": "2012-12-19T16:54:27+0000",
"id": "10150771435736113",
"application": {
"id": "164734381262",
"name": "Amazon",
"url": "https://www.facebook.com/apps/application.php?id=164734381262"
}
}
I had the same problem here, I was trying to get the same data IMDB gets. After almost bang my head against the wall, I decided to look at the facebook's js function. And look what I get, the explanation is on the link.
Getting limited data from a page which has a Facebook ID
Peace