开发者

How can i get all likes for all urls on my domain?

I have a website with a ton of product pages and every page has a like button. Is there any way for me to get a list of all liked 开发者_StackOverflowurl's on my domain from Facebook?

Currently I have to do a loop that requests the page from graph.facebook.com and checks the amount of likes. This ends upp with several thousand requests and is really bad. You can add a few urls in the same request to facebook, but it still doesn't change much.


Turn your list of url's into an array and run as a batch api job

docs http://developers.facebook.com/docs/reference/api/batch/

curl \
    –F 'access_token=…' \
    -F 'batch=[ \
            {"method": "GET", "relative_url": "?id=URL1"}, \
            {"method": "GET", "relative_url": "?id=URL2"}, \
            {"method": "GET", "relative_url": "?id=URL3"}, \
            {"method": "GET", "relative_url": "?id=URL4"}, \
            {"method": "GET", "relative_url": "?id=URL5"} \
        ]'\
    https://graph.facebook.com

or using fql link_stat in batch

curl \
     -F 'access_token=…' \
     -F 'batch=[ \
{ "method": "POST", "relative_url": "method/fql.query?query=select+like_count+from+link_stat+where+url+in("url1","url2","url3","url5","url6")", }, \
{ "method": "POST", "relative_url": "method/fql.query?query=select+like_count+from+link_stat+where+url+in("url7","url8","url9","url10","url11")", } \
]'\
https://graph.facebook.com
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜