https://gdata.youtube.com/feeds/api/videos/GrbUbVHSpzw?v=2&alt=json
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | <ul> ...... <li data-youtubeid= '<?= $v["youtube_id"] ?>' > <a href= "<?= $v[" link "] ?>" > <img src= "//img.youtube.com/vi/<?= $v[" youtube_id "] ?>/0.jpg" alt= "" width= "237px" > </a> <div class = "youtube_title" ><a href= "#" ></a></div> <div class = "author" ></div> <div class = "counter" ><span></span> просмотров<div class = "youtube_date" ></div></div> </li> ...... </ul> <script> ( function ($) { $( function () { $( ".yotube-list li" ).each( function () { var thisli = $(this); var data_create = new Date (); $.getJSON( 'http://gdata.youtube.com/feeds/api/videos/' + $(this).attr( "data-youtubeid" ) + '?alt=json' , function (data) { thisli.find( ".youtube_title a" ).text(data.entry.title. $t ); thisli.find( ".author" ).text(data.entry.author[0].name. $t ); thisli.find( ".counter span" ).text(data.entry.yt $statistics .viewCount.replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, '$1 ' )); var date = new Date ( Date .parse(data.entry.updated. $t )); thisli.find( ".youtube_date" ).text( date .format( "dd.MM.yyyy" ).toString()); }); }); }); })(jQuery); </script> </section> |