2010年8月12日 星期四

Facebook取得某個網頁被按了多少次「讚」及有誰按「讚」


之前因為沒特別有這個需求,因此就沒去測,今天測了一下,發現有點有趣。
拿我blog裡其中一篇文章來測的話,這篇:http://blog.iamjason.com/2010/07/aniclip.html

基本上要取得讚的東西應該都是直接走FQL了,所以我先去object_url這個table取得對映到這個網址的object_url:
Select id from object_url where url='http://blog.iamjason.com/2010/07/aniclip.html'

跑出來的結果得到這個網址的object_id=410602097134。
然後再去like這個table撈一下有哪些人按過讚:
Select user_id from like where object_id=410602097134

出來的筆數有三筆,可是facebook的social plugin顯示的是四筆,查到的三個人裡面有兩個是我的朋友,另一不是,我猜最後那個「失蹤」的使用者可能隱私權設得比較高吧?
因此看樣子不能直接從這裡得到按了讚的總人數,因為可能會有誤差。

所以如果要得到按讚的總人數,就只好透過link_stat這個table了:
Select like_count from link_stat where url='http://blog.iamjason.com/2010/07/aniclip.html'

這樣出來的結果就正確了。

至於能不能不透過social plugin就可以按讚(例如在flash裡)?
目前似乎沒有開放,但是既然都是透過http在傳資料,很多東西都是有跡可循的,以下這篇(http://labs.byhook.com/2010/08/03/facebook-like-button-in-flash/)就是觀察按了讚之後送出的資料來反推,再去判斷從flash裡要送出哪些參數,但是作者也說了,他很多參數不知道是代表什麼意思,只是盡量讓它能work而已。
所以我暫時不打算去試,就看facebook到時會不會開放了。
不開放就再做打算…><。








I was trying to get the users list who had clicked the “like” button, and found something interesting.

Take one of my article here for example. I have to query the ‘object_url’ table first to get the object_id for the article:
Select id from object_url where url='http://blog.iamjason.com/2010/07/aniclip.html'

The value return is ‘410602097134’.
So now we can use this object_id to get the user_id from ‘like’ table:
Select user_id from like where object_id=410602097134

There are three users. Two of them are my friends and one is not. But the number is not correct, since the like social plugin shows that there are four people had clicked it. I think perhaps it’s because of the user’s privacy settings.
Hence, it seems that it’s not safe to get the like number from ‘like’ table.
So I tried to query ‘link_stat’ for correct result:
Select like_count from link_stat where url='http://blog.iamjason.com/2010/07/aniclip.html'

Yes, the result is correct now.

I’ve never tried to send like via flash, and it seems that facebook don’t want us to do so yet. But someone here(http://labs.byhook.com/2010/08/03/facebook-like-button-in-flash/) had successfully send a like to facebook in flash. By observing the http request when we click the like button, we can find out what parameters are posting to facebook, and then we can simulate the similar parameters in flash. But as the author said, he doesn’t know what those parameters are, so please use it carefully if you want to do so.

9 則留言:

  1. 我記得查like不但有隱私權問題,而且也只能查到最新幾筆(好像是5筆?)的uid,朋友的優先。記得那時候查到Facebook的想法是:知道1234個人按讚是有意義的,但知道這1234人是沒意義的...大概是這樣

    回覆刪除
  2. 原來如此,感謝Gray的解答~

    回覆刪除
  3. 可是...他應該會記錄這1234人是誰啊?
    不然就可以重複按讚了耶?

    回覆刪除
  4. 他會記錄,但他不一定會告訴你這1234個人分別是誰.

    回覆刪除
  5. 請問我要如何知道我的部落格按讚的名單?

    回覆刪除
  6. 你好,我在尋找faceapp外包廠商人才,可以和我聯絡?
    robby206@gmail.com

    回覆刪除
  7. 請問要怎查按讚人數阿?
    我發現這能看讚人數 https://developers.facebook.com/docs/reference/plugins/like/
    把網址輸入上去右邊就會跳出來
    但要如何把它找出來?
    有網址嗎?

    回覆刪除
  8. 請問一下如何看myspace誰按讚?不是MSN的喔是www.myspace.com
    拜託指教一下,你寫的我有看但是看不懂要怎麼操作

    回覆刪除
  9. 請問是否需要大量的粉絲團、社團、文章、影片讚呢?
    粉絲團5000個讚只需一千元,兩天內幫您完成唷
    全球實際用戶,讓您的粉絲團文章商品..等看起來更有人氣
    同時也可增加說服力

    我們另外提供了多項化的按讚即衝人氣服務
    如有需要麻煩您請回覆!

    我們可進行更詳細的解說
    以下為我們的粉絲團可參考看看
    https://www.facebook.com/vveevvrry

    EM:loveyoucomtw@gmail.com
    LINE-ID:time2030

    回覆刪除