Relative Content

Tag Archive for facebookfacebook-graph-apioauth-2.0

auth error while fetching comments from a facebook page

import requests import pandas as pd import json page_id = “61554487605477” post_id = “122107628540149586” access_token = ‘EAAPaIduWx3MBOwj4GBHjpt6xjMRxncIvfCYNNqlWGHDaURhZC1AeDyb3MLjNpz8WbyzyuI84nIVffDxAxnKiyPZA0PvdX45fHQkq0oXz2YI9y41SF1tI2HYDBZAD15CftytfiC9QeBb0dlZCNoDGKvSzf6CAZBnZBBxfHusaFUIeRPtPonZCUV660y0VgNwQFGnVVibWMlJMtZB99G5l5OaiXN1JbD1ySHbZAQowtiMZD’ # your access token, from https://developers.facebook.com/tools/explorer/ url = f’https://graph.facebook.com/v16.0/{page_id}_{post_id}/comments?access_token={access_token}’ response = requests.request(“GET”, url) # save name, time, message in excel file data = json.loads(response.text) # create object with only name, time, message print(data) def get_comment_text(comment): return ‘{} ‘.format(comment[“message”].replace(“n”, […]