Facebook API - 检索URL的喜欢

时间:2012-10-15 17:32:51

标签: facebook json api request facebook-fql

我正在尝试通过FQL执行此操作,但我认为我正在从错误的数据库或其他内容中检索信息。

使用此FB像iframe一样“喜欢”网址:

<iframe src="//www.facebook.com/plugins/like.php?href=http://shop.sinkorswimbrand.com/product/sink-or-swim-snapback&amp;send=false&amp;layout=button_count&amp;width=46&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21" onclick="javascript:updateLikes();" style="border:none; overflow:hidden; width:46px; height:21px;" allowtransparency="true" frameborder="0" scrolling="no"></iframe>

使用此FQL URL检索URL上的JSON信息:

https://api.facebook.com/method/fql.query?query=select total_count,like_count,comment_count,share_count,click_count from link_stat where url='http://shop.sinkorswimbrand.com/product/sink-or-swim-snapback'&format=json

返回:--- 注意:我确保自己“喜欢”这个。

[{"total_count":0,"like_count":0,"comment_count":0,"share_count":0,"click_count":0}]

对Facebook有更多经验的人有没有这方面的经验?提前谢谢!

1 个答案:

答案 0 :(得分:2)

问题出在你的og:meta标签中。您生成的来源的第31行上的此标记:

<meta property="og:url" content="http://www.sinkorswimbrand.com" />

这告诉Facebook将此页面的所有喜欢聚合到www.sinkorswimbrand.com结果中。

如果您查看debugger results for your URL的“重定向路径”部分,就可以看到此内容。

如果您希望每个产品页面都喜欢,则您的网站每个页面都需要唯一的og:url标记。

此外,您正在使用已弃用的网址进行FQL查询。您应该使用https://graph.facebook.com/fql?q=...

相关问题