通過使用圖表Facebook API我試圖找到與特定關鍵字相關的所有公共內容。如何使用Facebook社交圖譜API搜索查找評論數量和評論列表?
https://graph.facebook.com/search?q=obama&type=post
我得到的結果如我所料,但最近我也想找到的寶貴意見及具體結果個體意見的列表中的號碼。
這是上面的API調用的輸出示例:
{
"id": "1372608125_2297171713409",
"from": {
"name": "xxxx",
"id": "1372608125"
},
"message": "Originaly posted by:Anthony McMahan\n\n Political breakdown time....\n \nToday is short one, here is some information that will floor you if you werent aware of it yet. The United States of America makes approximately 15 trillion dollars annually GDP. Our debt has recently tipped over 15 trillion in recent days. So we now owe more than we make in a year. \n\nTo further add to the fury, medical facilities in the USA account for 1/6 of our GDP, so about 2.5 trillion dollars are brought in from hospitals across the US. the new healthcare bill is a stretch for the givernment to take control of all medical facilities in the US, which would basically cancel out 1/6 of our income as the healthcare would be made available to everyone. Therefore in light of the US being in more debt than we could make in a year, the plan is to take away 1/6 of our ability to make money. Imagine being in credit card debt and having to take a pay cut at work, because you chose to work in the mailroom instead of a cubicle. thats what is going on here in allegory. i would just like to take this time to say, \"thank you mr obama for making this country a laughing stock in the eyes of all our enemies and foreign nations, you'd make Karl Marx and Vladimir Lenin all too proud.\" \n\nUntil tomorrow........",
"type": "status",
"created_time": "2011-12-15T06:02:51+0000",
"updated_time": "2011-12-15T06:02:51+0000"
}
假設我要找到與該帖子的評論的評論的數量和名單。我應該使用另一個API調用嗎?
是否可以直接在「圖形API搜索」中直接瞭解註釋的數量,而無需調用其他API?我需要這個,所以如果一個帖子有評論,我會運行另一個API來獲取評論列表,否則我不需要運行額外的API調用。
據我所知獲得個人意見,我需要運行下面的API調用的列表:
http://graph.facebook.com/1372608125_2297171713409/comments
是正確的方式來做到這一點?在這裏,我也沒有得到任何線索,無論這個職位是否真的有意見。
實際上,我希望得到類似的特徵,因爲Google+的API有地方中的一個搜索API調用,我可以得到的答覆(評論)的數量如下所示:
"replies": {
"totalItems": 53,
"selfLink": "https://www.googleapis.com/plus/v1/activities/z13rhfhjzzm4ztrnt22kwpgglsrjdfra504/comments"
},
該API調用返回的評論的數量?我試圖使用/ id/comments調用,但它給了我一個空的結果。這是否意味着該帖子沒有評論? – 2011-12-15 08:24:54
是的。如果/ id/comments返回空結果,則該帖子爲空。您應該能夠使用您編碼的語言的函數來檢查此調用返回的結果數量。如果它說有0,那麼沒有任何評論。 – 2011-12-15 16:54:59
謝謝。我仍在等待其他解決方案,這可以消除對沒有評論的帖子進行不必要的檢查。 – 2011-12-16 02:20:22