Google Freebase API如何获取图像的URL? [英] Google Freebase API How To Get URL Of Image?
问题描述
https://www.googleapis.com/freebase/v1sandbox/topic/%2Fen%2Fsan_francisco?key=MY_API_KEY
例如:
{
text:旧金山天际线,
lang: en,
id:/ m / 04j74yh,
创建者:/ user / carmenmfenn1,
时间戳:2008-09-01T13:37:22.000Z
$ / code>
所以我再次调用GET API来获取图像:
https://www.googleapis.com / freebase / v1sandbox / topic /%2Fm%2F04j74yh?key = MY_API_KEY
这会返回大量关于图片的信息,例如媒体类型,大小等。但我没有看到任何网址。有一些ID(blob id,mid)。我不知道如何继续获取图片的网址。任何想法?
这是完整的回应:
{
id:/ m / 04j74yh,
property:{
/ common / image / appear_in_topic_gallery:{
valueetype:object,
values:[
{
text:旧金山,
lang:en,
id:/ m / 0d6lp,
创建者:/ user / carmenmfenn1,
timestamp:2008-09-01T13:37:22.000Z
}
],
count:1
},
/ common / image / size:{
valuetype:compound,
values:[
{
text:640.0 - 330.0 - Freebase Data Team - Rectangle Size,
lang :en,
id:/ m / 02bpzld,
创建者:/ user / carmenmfenn1,
timestamp:2008-09-01 T13:37:22.000Z,
财产:{
/ measurement_unit / rect_size / x:{
valueType:float,
values:[
{
text:640.0,
lang:en,
值:640,
创建者:/ user / mwcl_images,
timestamp:2007-04 -15T23:03:01.001Z
,
count:1
},
/ measurement_unit / rect_size / y:{
valuetype: float,
值:[
{
text:330.0,
lang:en,
value:330,
creator:/ user / mwcl_images,
timestamp:2007-04-15T23:03:01.001Z
}
],
count:1
},
/ type / object / attribution:{
valueetype:object,
values:[
$ b text:Freebase Data Team,
lang:en,
id:/ m / 0220tm0,
创建者:/ user / mwcl_images ,
timestamp:2007-04-15T23:03:01.001Z
}
],
计数:1
},
/ type / object / type:{
valueType:object,
values:[
{
text: Rectangle Size,
lang:en,
id:/ measurement_unit / rect_size,
creator:/ user / mwcl_images,
timestamp:2007-04 -15T23:03:01.001Z
,
count:1
}
}
}
],
计数:1
},
/ common / licensed_object / license:{
valueetype:object,
values:[
{
text:CC-BY-2.5,
lang:en,
id:/ m / 01xrw11,
创建者:/ user / carmenmfenn1,
时间戳: 2008-09-01T13:37:22.000Z
}
],
count:1
},
/ common / topic / notable_for:{
valueetype:object,
values:[
{
text:Content,
lang:en,
id:/ type /内容
}
,
count:1
},
/ common / topic / notable_types:{
valueetype:object,
值:[
{
text:Content,
lang:en,
id:/ type / content,
timestamp: 2013-05-17T00:04:43.942Z
}
,
count:1
},
/ type / content / blob_id:{
valueetype:string,
values:[
{
文字: 8debf723b25edb43b413bcb2890c4f4fe6ec5e5b2c7ce9c7e1f2aee273b0d0fe,
浪: ,
值: 8debf723b25edb43b413bcb2890c4f4fe6ec5e5b2c7ce9c7e1f2aee273b0d0fe,
创作者: /用户/ content_administrator,
时间戳:2008-09-01T13 :37:20.000Z
}
,
count:1
},
/ type / content / length:{
valueType:int ,
values:[
{
text:47162,
lang:en,
value:47162,
creator:/ user / content_administrator,
timestamp:2008-09-01T13:37:20.000Z
}
],
count:1
},
/ type / content / media_type:{
valueetype:object,
values:[
{
text:image / jpeg,
lang:en,
id:/ m / 08x8,
创建者:/ user / content_administrator ,
timestamp:2008-09-01T13:37:20.000Z
}
],
count:1
},
/ type / object / attribution:{
valuetype:object,
values:[
{
text:Freebase Staff,
lang:en,
id:/ m / 05g,
创建者:/ user / content_administrator,
时间戳:2008-09-01T13:37:20.000Z
}
],
count:1
},
/ type / object / mid:{
valueetype:key,
values:[
{
text:/ m / 04j74yh,
lang: ,
value:/ m / 04j74yh
}
],
count:1
},
/ type / object / name:{
valueype:string,
values:[
{
text:旧金山天际线,
lang:en,
值: 旧金山天际线,
创建者:/ user / carmenmfenn1,
时间戳:2008-09-01T13:42:34.000Z
}
],
count:1
},
/ type / object / type:{
valueetype:object,
values:[
{
text :图片,
lang:en,
id:/ common / image,
创建者:/ user / content_administrator,
时间戳:2008-09-01T13:37:20.000Z
},
{
text:Content,
lang:en,
id:/ type / content,
creator:/ user / content_administrator,
timestamp:2008-09-01T13:37:20.000Z
}
],
count:2
},
/ type / object / guid:{
valuetype:string,
values:[
{
text:#9202a8c04000641f80000000090393af,
lang:,
value:#9202a8c04000641f80000000090393af
}
],
count:1
},
/ type / object / creator:{
valuetype: object,
values:[
{
text:content_administrator,
lang:,
id:/ user / content_administrator,
timestamp:2008-09-01T13:37:20.000Z
}
],
count:1
},
/ type / object / timestamp :{
valueype:datetime,
values:[
{
text:2008-09-01T13:37:20.000Z,
lang: en,
值:2008-09-01T13:37:20.000Z
}
],
count:1
},
/类型/对象/权限:{
valueetype:object,
values:[
{
text:/ boot / all_permission,
lang: ,
id:/ boot / all_permission
}
],
count:1
}
}
}
由于它没有自己的部分,而是从Topic API文档中引用,但您可以在这里找到必要的信息
网址格式为:
https://usercontent.googleapis.com/freebase / v1 / image /<图像ID>
So, I am trying to figure out how to get URL to an image in Freebase database. I want an image of San Francisco. This is how I get the San Francisco topic:
https://www.googleapis.com/freebase/v1sandbox/topic/%2Fen%2Fsan_francisco?key=MY_API_KEY
The response contains images, for example:
{
text: "San Francisco Skyline",
lang: "en",
id: "/m/04j74yh",
creator: "/user/carmenmfenn1",
timestamp: "2008-09-01T13:37:22.000Z"
}
So I then call the GET API again to get the image:
https://www.googleapis.com/freebase/v1sandbox/topic/%2Fm%2F04j74yh?key=MY_API_KEY
This returns lots of information about the image such as media type, size etc. But I don't see any URL there. There are some IDs (blob id, mid). I am not sure how to proceed to get a URL to the image. Any ideas?
This is the full response:
{
id: "/m/04j74yh",
property: {
/common/image/appears_in_topic_gallery: {
valuetype: "object",
values: [
{
text: "San Francisco",
lang: "en",
id: "/m/0d6lp",
creator: "/user/carmenmfenn1",
timestamp: "2008-09-01T13:37:22.000Z"
}
],
count: 1
},
/common/image/size: {
valuetype: "compound",
values: [
{
text: "640.0 - 330.0 - Freebase Data Team - Rectangle Size",
lang: "en",
id: "/m/02bpzld",
creator: "/user/carmenmfenn1",
timestamp: "2008-09-01T13:37:22.000Z",
property: {
/measurement_unit/rect_size/x: {
valuetype: "float",
values: [
{
text: "640.0",
lang: "en",
value: 640,
creator: "/user/mwcl_images",
timestamp: "2007-04-15T23:03:01.001Z"
}
],
count: 1
},
/measurement_unit/rect_size/y: {
valuetype: "float",
values: [
{
text: "330.0",
lang: "en",
value: 330,
creator: "/user/mwcl_images",
timestamp: "2007-04-15T23:03:01.001Z"
}
],
count: 1
},
/type/object/attribution: {
valuetype: "object",
values: [
{
text: "Freebase Data Team",
lang: "en",
id: "/m/0220tm0",
creator: "/user/mwcl_images",
timestamp: "2007-04-15T23:03:01.001Z"
}
],
count: 1
},
/type/object/type: {
valuetype: "object",
values: [
{
text: "Rectangle Size",
lang: "en",
id: "/measurement_unit/rect_size",
creator: "/user/mwcl_images",
timestamp: "2007-04-15T23:03:01.001Z"
}
],
count: 1
}
}
}
],
count: 1
},
/common/licensed_object/license: {
valuetype: "object",
values: [
{
text: "CC-BY-2.5",
lang: "en",
id: "/m/01xrw11",
creator: "/user/carmenmfenn1",
timestamp: "2008-09-01T13:37:22.000Z"
}
],
count: 1
},
/common/topic/notable_for: {
valuetype: "object",
values: [
{
text: "Content",
lang: "en",
id: "/type/content"
}
],
count: 1
},
/common/topic/notable_types: {
valuetype: "object",
values: [
{
text: "Content",
lang: "en",
id: "/type/content",
timestamp: "2013-05-17T00:04:43.942Z"
}
],
count: 1
},
/type/content/blob_id: {
valuetype: "string",
values: [
{
text: "8debf723b25edb43b413bcb2890c4f4fe6ec5e5b2c7ce9c7e1f2aee273b0d0fe",
lang: "",
value: "8debf723b25edb43b413bcb2890c4f4fe6ec5e5b2c7ce9c7e1f2aee273b0d0fe",
creator: "/user/content_administrator",
timestamp: "2008-09-01T13:37:20.000Z"
}
],
count: 1
},
/type/content/length: {
valuetype: "int",
values: [
{
text: "47162",
lang: "en",
value: 47162,
creator: "/user/content_administrator",
timestamp: "2008-09-01T13:37:20.000Z"
}
],
count: 1
},
/type/content/media_type: {
valuetype: "object",
values: [
{
text: "image/jpeg",
lang: "en",
id: "/m/08x8",
creator: "/user/content_administrator",
timestamp: "2008-09-01T13:37:20.000Z"
}
],
count: 1
},
/type/object/attribution: {
valuetype: "object",
values: [
{
text: "Freebase Staff",
lang: "en",
id: "/m/05g",
creator: "/user/content_administrator",
timestamp: "2008-09-01T13:37:20.000Z"
}
],
count: 1
},
/type/object/mid: {
valuetype: "key",
values: [
{
text: "/m/04j74yh",
lang: "",
value: "/m/04j74yh"
}
],
count: 1
},
/type/object/name: {
valuetype: "string",
values: [
{
text: "San Francisco Skyline",
lang: "en",
value: "San Francisco Skyline",
creator: "/user/carmenmfenn1",
timestamp: "2008-09-01T13:42:34.000Z"
}
],
count: 1
},
/type/object/type: {
valuetype: "object",
values: [
{
text: "Image",
lang: "en",
id: "/common/image",
creator: "/user/content_administrator",
timestamp: "2008-09-01T13:37:20.000Z"
},
{
text: "Content",
lang: "en",
id: "/type/content",
creator: "/user/content_administrator",
timestamp: "2008-09-01T13:37:20.000Z"
}
],
count: 2
},
/type/object/guid: {
valuetype: "string",
values: [
{
text: "#9202a8c04000641f80000000090393af",
lang: "",
value: "#9202a8c04000641f80000000090393af"
}
],
count: 1
},
/type/object/creator: {
valuetype: "object",
values: [
{
text: "content_administrator",
lang: "",
id: "/user/content_administrator",
timestamp: "2008-09-01T13:37:20.000Z"
}
],
count: 1
},
/type/object/timestamp: {
valuetype: "datetime",
values: [
{
text: "2008-09-01T13:37:20.000Z",
lang: "en",
value: "2008-09-01T13:37:20.000Z"
}
],
count: 1
},
/type/object/permission: {
valuetype: "object",
values: [
{
text: "/boot/all_permission",
lang: "",
id: "/boot/all_permission"
}
],
count: 1
}
}
}
It's kind of buried in the documentation since it doesn't have a section of its own, but is instead referenced from the Topic API documentation, but you can find the necessary info here
URLs are of the form:
https://usercontent.googleapis.com/freebase/v1/image/<image ID>
这篇关于Google Freebase API如何获取图像的URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!