RipzCurlz
08-04-2010, 05:13 AM
Hey,
A client has requested that their videos page content is their youtube user's videos and for them to be loaded in automatically so that their latest upload is always the first video on the page.
I have been searching for a way to do this and haven't much.
However i did find this script:
$(function() {
$.getJSON('http://gdata.youtube.com/feeds/users/[USERNAME]/uploads?alt=json-in-script&callback=?&max-results=10', function(data) {
$.each(data.feed.entry, function(i, item) {
var title = item['title']['$t'];
var video = item['id']['$t'];
video = video.replace('http://gdata.youtube.com/feeds/videos/','http://www.youtube.com/watch?v=');
$('#youtube').append('<a href="'+video+'">'+title+'</a> <br/>');
});
});
});
This code gives me the right data i need.
A specific youtube user's videos title and url.
What I want to achieve, is to load this data into a <ul>
Example:
<ul id="videolist">
<li class="videos">
<p class="videoTitle">Video Title</p>
<div class="videoURL">Embedded Youtube video</div>
</li>
<li class="videos">
<p class="videoTitle">Video Title</p>
<div class="videoURL">Embedded Youtube video</div>
</li>
</ul>
Any suggestions or help are very much appreciated.
Thanks
A client has requested that their videos page content is their youtube user's videos and for them to be loaded in automatically so that their latest upload is always the first video on the page.
I have been searching for a way to do this and haven't much.
However i did find this script:
$(function() {
$.getJSON('http://gdata.youtube.com/feeds/users/[USERNAME]/uploads?alt=json-in-script&callback=?&max-results=10', function(data) {
$.each(data.feed.entry, function(i, item) {
var title = item['title']['$t'];
var video = item['id']['$t'];
video = video.replace('http://gdata.youtube.com/feeds/videos/','http://www.youtube.com/watch?v=');
$('#youtube').append('<a href="'+video+'">'+title+'</a> <br/>');
});
});
});
This code gives me the right data i need.
A specific youtube user's videos title and url.
What I want to achieve, is to load this data into a <ul>
Example:
<ul id="videolist">
<li class="videos">
<p class="videoTitle">Video Title</p>
<div class="videoURL">Embedded Youtube video</div>
</li>
<li class="videos">
<p class="videoTitle">Video Title</p>
<div class="videoURL">Embedded Youtube video</div>
</li>
</ul>
Any suggestions or help are very much appreciated.
Thanks