刮痧文章分享数量

时间:2018-04-23 11:51:55

标签: python facebook-graph-api web-scraping

我正在使用this和python抓取文章共享特定网站的数量,但它有限制,而且速度非常慢。我是否需要应用程序访问令牌或用户aces令牌才能通过Facebook API获取此数据?还有我如何进行身份验证?我应该在网址中附加令牌吗?我的代码:

try:
    OpenGraphURL = 'https://graph.facebook.com/?id=' +str(adres)
    fbComments = requests.get(OpenGraphURL, timeout=30)
    data = json.loads(fbComments.text)
    shary = str(data["share"]['share_count'])
    print(shary)

1 个答案:

答案 0 :(得分:1)

“我应该在网址中附加令牌吗” - 是的,当然:

https://graph.facebook.com/?id=' + str(adres) + '&access_token=' + str(accessToken)

尝试使用App令牌,用户令牌永远无效。

有关令牌的更多信息: