Fetch the first youtube video via json jquery and display it as a teaser -


i have need pull out first video teaser display code below:

$.getjson('http://gdata.youtube.com/feeds/api/videos?q=love&alt=json-in-script&callback=?&max-results=3&start-index=1', function(data) {     $.each(data.feed.entry, function(i, item) {     var title = item['title']['$t'];     var video = item['id']['$t'];     // need variable store first video id array here manipulated via php later     //var videoid1 = ?;      video = video.replace('http://gdata.youtube.com/feeds/api/videos/','http://www.youtube.com/watch?v=');  //replacement of link     videoid = video.replace('http://www.youtube.com/watch?v=',''); // removing link , getting video id     $('#videonavs .navs').append('<li><a href="'+video+'"> '+title+' -'+videoid+ '</a></li>'); //      }); }); 

and html:

<div id="videos">         <object width="286" height="210">           <param value="http://www.youtube.com/v/[this should first video id/ videoid1 manipulated via php]&amp;feature=youtube_gdata&amp;hl=en_us&amp;fs=1&amp;rel=0" name="movie">            <param value="true" name="allowfullscreen">            <param value="always" name="allowscriptaccess">          </object> </div>       <div id="videonavs"><ul class="navs"></ul></div> 

this json if place callback "showmyvideos".

http://gdata.youtube.com/feeds/api/videos?q=love&alt=json-in-script&callback=showmyvideos&max-results=3&start-index=1

any hints appreciated. thanks


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -