如何从 Google 知识中获取社交媒体链接

How to get social media links from Google Knowledge

目前我正在做一个项目,需要我收集名人粉丝数量(来自 instagram 或 facebook)。

要得到那个数字,我必须得到
1.名人 Instagram link
2. 脸书名人 link
3. 向 instagram 或 facebook API 发送请求以获取他们的粉丝数

我一直在为名人 instagram 和 facebook link 研究 google 知识 API。但我从中得到的并不令人满意。 例如,我请求 google 知识,

https://kgsearch.googleapis.com/v1/entities:search?query=Ariana+Grande&limit=1&indent=1&key={API-CODE}

结果是

{"@context": {

"@vocab": "schema.org/",
"goog": "schema.googleapis.com/",
"EntitySearchResult": "goog:EntitySearchResult",
"detailedDescription": "goog:detailedDescription",
"resultScore": "goog:resultScore",
"kg": "g.co/kg"
},
"@type": "ItemList",
"itemListElement": [
{
"@type": "EntitySearchResult",
"result": {
"@id": "kg:/m/09gkdy4",
"name": "Ariana Grande",
"@type": [
"Thing",
"Person"
],
"description": "Singer",
"image": {
"contentUrl": "t0.gstatic.com/images?q=tbn:ANd9GcS3KH3ae6ChLCPLguyQXbLbEXDTNMZ1Sb2LsMx6Vr-pjeuHg5AZ",
"url": "da.wikipedia.org/wiki/Ariana_Grande",
"license": "creativecommons.org/licenses/by/2.0"
},
"detailedDescription": {
"articleBody": "Ariana Grande-Butera, known professionally as Ariana Grande, is an American singer and actress. She began her career in the Broadway musical 13, before landing the role of Cat Valentine on the Nickelodeon television series Victorious in 2009. ",
"url": "en.wikipedia.org/wiki/Ariana_Grande",
"license": "en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License"
},
"url": "www.arianagrande.com"
},
"resultScore": 802.862244
}
]
}

结果中没有关于她的 instagram 或 facebook link 的信息,但如果我们在 google 上手动搜索,它会在搜索结果中显示她的 instagram 和 facebook link。

我的问题是:
1. 有什么方法可以从 Google 知识中获得那些 link?
2. 或者有什么更简单的方法可以从我旁边的名人那里获得粉丝数量? (杂耍 2-3 个不同的 APIs)

谢谢。
我非常感谢任何评论和帮助。

您可以使用 wikidata.org。有步骤:

  1. 搜索https://www.wikidata.org/w/api.php?action=wbsearchentities&search=Ariana+Grande&language=en&format=json

    {"searchinfo":{"search":"Ariana Grande"},"search":[{"id":"Q151892","concepturi":"http://www.wikidata.org/entity/Q151892","url":"//www.wikidata.org/wiki/Q151892","title":"Q151892","pageid": 153289,"label":"Ariana Grande","description":"American actress, singer, composer and dancer","match":{"type":"label","language" :"en","text":"Ariana Grande"}}],"success":1}

  2. 从响应中获取 id Q151892 并获取实体 https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q151892&format=json&props=claims

反响很大。您需要声明列表中声明 P2003 的值 arianagrande。它指的是 Instagram 用户名(P2013 对于 Facebook)

  1. https://www.instagram.com/arianagrande/?__a=1

    获取public信息
    user:
    follows:
        count
    followed_by:
        count
    media:
        count