2015-10-19 100 views

回答

0

退房的Youtube Google API Explorer,特別是youtube.videos.list服務。如果您發出如https://www.googleapis.com/youtube/v3/videos?part=id&id=VIDEO_ID的請求,(你必須通過身份驗證),它應該返回與items屬性下的視頻信息的響應。如果items爲空,則具有該ID的視頻不存在。舉例來說,一個有效的視頻可能會返回一個像這樣的JSON響應:

{ 
"kind": "youtube#videoListResponse", 
"etag": "\"fpJ9onbY0Rl_LqYLG6rOCJ9h9N8/2sdqvy58GwqpgneamWQjMdcDsqc\"", 
"pageInfo": { 
    "totalResults": 1, 
    "resultsPerPage": 1 
}, 
"items": [ 
    { 
    "kind": "youtube#video", 
    "etag": "\"fpJ9onbY0Rl_LqYLG6rOCJ9h9N8/u5C_LXE-00OOvmXch-wqbcTQQ5Q\"", 
    "id": "VapbvTq8GOE" 
    } 
] 
} 

但如果視頻ID無效,項目將空[]