我正在尝试获取Youtube播放列表并在列表视图中显示它 我正在使用this tutorial,它可以帮助我从USERNAME 获取视频,但是当我尝试从播放列表链接获取视频信息时,它会显示以下错误:
Thread-968| Feck
org.json.JSONException: No value for player
org.json.JSONObject.get(JSONObject.java:354)
org.json.JSONObject.getJSONObject(JSONObject.java:569)
com.blundell.tut.service.task.GetYouTubeUserVideosTask.run(GetYouTubeUserVideosTask.java:90)
java.lang.Thread.run(Thread.java:856)
line 90 in GetYouTubeUserVideos is:
url=jsonObject.getJSONObject("player").getString("default");
我改变了
String title = jsonObject.getString("title");
到
String title = jsonObject.getJSONObject("video").getString("title");
我正在使用以下链接播放列表:
“https://gdata.youtube.com/feeds/api/playlists/”+用户名+“?& v = 2& alt = jsonc”
答案 0 :(得分:0)
如果您将JSON放在格式化程序中,则更容易使用:
{
"apiVersion":"2.1",
"data":{
"id":"PL5ErH2bHcHAmXgk-x3VoaKKOTJuE9tt17",
"author":"Yer7amJiddak",
"title":"مقاطع افلام كوميدي",
"description":"",
"thumbnail":{
"sqDefault":"https://i.ytimg.com/vi/I0zWtr2TTFQ/default.jpg",
"hqDefault":"https://i.ytimg.com/vi/I0zWtr2TTFQ/hqdefault.jpg"
},
"content":{
"5":"http://www.youtube.com/p/PL5ErH2bHcHAmXgk-x3VoaKKOTJuE9tt17"
},
"totalItems":12,
"startIndex":1,
"itemsPerPage":25,
"items":[
{
"id":"PLxzsLIRt--QhyuZ8u3UfqDmRK1wKF_sUWed67r02_4tE",
"position":1,
"author":"Yer7amJiddak",
"video":{
"id":"I0zWtr2TTFQ",
"uploaded":"2012-10-18T13:42:37.000Z",
"updated":"2013-07-30T16:10:44.000Z",
"uploader":"kgental1",
"category":"Comedy",
"title":"اجمل مشهد كوميدي من فيلم رمضان مبروك ابو العلمين حمودة",
"description":"http://www.facebook.com/Khaled.133\nاجمل مشهد كوميدي من فيلم رمضان مبروك ابو العلمين حمودة",
"thumbnail":{
"sqDefault":"https://i1.ytimg.com/vi/I0zWtr2TTFQ/default.jpg",
"hqDefault":"https://i1.ytimg.com/vi/I0zWtr2TTFQ/hqdefault.jpg"
},
"player":{
"default":"https://www.youtube.com/watch?v=I0zWtr2TTFQ&feature=youtube_gdata_player",
"mobile":"https://m.youtube.com/details?v=I0zWtr2TTFQ"
},
"content":{
"5":"https://www.youtube.com/v/I0zWtr2TTFQ?version=3&f=playlists&app=youtube_gdata",
"1":"rtsp://v6.cache6.c.youtube.com/CiULENy73wIaHAlUTJO9ttZMIxMYDSANFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp",
"6":"rtsp://v6.cache6.c.youtube.com/CiULENy73wIaHAlUTJO9ttZMIxMYESARFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp"
},
"duration":186,
"rating":5.0,
"likeCount":"28",
"ratingCount":28,
"viewCount":15448,
"favoriteCount":0,
"commentCount":6,
"accessControl":{
"comment":"allowed",
"commentVote":"allowed",
"videoRespond":"moderated",
"rate":"allowed",
"embed":"allowed",
"list":"allowed",
"autoPlay":"allowed",
"syndicate":"allowed"
}
}
},
{
"id":"PLxzsLIRt--QhyuZ8u3UfqDnXYTVmiMufrzGxcLGdEPTg",
"position":2,
"author":"Yer7amJiddak",
"video":{
"id":"Ahp8T2J21Ss",
"uploaded":"2013-01-09T16:19:39.000Z",
"updated":"2013-07-22T09:34:44.000Z",
"uploader":"entertainmenttttmisc",
"category":"Entertainment",
"title":"احمد حلمى اجمد مشهد فيلم عسل اسود",
"description":"",
"thumbnail":{
"sqDefault":"https://i1.ytimg.com/vi/Ahp8T2J21Ss/default.jpg",
"hqDefault":"https://i1.ytimg.com/vi/Ahp8T2J21Ss/hqdefault.jpg"
},
"player":{
"default":"https://www.youtube.com/watch?v=Ahp8T2J21Ss&feature=youtube_gdata_player",
"mobile":"https://m.youtube.com/details?v=Ahp8T2J21Ss"
},
"content":{
"5":"https://www.youtube.com/v/Ahp8T2J21Ss?version=3&f=playlists&app=youtube_gdata",
"1":"rtsp://v5.cache7.c.youtube.com/CiULENy73wIaHAkr1XZiT3waAhMYDSANFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp",
"6":"rtsp://v5.cache7.c.youtube.com/CiULENy73wIaHAkr1XZiT3waAhMYESARFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp"
},
"duration":157,
"aspectRatio":"widescreen",
"rating":4.571429,
"likeCount":"25",
"ratingCount":28,
"viewCount":7970,
"favoriteCount":0,
"commentCount":0,
"accessControl":{
"comment":"allowed",
"commentVote":"allowed",
"videoRespond":"moderated",
"rate":"allowed",
"embed":"allowed",
"list":"allowed",
"autoPlay":"allowed",
"syndicate":"allowed"
}
}
},
{
"id":"PLxzsLIRt--QhyuZ8u3UfqDv6MEmO1c5QHUzvKie5gHLQ",
"position":3,
"author":"Yer7amJiddak",
"video":{
"id":"QChOxhhoTps",
"uploaded":"2012-12-17T17:00:43.000Z",
"updated":"2013-07-28T02:14:16.000Z",
"uploader":"4tYsmt6tPDd0HjeRftVpxA",
"category":"Entertainment",
"title":"احلي مشهد في فيلم اكس لارج احمد حلمي",
"description":"صبري صبري اوعي يكون الي في بالي\nبسرعة طياراة علي الماركت هات 5 6 7 علب فول و40 بيضة\nاحلي مشهد في فيلم اكس لارج احمد حلمي",
"thumbnail":{
"sqDefault":"https://i1.ytimg.com/vi/QChOxhhoTps/default.jpg",
"hqDefault":"https://i1.ytimg.com/vi/QChOxhhoTps/hqdefault.jpg"
},
"player":{
"default":"https://www.youtube.com/watch?v=QChOxhhoTps&feature=youtube_gdata_player",
"mobile":"https://m.youtube.com/details?v=QChOxhhoTps"
},
"content":{
"5":"https://www.youtube.com/v/QChOxhhoTps?version=3&f=playlists&app=youtube_gdata",
"1":"rtsp://v5.cache2.c.youtube.com/CiULENy73wIaHAmbTmgYxk4oQBMYDSANFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp",
"6":"rtsp://v5.cache2.c.youtube.com/CiULENy73wIaHAmbTmgYxk4oQBMYESARFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp"
},
"duration":166,
"rating":4.921875,
"likeCount":"251",
"ratingCount":256,
"viewCount":86896,
"favoriteCount":0,
"commentCount":26,
"accessControl":{
"comment":"allowed",
"commentVote":"allowed",
"videoRespond":"moderated",
"rate":"allowed",
"embed":"allowed",
"list":"allowed",
"autoPlay":"allowed",
"syndicate":"allowed"
}
}
},
{
"id":"PLxzsLIRt--QhyuZ8u3UfqDomehvdMw9jj-9cqapYviAc",
"position":4,
"author":"Yer7amJiddak",
"video":{
"id":"4DGuUppbLlI",
"uploaded":"2011-02-12T09:24:41.000Z",
"updated":"2013-07-23T18:14:36.000Z",
"uploader":"dawafnet",
"category":"Animals",
"title":"وش أجرام.flv",
"description":"",
"thumbnail":{
"sqDefault":"https://i1.ytimg.com/vi/4DGuUppbLlI/default.jpg",
"hqDefault":"https://i1.ytimg.com/vi/4DGuUppbLlI/hqdefault.jpg"
},
"player":{
"default":"https://www.youtube.com/watch?v=4DGuUppbLlI&feature=youtube_gdata_player",
"mobile":"https://m.youtube.com/details?v=4DGuUppbLlI"
},
"content":{
"5":"https://www.youtube.com/v/4DGuUppbLlI?version=3&f=playlists&app=youtube_gdata",
"1":"rtsp://v5.cache7.c.youtube.com/CiULENy73wIaHAlSLluaUq4x4BMYDSANFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp",
"6":"rtsp://v5.cache7.c.youtube.com/CiULENy73wIaHAlSLluaUq4x4BMYESARFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp"
},
"duration":60,
"rating":4.848101,
"likeCount":"152",
"ratingCount":158,
"viewCount":130456,
"favoriteCount":0,
"commentCount":20,
"accessControl":{
"comment":"allowed",
"commentVote":"allowed",
"videoRespond":"moderated",
"rate":"allowed",
"embed":"allowed",
"list":"allowed",
"autoPlay":"allowed",
"syndicate":"allowed"
}
}
},
{
"id":"PLxzsLIRt--QhyuZ8u3UfqDkOZ2Iydoc0s77lPOpTxQWA",
"position":5,
"author":"Yer7amJiddak",
"video":{
"id":"bDApYRUHbj4",
"uploaded":"2007-06-01T15:45:11.000Z",
"updated":"2013-08-01T16:44:19.000Z",
"uploader":"hanybee1",
"category":"Comedy",
"title":"بحبها يا لمبى",
"description":"محمد سعد فى فيلم اللى باللى بالك\nتم الرفع بواسطة\n-\n-\n-\n-\nتصميم مواقع\nhttp://hanybee.com/%D8%AA%D8%B5%D9%85%D9%8A%D9%85-%D9%85%D9%88%D8%A7%D9%82%D8%B9.html- تصميم مواقع - إمتلك موقع بتصميم مثالي و متوافق مع محركات البحث على أفضل السيرفرات العالمية\nhttp://hanybee.com تصميم مواقع\nhttp://q8data.com إستضافة مواقع",
"thumbnail":{
"sqDefault":"https://i1.ytimg.com/vi/bDApYRUHbj4/default.jpg",
"hqDefault":"https://i1.ytimg.com/vi/bDApYRUHbj4/hqdefault.jpg"
},
"player":{
"default":"https://www.youtube.com/watch?v=bDApYRUHbj4&feature=youtube_gdata_player",
"mobile":"https://m.youtube.com/details?v=bDApYRUHbj4"
},
"content":{
"5":"https://www.youtube.com/v/bDApYRUHbj4?version=3&f=playlists&app=youtube_gdata",
"1":"rtsp://v3.cache8.c.youtube.com/CiULENy73wIaHAk-bgcVYSkwbBMYDSANFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp",
"6":"rtsp://v3.cache8.c.youtube.com/CiULENy73wIaHAk-bgcVYSkwbBMYESARFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp"
},
"duration":186,
"geoCoordinates":{
"latitude":26.82055,
"longitude":30.8025
},
"rating":4.8163857,
"likeCount":"1642",
"ratingCount":1721,
"viewCount":1710657,
"favoriteCount":0,
"commentCount":613,
"accessControl":{
"comment":"allowed",
"commentVote":"allowed",
"videoRespond":"moderated",
"rate":"allowed",
"embed":"allowed",
"list":"allowed",
"autoPlay":"allowed",
"syndicate":"allowed"
}
}
},
{
"id":"PLxzsLIRt--QhyuZ8u3UfqDjPBN-0oC_-K-XQaBCRUBqo",
"position":6,
"author":"Yer7amJiddak",
"video":{
"id":"Y5SnuWN9IUA",
"uploaded":"2010-10-08T22:33:48.000Z",
"updated":"2013-07-31T20:16:14.000Z",
"uploader":"salomiaaa",
"category":"Comedy",
"title":"اللى بالى بالك - محمد سعد - صباح الخير يا جريمة",
"description":"مقطع من فيلم اللى بالى بالك لمحمد سعد\r\nبرنامج صباح الخير يا جريمة و لقاء كوميدى خلف الأسوار",
"thumbnail":{
"sqDefault":"https://i1.ytimg.com/vi/Y5SnuWN9IUA/default.jpg",
"hqDefault":"https://i1.ytimg.com/vi/Y5SnuWN9IUA/hqdefault.jpg"
},
"player":{
"default":"https://www.youtube.com/watch?v=Y5SnuWN9IUA&feature=youtube_gdata_player",
"mobile":"https://m.youtube.com/details?v=Y5SnuWN9IUA"
},
"content":{
"5":"https://www.youtube.com/v/Y5SnuWN9IUA?version=3&f=playlists&app=youtube_gdata",
"1":"rtsp://v2.cache4.c.youtube.com/CiULENy73wIaHAlAIX1juaeUYxMYDSANFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp",
"6":"rtsp://v2.cache4.c.youtube.com/CiULENy73wIaHAlAIX1juaeUYxMYESARFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp"
},
"duration":122,
"rating":4.7789474,
"likeCount":"359",
"ratingCount":380,
"viewCount":302642,
"favoriteCount":0,
"commentCount":83,
"accessControl":{
"comment":"allowed",
"commentVote":"allowed",
"videoRespond":"moderated",
"rate":"allowed",
"embed":"allowed",
"list":"allowed",
"autoPlay":"allowed",
"syndicate":"allowed"
}
}
},
{
"id":"PLxzsLIRt--QhyuZ8u3UfqDjpI5y-a4MjSa1YK1BdXQRM",
"position":7,
"author":"Yer7amJiddak",
"video":{
"id":"B7ZofpoCERQ",
"uploaded":"2010-09-24T21:51:15.000Z",
"updated":"2013-08-01T22:02:54.000Z",
"uploader":"salehvideo",
"category":"Comedy",
"title":"عادل إمام - طموحات محشش ذو خيال واسع",
"description":"الفنان الكوميدي الكبير عادل امام في مشهد مضحك و أليم جدا من فيلم هالو أمريكا \r\nجلسة غرزة محششين يخبرهم فيها بأحلامه بعد هجرته لأمريكا\r\nالطريف بأن معظم ما جاء في الجلسة تترجم أحلام الكثير من عواطلي عالمنا العرب بعد فشلهم في بناء أنفسهم بأوطانهم\r\n.\r\n.\r\n\r\n.\r\n.\r\nالزعيم عادل امام مصر فيلم عربي كوميدي الكوميديا الضحك",
"thumbnail":{
"sqDefault":"https://i1.ytimg.com/vi/B7ZofpoCERQ/default.jpg",
"hqDefault":"https://i1.ytimg.com/vi/B7ZofpoCERQ/hqdefault.jpg"
},
"player":{
"default":"https://www.youtube.com/watch?v=B7ZofpoCERQ&feature=youtube_gdata_player",
"mobile":"https://m.youtube.com/details?v=B7ZofpoCERQ"
},
"content":{
"5":"https://www.youtube.com/v/B7ZofpoCERQ?version=3&f=playlists&app=youtube_gdata",
"1":"rtsp://v8.cache4.c.youtube.com/CiULENy73wIaHAkUEQKafmi2BxMYDSANFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp",
"6":"rtsp://v8.cache4.c.youtube.com/CiULENy73wIaHAkUEQKafmi2BxMYESARFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp"
},
"duration":202,
"rating":4.6484427,
"likeCount":"1318",
"ratingCount":1445,
"viewCount":1358295,
"favoriteCount":0,
"commentCount":201,
"accessControl":{
"comment":"allowed",
"commentVote":"allowed",
"videoRespond":"moderated",
"rate":"allowed",
"embed":"allowed",
"list":"allowed",
"autoPlay":"allowed",
"syndicate":"allowed"
}
}
},
{
"id":"PLxzsLIRt--QhyuZ8u3UfqDgCfmctARkNOeM7_TlnchAs",
"position":8,
"author":"Yer7amJiddak",
"video":{
"id":"LYEnAYMSm2c",
"uploaded":"2011-07-27T23:41:34.000Z",
"updated":"2013-07-18T00:19:52.000Z",
"uploader":"samself96",
"category":"Comedy",
"title":"علاء ولي الدين - مدرس رياضيات و فرنساوي",
"description":"مدرس رياضيات و فرنساوي",
"thumbnail":{
"sqDefault":"https://i1.ytimg.com/vi/LYEnAYMSm2c/default.jpg",
"hqDefault":"https://i1.ytimg.com/vi/LYEnAYMSm2c/hqdefault.jpg"
},
"player":{
"default":"https://www.youtube.com/watch?v=LYEnAYMSm2c&feature=youtube_gdata_player",
"mobile":"https://m.youtube.com/details?v=LYEnAYMSm2c"
},
"content":{
"5":"https://www.youtube.com/v/LYEnAYMSm2c?version=3&f=playlists&app=youtube_gdata",
"1":"rtsp://v4.cache8.c.youtube.com/CiULENy73wIaHAlnmxKDASeBLRMYDSANFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp",
"6":"rtsp://v4.cache8.c.youtube.com/CiULENy73wIaHAlnmxKDASeBLRMYESARFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp"
},
"duration":51,
"rating":4.95,
"likeCount":"79",
"ratingCount":80,
"viewCount":29528,
"favoriteCount":0,
"commentCount":7,
"accessControl":{
"comment":"allowed",
"commentVote":"allowed",
"videoRespond":"moderated",
"rate":"allowed",
"embed":"allowed",
"list":"allowed",
"autoPlay":"allowed",
"syndicate":"allowed"
}
}
},
{
"id":"PLxzsLIRt--QhyuZ8u3UfqDqdCzgih6IgIXgVoeSPGbo8",
"position":9,
"author":"Yer7amJiddak",
"video":{
"id":"pyzrIUDqwes",
"uploaded":"2010-10-10T00:03:36.000Z",
"updated":"2013-07-23T15:18:46.000Z",
"uploader":"802741413",
"category":"Comedy",
"title":"شكلك فاهم يا نص.3gp",
"description":"",
"thumbnail":{
"sqDefault":"https://i1.ytimg.com/vi/pyzrIUDqwes/default.jpg",
"hqDefault":"https://i1.ytimg.com/vi/pyzrIUDqwes/hqdefault.jpg"
},
"player":{
"default":"https://www.youtube.com/watch?v=pyzrIUDqwes&feature=youtube_gdata_player",
"mobile":"https://m.youtube.com/details?v=pyzrIUDqwes"
},
"content":{
"5":"https://www.youtube.com/v/pyzrIUDqwes?version=3&f=playlists&app=youtube_gdata",
"1":"rtsp://v5.cache3.c.youtube.com/CiULENy73wIaHAnrwepAIesspxMYDSANFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp",
"6":"rtsp://v5.cache3.c.youtube.com/CiULENy73wIaHAnrwepAIesspxMYESARFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp"
},
"duration":123,
"rating":5.0,
"likeCount":"8",
"ratingCount":8,
"viewCount":3512,
"favoriteCount":0,
"commentCount":0,
"accessControl":{
"comment":"allowed",
"commentVote":"allowed",
"videoRespond":"moderated",
"rate":"allowed",
"embed":"allowed",
"list":"allowed",
"autoPlay":"allowed",
"syndicate":"allowed"
}
}
},
{
"id":"PLxzsLIRt--QhyuZ8u3UfqDibx0FpC1_-N4DJ4FC02rm8",
"position":10,
"author":"Yer7amJiddak",
"video":{
"id":"CgTPJ8tslhU",
"uploaded":"2012-09-25T11:41:43.000Z",
"updated":"2013-07-31T14:03:29.000Z",
"uploader":"rp9RStOrjniRvIuHWPs_rw",
"category":"People",
"title":"اللمبي في القوات الخاصة سه سه مقطع مضحك",
"description":"لمشاهدة المزيد من الفيديوهات الكوميدية و الافلام الحصرية و المسلسلات و البرامج التلفزيونية \nhttp://www.youtube4u.net\nhttp://www.youtube4u.com\n\n\n\n\nاضحك من قلبك - الضحك اضحكوا اضحكو موت من الضحكة الضحكه ابستم ابتسمى ابتسمي\nكوميديا كوميدي كوميدى جامد موت جامد اخر حاجة حاجه فيديو يوتيوب اليوتيوب الفيديو\nyoutube yotbe مقاطع مضحكة مقطع الفنان الفنانة مسرحية فيلم اضحك \nشاهد مقطع مضحك النجم الممثل المغني المغنى المطرب المطربة المطربه الفنان الفنانه الفنانة",
"thumbnail":{
"sqDefault":"https://i1.ytimg.com/vi/CgTPJ8tslhU/default.jpg",
"hqDefault":"https://i1.ytimg.com/vi/CgTPJ8tslhU/hqdefault.jpg"
},
"player":{
"default":"https://www.youtube.com/watch?v=CgTPJ8tslhU&feature=youtube_gdata_player",
"mobile":"https://m.youtube.com/details?v=CgTPJ8tslhU"
},
"content":{
"5":"https://www.youtube.com/v/CgTPJ8tslhU?version=3&f=playlists&app=youtube_gdata",
"1":"rtsp://v4.cache2.c.youtube.com/CiULENy73wIaHAkVlmzLJ88EChMYDSANFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp",
"6":"rtsp://v4.cache2.c.youtube.com/CiULENy73wIaHAkVlmzLJ88EChMYESARFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp"
},
"duration":222,
"aspectRatio":"widescreen",
"rating":4.652174,
"likeCount":"21",
"ratingCount":23,
"viewCount":17275,
"favoriteCount":0,
"commentCount":2,
"accessControl":{
"comment":"allowed",
"commentVote":"allowed",
"videoRespond":"moderated",
"rate":"allowed",
"embed":"allowed",
"list":"allowed",
"autoPlay":"allowed",
"syndicate":"allowed"
}
}
},
{
"id":"PLxzsLIRt--QhyuZ8u3UfqDtQAHcmm5pvlDu56XHHglUg",
"position":11,
"author":"Yer7amJiddak",
"video":{
"id":"iEWICwJBNzk",
"uploaded":"2011-05-05T03:59:52.000Z",
"updated":"2013-07-31T20:12:08.000Z",
"uploader":"tahagaba",
"category":"Comedy",
"title":"اللمبي يترافع في المحكمة قمة الكوميديا",
"description":"ابوس ايدك اجل القضية الساعة تسعة tahagaba",
"thumbnail":{
"sqDefault":"https://i1.ytimg.com/vi/iEWICwJBNzk/default.jpg",
"hqDefault":"https://i1.ytimg.com/vi/iEWICwJBNzk/hqdefault.jpg"
},
"player":{
"default":"https://www.youtube.com/watch?v=iEWICwJBNzk&feature=youtube_gdata_player",
"mobile":"https://m.youtube.com/details?v=iEWICwJBNzk"
},
"content":{
"5":"https://www.youtube.com/v/iEWICwJBNzk?version=3&f=playlists&app=youtube_gdata",
"1":"rtsp://v3.cache6.c.youtube.com/CiULENy73wIaHAk5N0ECC4hFiBMYDSANFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp",
"6":"rtsp://v3.cache6.c.youtube.com/CiULENy73wIaHAk5N0ECC4hFiBMYESARFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp"
},
"duration":208,
"rating":4.354839,
"likeCount":"52",
"ratingCount":62,
"viewCount":48258,
"favoriteCount":0,
"accessControl":{
"comment":"denied",
"commentVote":"denied",
"videoRespond":"moderated",
"rate":"allowed",
"embed":"allowed",
"list":"allowed",
"autoPlay":"allowed",
"syndicate":"allowed"
}
}
},
{
"id":"PLxzsLIRt--QhyuZ8u3UfqDj3GKbd7lrstCsd3Q30qdvU",
"position":12,
"author":"Yer7amJiddak",
"video":{
"id":"SbBj6m3KnAY",
"uploaded":"2013-01-16T11:09:20.000Z",
"updated":"2013-07-08T14:07:53.000Z",
"uploader":"fibzchesnais",
"category":"Sports",
"title":"\u202bبوشكاش Happy Birthday-Boshkash - Mohamed Saad\u202c\u200e - YouTube.wmv",
"description":"Happy Birthday-Boshkash - Mohamed Saad",
"thumbnail":{
"sqDefault":"https://i1.ytimg.com/vi/SbBj6m3KnAY/default.jpg",
"hqDefault":"https://i1.ytimg.com/vi/SbBj6m3KnAY/hqdefault.jpg"
},
"player":{
"default":"https://www.youtube.com/watch?v=SbBj6m3KnAY&feature=youtube_gdata_player",
"mobile":"https://m.youtube.com/details?v=SbBj6m3KnAY"
},
"content":{
"5":"https://www.youtube.com/v/SbBj6m3KnAY?version=3&f=playlists&app=youtube_gdata",
"1":"rtsp://v4.cache7.c.youtube.com/CiULENy73wIaHAkGnMpt6mOwSRMYDSANFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp",
"6":"rtsp://v4.cache7.c.youtube.com/CiULENy73wIaHAkGnMpt6mOwSRMYESARFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp"
},
"duration":283,
"aspectRatio":"widescreen",
"rating":5.0,
"likeCount":"7",
"ratingCount":7,
"viewCount":6015,
"favoriteCount":0,
"commentCount":1,
"accessControl":{
"comment":"allowed",
"commentVote":"allowed",
"videoRespond":"moderated",
"rate":"allowed",
"embed":"allowed",
"list":"allowed",
"autoPlay":"allowed",
"syndicate":"allowed"
}
}
}
]
}
}
视频位于items
数组中。
尝试类似:
JSONArray items = jsonObject.getJsonArray("items");
String url = items.get(0).getJSONObject("player").getString("default");
(如果你想要多于1,请在JSONArray上循环)。