官术网_书友最值得收藏!

  • Python Social Media Analytics
  • Siddhartha Chatterjee Michal Krystyanczuk
  • 174字
  • 2021-07-15 17:24:58

Selecting the endpoint

The main endpoint for Graph API which permits to access the Facebook resources. However, we have to specify which node we want to query and the other parameters we send to the API.

url = 'https://graph.facebook.com/v2.8/' 

We will use version 2.8 of Facebook Graph API. There are small differences between versions, mostly in available endpoints, resources, and parameters. We use the basic functionalities of this API so switching between versions should not cause any problems in terms of endpoints and resources, but we have to check the documentation to pass the right arguments.

The are several scenarios we might be interested in. The first one is retrieving all the comments from a public page of a brand:

page_url = 'https://graph.facebook.com/v2.8/{page-id}/feed' 

An example using Mercedes Benz France:

page_url = 'https://graph.facebook.com/v2.8/MercedesBenzFrance/feed' 

In some cases, {page-id} may be represented by a number.

We can use the same logic to access another kind of resource such as photos for example:

page_url = 'https://graph.facebook.com/v2.8/{page-id}/photos' 

All available resources are described in the official documentation for the API.

主站蜘蛛池模板: 金寨县| 永定县| 疏勒县| 富平县| 常山县| 广元市| 惠水县| 曲松县| 林芝县| 昌平区| 龙岩市| 工布江达县| 沭阳县| 柘荣县| 南京市| 无棣县| 寿光市| 平昌县| 丽江市| 西林县| 玉环县| 东乡| 金秀| 汽车| 琼海市| 汝阳县| 洪洞县| 武威市| 利川市| 姚安县| 颍上县| 达日县| 喀什市| 徐汇区| 合阳县| 玉山县| 宣武区| 嘉鱼县| 仙桃市| 汉阴县| 塔城市|