简体   繁体   English

Facebook评论(最新)使用Facebook graph API和Python

[英]Facebook reviews ( Most recent ) Using Facebook graph API and Python

I'm trying to get access to the data that appears under the reviews tab in the Facebook Page https://www.facebook.com/HRCMallOfAmerica/reviews (Specifically Most recent). 我试图访问显示在Facebook页面https://www.facebook.com/HRCMallOfAmerica/reviews (特别是最新)中的“评论”选项卡下的数据。

import json
import oauth2
import urllib
import urllib2
import psycopg2


url_params = {}
url_params['client_id'] = 'xxxxxxxxxxxxxxxxx'
url_params['client_secret'] = 'xxxxxxxxxxxxxxxxxxxxxxxxx'
url_params['grant_type'] = 'client_credentials'
host = 'graph.facebook.com/oauth/access_token'
encoded_params = urllib.urlencode(url_params)
url = 'https://%s?%s'%(host,encoded_params)
try:
    response = urllib2.urlopen(url)
    access_token = response.read().split('access_token')[1][1:]
except:
    print "Unable to get / parse the URL %s"%(url)
print 'ACCESS_TOKEN %s'%(access_token)

I can get their own feed by using the below url 我可以使用以下网址获取自己的供稿

url=https://graph.facebook.com/HRCMallOfAmerica/feed?access_token=xxxxxxxxx

while seeing the answer from the below question. 同时看到以下问题的答案。

Facebook "Reviews" Tab Data -- Where is it stored in Graph API and how to access it? Facebook“评论”选项卡数据-它存储在Graph API中的何处以及如何访问它?

I have call the urls called 我称这个网址为

http://graph.facebook.com/622086227888427/reviews

http://graph.facebook.com/622086227888427/reviews?limit=100000000&offset=0

But both urls throws same error like 但是两个网址都抛出相同的错误,例如

{
   "error": {
      "message": "Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
      "type": "GraphMethodException",
      "code": 100
   }
}

Thanks in advance. 提前致谢。

If you are the admin of this page, you can get it with graph API in the 'rating' node (more info here: https://developers.facebook.com/docs/graph-api/reference/page/ratings/ ): 如果您是此页面的管理员,则可以在“评级”节点中使用graph API进行获取(更多信息,请访问: https : //developers.facebook.com/docs/graph-api/reference/page/ratings/ ) :

GET /v2.5/{page-id}?fields=ratings HTTP/1.1
Host: graph.facebook.com

you can do this with python, using facebook-sdk. 您可以使用python,使用facebook-sdk进行此操作。

If you are not the admin of that page, you can't get that information using graph API. 如果您不是该页面的管理员,则无法使用graph API获得该信息。

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

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