没有得到的YouTube视频列表列表、视频、YouTube

2023-09-07 04:27:39 作者:ツ夨寵ヤ丶

我按照有关如何使用YouTube gdata的教程。填充与从YouTube和视频的onclick列表视图。该人士$ ​​C $ C可以用:

的http://博客.blundell-apps.com /单击项-IN-A-列表视图到节目-的YouTube视频/

在我已经改变了的YouTube链接的GData

从:

YouTube正在推出不包含视频推荐的教育栏目

的https://gdata.youtube.com/feeds/api/videos?author=\"+username+\"&v=2&alt=jsonc

http://gdata.youtube.com/feeds/api/users/ Google代码/上传

影片

我没有得到列表中,为什么?

解决方案

原因是它不工作的原因是:

从这个网址:

的https://gdata.youtube.com/feeds/api/videos?author=\"+username+\"&v=2&alt=jsonc

你得到JSON字符串的响应为gdata.youtube.com

在这个网址:

http://gdata.youtube.com/feeds/api/users/ Google代码/上传

您得到RSS XML响应中为gdata.youtube.com

解决方案:

要使它工作,你需要改变JSON字符串在 GetYouTubeUserVideosTask 解析类XML解析

使用这个网址为JSON格式获取数据:

的http://gdata.youtube.com/feeds/api/users/GoogleDevelopers/uploads?v=2&alt=jsonc

和我们如何在Android中解析JSON使用本教程来已知的:

http://www.androidhive.info/2012/01 / Android的JSON的解析教程/

I have followed a tutorial on how to use the youtube gdata. Populating a listview with videos from youtube and a onclick. The source code is available on:

http://blog.blundell-apps.com/click-item-in-a-listview-to-show-youtube-video/

Once i have changed the YouTube GData link

from:

https://gdata.youtube.com/feeds/api/videos?author="+username+"&v=2&alt=jsonc

to :

http://gdata.youtube.com/feeds/api/users/GoogleDevelopers/uploads

i am not getting list of videos, why?

解决方案

Reason is it's not working because :

From this URL :

https://gdata.youtube.com/feeds/api/videos?author="+username+"&v=2&alt=jsonc

you are getting JSON String in Response for gdata.youtube.com

and

In this URL :

http://gdata.youtube.com/feeds/api/users/GoogleDevelopers/uploads

you are getting Rss XML in Response for gdata.youtube.com

SOLUTION :

to make it working you will need to change JSON String parsing in GetYouTubeUserVideosTask class to XML parsing

OR

use this URL for getting data in JSON format :

http://gdata.youtube.com/feeds/api/users/GoogleDevelopers/uploads?v=2&alt=jsonc

and use this tutorial to known how we parse json in android :

http://www.androidhive.info/2012/01/android-json-parsing-tutorial/