FacebookのGraphAPI(v2.9)を利用してあるページのいいね、シェアの数を別々に取るには
https://graph.facebook.com/v2.9?fields=engagement&id='好きなページのURL'&access_token=your_app_id|your_app_secret
でjsonとして取得できます。
https://graph.facebook.com/v2.9?fields=engagement&ids=http%3A%2F%2Fwww.google.com,http%3A%2F%2Fyahoo.co.jp&access_token=...
と投げると
{
"http://www.google.com": {
"engagement": {
"reaction_count": 26352558,
"comment_count": 2668809,
"share_count": 13307331,
"comment_plugin_count": 2
},
"id": "http://www.google.com"
},
"http://yahoo.co.jp": {
"engagement": {
"reaction_count": 191,
"comment_count": 42,
"share_count": 4586,
"comment_plugin_count": 2
},
"id": "http://yahoo.co.jp"
}
}
複数のページについても結果を返してくれます。
このなかで”reaction_count”がいいねの回数,”share_count”がシェア数を表しています。


