How to get YouTube JSON GData url
i have made an application in which i am fetching YouTube videos using this url:
http://gdata.youtube.com/feeds/api/users/GoogleDevelopers/uploads?v=2&alt=jsonc
in a same way i want to fetch YouTube videos using this url:
http://www.youtube.com/playlist?list=PL34F010EEF9D45FB8
Problem: I don't know how can i get YouTube JSON GData URL for this link...
http://www.youtube.com/playlist?list=PL34F010EEF9D45FB8
if you want to get playlists from gdata.youtube.com then use this API as:
http://gdata.youtube.com/feeds/api/playlists/PASS_PLAYLIST_ID_HERE?v=2&alt=json
then change your url as:
http://gdata.youtube.com/feeds/api/playlists/PL34F010EEF9D45FB8?v=2&alt=json
Dont use gdata for youtube. Use OhEmbed feature of youtube. for your link the youtube ohembed link is
http://www.youtube.com/oembed?url=http://www.youtube.com/playlist?list=PL34F010EEF9D45FB8
如果您想从YT播放列表中检索播放列表数据,请使用
var feedUrl = "http://gdata.youtube.com/feeds/api/playlists/"+nPlaylistID+"?max-results=8";
if (result.error || !result.url)
{
$('#divid').hide();
return;
}
var feed = new google.feeds.Feed(result.url);
feed.setNumEntries(50);
feed.load(function (result) {
for (var i = 0; i < result.feed.entries.length; i++) {
var entry = result.feed.entries[i];
var vidhash = /=(.*)&(.*)$/.exec (entry.link)[1];
container.append('<div><a href="http://www.youtube.com/embed/'+vidhash+'" class="html5lightbox" title="'+entry.title+'"><img src="http://img.youtube.com/vi/'+vidhash+'/0.jpg" /><br />'+entry.title+'</a></div>n');
链接地址: http://www.djcxy.com/p/66150.html