简体   繁体   English

Graph API如何获取Facebook页面成员/喜欢

[英]Graph API how get facebook page members/likes

在此处输入图片说明 Facebook like check Facebook喜欢支票

I've found an interesting app . 我找到了一个有趣的应用程序。 This fb-app get all likes from any fanpage and sort it by mass and country! 这个fb-app可以从任何粉丝页面获得所有赞,并按质量和国家/地区对它进行排序!

My question: 我的问题:

how do these app get the data from the graph api ? 这些应用程序如何从图api获取数据?

First: get the fanpage-object no access token needed 第一:获取fanpage对象,无需访问令牌

https://graph.facebook.com/cocacola/ https://graph.facebook.com/cocacola/

{
   "about": "The Coca-Cola Facebook Page is a collection of your stories showing how people from around the world have helped make Coke into what it is today.",
   "checkins": 146,
   "description": "Created in 1886 in Atlanta, Georgia, by Dr. John S. Pemberton, Coca-Cola was first offered as a fountain beverage at Jacob's Pharmacy by mixing Coca-Cola syrup with carbonated water. \n\nCoca-Cola was patented in 1887, registered as a trademark in 1893 and by 1895 it was being sold in every state and territory in the United States. In 1899, The Coca-Cola Company began franchised bottling operations in the United States. \n\nCoca-Cola might owe its origins to the United States, but its popularity has made it truly universal. Today, you can find Coca-Cola in virtually every part of the world.\n\nCoca-Cola Page House Rules: http://CokeURL.com/q28a",
   "founded": "1886",
   "is_published": true,
   "location": {
      "street": "",
      "zip": "",
      "latitude": 48.886763644968,
      "longitude": 2.2428464993582
      },
  "talking_about_count": 903212,
  "username": "coca-cola",
  "website": "http://www.coca-cola.com",
  "were_here_count": 0,
  "category": "Food/beverages",
  "id": "40796308305",
  "name": "Coca-Cola",
  "link": "https://www.facebook.com/coca-cola",
  "likes": 58345623, 
  "cover": {
     "cover_id": "10152037156953306",
     "source": "http://sphotos-b.ak.fbcdn.net/hphotos-ak-ash4/s720x720/602289_10152037156953306_1443207674_n.jpg",
     "offset_y": 0
  }
}

second : get the likes from the facebook object: 第二 :从facebook对象中获得赞:

https://graph.facebook.com/cocacola/likes?access_token=xxxxxxx https://graph.facebook.com/cocacola/likes?access_token=xxxxxxx

now i will receive all fan-page which "cocacola" like, but i need all users which like cocacola! 现在我将收到所有喜欢“可口可乐”的粉丝页面,但我需要所有喜欢可口可乐的用户!

Maby its only possible with FQL Query ? Maby只能用FQL查询吗?

With FB 2.6 API you can get total likes with fan_count field. 使用FB 2.6 API,您可以通过fan_count字段获得全部fan_count

http://graph.facebook.com/cocacola/?fields=fan_count&access_token= {value} http://graph.facebook.com/cocacola/?fields=fan_count&access_token= {value}

Facebook will not give you a list of users who like a page. Facebook不会为您提供喜欢页面的用户列表。 You don't need this to create this app. 您无需此即可创建此应用。 You can get this data by querying publicly available insights data. 您可以通过查询公开可用的见解数据来获取此数据。

This URL will get you the raw data this app uses to create this graph: 此URL将为您提供该应用程序用来创建此图的原始数据:

https://graph.facebook.com/cocacola/insights/page_fans_country?access_token=XXXXXX

You can get this information with any valid access_token . 您可以使用任何有效的access_token获取此信息。

https://graph.facebook.com/cocacola/?fields=fan_count&access_token=####### https://graph.facebook.com/cocacola/?fields=fan_count&access_token=#######

You can get the facebook page member likes using the field fan_count. 您可以使用fan_count字段获得喜欢的Facebook页面成员。 But you have to pass page access token rather than the user access_token. 但是您必须传递页面访问令牌,而不是用户access_token。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM