Google Freebase API一次获取名称、图像和文本


Google Freebase API to fetch Name, Image and Text at once

目前我所做的是调用以下API

$url    = 'https://www.googleapis.com/freebase/v1/search?query='. $query; // to fetch name and id

使用上面API结果中的id,我又执行了两个API来获得文本和图像

$url = 'https://usercontent.googleapis.com/freebase/v1/image' . $entity_id; // to fecth image
$url    = 'https://www.googleapis.com/freebase/v1/text/' . $entity_id; // to fetch description

有没有免费的API/网址,这样,我一次得到所有这三个?????

您永远不会在同一个调用中获得不同的媒体类型(例如JPEG和JSON),但您可以使用搜索API输出参数来获得名称、文本简介和图像URL。图像仍然需要单独提取。

例如,如果您想要日语的名称和描述&英语以及与搜索词"Barack Obama"匹配的主题图片,你可以使用以下查询:

https://www.googleapis.com/freebase/v1/search?query=%22Barack%20Obama%22&indent=true&输出=%28%20name%20description%3wikipedia%20/common/topic/image%29&lang=en%2Cja

这也会返回像他的就职典礼这样的主题,所以如果你提前知道的话,你可以按类型进行筛选,或者如果你知道的话可以使用主题ID或MID进行查询。

据我所知,这是不可能的。