參考:
YouTube API v2.0 – Retrieving Data for a Single Video
https://developers.google.com/youtube/2.0/developers_guide_protocol_video_entries
例如這個影片
http://www.youtube.com/watch?v=UXY8bCzM3yo
讀出來的資料:
http://gdata.youtube.com/feeds/api/videos/UXY8bCzM3yo?alt=json
長的像這樣
{"version":"1.0","encoding":"UTF-8",
"entry":
{
"xmlns$app":"http://purl.org/atom/app#",
"xmlns":"http://www.w3.org/2005/Atom",
"xmlns$media":"http://search.yahoo.com/mrss/",
"xmlns$gd":"http://schemas.google.com/g/2005",
"xmlns$yt":"http://gdata.youtube.com/schemas/2007",
"id":{
"$t":"http://gdata.youtube.com/feeds/api/videos/UXY8bCzM3yo"},
"published":{"$t":"2006-08-27T11:10:19.000Z"},
"updated":{"$t":"2013-03-10T12:06:26.000Z"},
"app$control":{
"yt$state":{
"$t":"Syndication of this video was restricted.",
"name":"restricted",
"reasonCode":"limitedSyndication"}
},
"category":[
{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://gdata.youtube.com/schemas/2007#video"},
{"scheme":"http://gdata.youtube.com/schemas/2007/categories.cat","term":"Music","label":"音樂"}
],
"title":{"$t":"劉德華-難免有錯MV","type":"text"},
"content":{"$t":"華仔窩裡反 \r\nhttp://andylau.co.nr/","type":"text"},
"link":[
{"rel":"alternate","type":"text/html","href":"http://www.youtube.com/watch?v=UXY8bCzM3yo&feature=youtube_gdata"},
{"rel":"http://gdata.youtube.com/schemas/2007#video.responses","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/UXY8bCzM3yo/responses"},
{"rel":"http://gdata.youtube.com/schemas/2007#video.related","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/UXY8bCzM3yo/related"},
{"rel":"self","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/UXY8bCzM3yo"}
],
"author":[
{"name":{"$t":"sake5899"},
"uri":{"$t":"http://gdata.youtube.com/feeds/api/users/sake5899"}}],
"gd$comments":{"gd$feedLink":{"rel":"http://gdata.youtube.com/schemas/2007#comments",
"href":"http://gdata.youtube.com/feeds/api/videos/UXY8bCzM3yo/comments","countHint":107}},
"media$group":{"media$category":[{"$t":"Music","label":"音樂","scheme":"http://gdata.youtube.com/schemas/2007/categories.cat"}
],
"media$content":[{"url":"http://www.youtube.com/v/UXY8bCzM3yo?version=3&f=videos&app=youtube_gdata",
"type":"application/x-shockwave-flash","medium":"video","isDefault":"true","expression":"full","duration":343,"yt$format":5
}
],
"media$description":{"$t":"華仔窩裡反 \r\nhttp://andylau.co.nr/","type":"plain"},
"media$keywords":{},
"media$player":[{"url":"http://www.youtube.com/watch?v=UXY8bCzM3yo&feature=youtube_gdata_player"}],
"media$restriction":{"$t":"DE","type":"country","relationship":"deny"},
"media$thumbnail":[
{"url":"http://i.ytimg.com/vi/UXY8bCzM3yo/0.jpg","height":360,"width":480,"time":"00:02:51.500"},
{"url":"http://i.ytimg.com/vi/UXY8bCzM3yo/1.jpg","height":90,"width":120,"time":"00:01:25.750"},
{"url":"http://i.ytimg.com/vi/UXY8bCzM3yo/2.jpg","height":90,"width":120,"time":"00:02:51.500"},
{"url":"http://i.ytimg.com/vi/UXY8bCzM3yo/3.jpg","height":90,"width":120,"time":"00:04:17.250"}],
"media$title":{"$t":"劉德華-難免有錯MV","type":"plain"},"yt$duration":{"seconds":"343"}},
"gd$rating":{"average":4.9751554,"max":5,"min":1,"numRaters":805,"rel":"http://schemas.google.com/g/2005#overall"},
"yt$statistics":{
"favoriteCount":"0",
"viewCount":"433494"
}
}
}
Youtube 觀看人數的說明:
http://support.google.com/youtube/bin/answer.py?hl=zh-Hant&answer=154414
什麼是觀看次數?
「觀看次數」是指 YouTube 使用者觀看某部影片的累計次數。為維持觀看次數的準確性,我們會判斷異常的播放情形 (例如濫播影片),並從觀看次數扣除這類播放情形。
觀看次數多久更新一次?
如果是剛上傳的影片,觀看次數會即時更新;當影片變得很受歡迎時,系統每隔幾個小時才會更新影片的觀看次數。
** 數字可能 1,2 小時才更新為什麼系統沒有更新我的影片觀看次數?
如果是熱門的影片,系統每隔幾個小時才會更新影片的觀看次數。只要有人還在觀看您的影片,系統很快就會顯示最新的觀看次數。