1

我想获取我网站中每个 url 的实时 Facebook 共享计数,以便我可以显示它。

我找到了两种方法:

  1. 像这样使用facebook restserver.php

http://api.facebook.com/restserver.php?method=links.getStats&urls=https://www.daltravel.ro/circuit/Circuit-Anglia-Scotia-Irlanda

它返回这个:

<links_getStats_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd" list="true">
<link_stat>
<url>
https://www.daltravel.ro/circuit/Circuit-Anglia-Scotia-Irlanda
</url>
<normalized_url>
https://www.daltravel.ro/circuit/Circuit-Anglia-Scotia-Irlanda
</normalized_url>
<share_count>0</share_count>
<like_count>0</like_count>
<comment_count>0</comment_count>
<total_count>0</total_count>
<click_count>0</click_count>
<comments_fbid>1084234134929324</comments_fbid>
<commentsbox_count>0</commentsbox_count>
</link_stat>
</links_getStats_response>
  1. 使用garph api,如下所示:

https://graph.facebook.com/v2.5/https://www.daltravel.ro/circuit/Circuit-Anglia-Scotia-Irlanda?access_token=ACCESS_TOKEN _

它返回如下:

{
   "og_object": {
      "id": "1084234134929324",
      "description": "Marea Britanie si Irlanda. Marea Britanie spune povestea a trei tari: Anglia, Scotia si Tara Galilor, in care castelele, catedralele pub-uri sunt cu adevarat fermecatoare. In Irlanda va bucurati de peisaje naturale uluitoare, dar si de legende stravechi.",
      "title": "Dal Travel - agentia devoratorilor de turism",
      "type": "website",
      "updated_time": "2016-01-10T12:20:56+0000",
      "url": "https://www.daltravel.ro/circuit/Circuit-Anglia-Scotia-Irlanda"
   },
   "share": {
      "comment_count": 0,
      "share_count": 0
   },
   "id": "https://www.daltravel.ro/circuit/Circuit-Anglia-Scotia-Irlanda"
}

两种方法都显示 0 计数,尽管我多次分享。使用第二种方法,我还得到了 "updated_time": "2016-01-10T12:20:56+0000" 值。

如何获取最新信息?

谢谢 !

4

0 回答 0