SlideShare a Scribd company logo
1 of 8
Download to read offline
SEARCH YOUTUBE VIDEOS USING JAVASCRIPT AND API3
You can test this html file at the following address
http://phanhung20.blogspot.com/2015/09/javascript-for-searching-videos.html
This is the image of the web page
Don't forget to replace "AIz*********************************zm4"
with your Youtube API3 KEY
<!DOCTYPE>
<html>
<head>
file:///H:/xampp/htdocs/v3t/SUMARY-search-videos/s1-code-rutgon-simp...
1 of 8 12/5/2015 9:40 PM
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>more than 50 videos</title>
<style>
body{
background-color:#999999;
margin:0px;
padding:0px;
font-family:Arial;
font-size:10pt;
}
#r1 td{
border:1px solid gray;
font-size:10pt;
}
a{
text-decoration:none;
}
a:hover{
color:green;
}
input[type="button"], button{
background-color:#DDDDDD;
cursor:pointer;
padding:0px;
}
#vtitle{
width:980px;height:25px;color:white;background-color:#1B1B1B;
margin-top:-2px;overflow:hidden;
padding-top:10px;
}
.bar{
width:608px;
height:20px;
background-color:#99CCFF;
color:black;
font-weight:bold;
padding:6px;
}
#header1{
/*color:white; */
font-weight:bold;
width:812px;
height:24px;
background-color:#006699;
padding:3px;
position: fixed;
left: 0px;
top: 0px;
}
#header1 td {border: none;}
</style>
</head>
file:///H:/xampp/htdocs/v3t/SUMARY-search-videos/s1-code-rutgon-simp...
2 of 8 12/5/2015 9:40 PM
<body onload="init()">
<div align="center">
<table id="header1" width="620px" height="42px" style="margin-bottom:-7px;">
<tr>
<td width="30%" style="color:white;font-family:'Time New Roman';font-size:14pt">
<b><i>&nbsp;SIMPLE SEARCH</i></b>
</td>
<td style="text-align:right;vertical-align:middle">&nbsp;
<span style="font-size:11pt;color:white"><i>Go to&nbsp;</i></span>
<input type="button" onclick="scrollToElement('searchtext1',40)" value="Search">
<input type="button" onclick="goto('bott')" value="Bott">
<input type="button" onclick="window.scrollTo(0,0)" value="Top">
</td>
<td width="40%" align="right">
<button type="button" onclick="stopYoutube();">Stop</button>
<button type="button" onclick="player.pauseVideo();">Pause</button>
<button type="button" onclick="player.playVideo();">Play</button>
<button type="button" onclick="nextVid();">Next</button>&nbsp;&nbsp;
</td>
</tr>
</table>
<div style="width:100%;height:36px;"></div>
<div id='player'></div>
<div id="vtitle" style="text-align:center;width:812px;height:23px;color:white;background-color:#333333;padding-top:7px;">
</div>
<!------------------->
<br>
<table id="searchTBL" width="620" style="background-color:#99CCFF">
<tr>
<td align="center" style="vertical-align:middle;font-size:12pt;font-weight:bold">&nbsp;
<b><i>Search:</i></b>&nbsp;<input type="text" value="Franck Pourcel"
id="searchtext1" size="75" style="border-style:inset"><br>
<table width="90%"><tr><td width="120" style="border:none;vertical-align:middle">
<b><i>Total:</i></b>&nbsp;<span id="wantSpan" style="font-size:12pt;font-style: italic">0</span>
</td ><td width="120" style="border:none;vertical-align:middle">
<b><i>Found:</i></b>&nbsp;<span id="foundText" style="font-size:12pt;font-style: italic">0</span>
</td><td align="right" style="border:none;vertical-align:middle">
<button type="button" onclick="start(40)">S40</button>
<button type="button" onclick="start(180)">S180</button>
<button type="button" onclick="start(300)">S300</button>
<button type="button" onclick="start(400)">S400</button>
<button type="button" onclick="start(500)">S500</button>
</tr></table>
</td>
</td>
</tr>
</table>
<br>
<div id="tip" style =
"width:580px;height:130px;overflow:auto;background-color:white;text-align:left;padding:20px;line-height:160%">
<b>ABSOLUTLY EXACT USER NAME:</b><br>
<a href="#" onclick="readyTerm('Andreea Petcu'); return false">Andreea Petcu</a>,&nbsp;
<a href="#" onclick="readyTerm('Expoza travel'); return false">Expoza travel</a>,&nbsp;
<br>
file:///H:/xampp/htdocs/v3t/SUMARY-search-videos/s1-code-rutgon-simp...
3 of 8 12/5/2015 9:40 PM
<b>FREE TEXT (ANYTHING):</b>
<br>
<a href="#" onclick="readyTerm('china travel'); return false">china travel</a>,&nbsp;
<a href="#" onclick="readyTerm('india travel'); return false">india travel</a>,&nbsp;
<br>
<a href="#" onclick="readyTerm('youtube data api version 3'); return false">
youtube data api version 3</a>,
<a href="#" onclick="readyTerm('youtube iframe player javascript'); return false">
youtube iframe player javascript</a>,
<br><br>
<a href="#" onclick="readyTerm('101 Strings'); return false">101 Strings</a>,&nbsp;
<a href="#" onclick="readyTerm('Abba'); return false">Abba</a>,&nbsp;
<a href="#" onclick="readyTerm('Bee Gees'); return false">Bee Gees</a>,&nbsp;
<a href="#" onclick="readyTerm('Bert Kaempfert'); return false">Bert Kaempfert</a>,&nbsp;
<a href="#" onclick="readyTerm('Billy Vaughn'); return false">Billy Vaughn</a>,&nbsp;
<a href="#" onclick="readyTerm('Caravelli'); return false">Caravelli</a>,&nbsp;
<a href="#" onclick="readyTerm('Carpenters'); return false">Carpenters</a>,&nbsp;
<a href="#" onclick="readyTerm('Cecil Gonzalez instrumental'); return false">
Cecil Gonzalez instrumental</a>,&nbsp;
<a href="#" onclick="readyTerm('Enrique Chia'); return false">Enrique Chia</a>,&nbsp;
<a href="#" onclick="readyTerm('Francisco Garcia guitarist'); return false">
Francisco Garcia guitarist</a>,&nbsp;
<a href="#" onclick="readyTerm('Franck Pourcel'); return false">Franck Pourcel</a>,&nbsp;
<a href="#" onclick="readyTerm('Frank Chacksfield'); return false">Frank Chacksfield</a>,&nbsp;
<a href="#" onclick="readyTerm('Guitar Mood'); return false">Guitar Mood</a>,&nbsp;
<a href="#" onclick="readyTerm('Helmut Zacharias'); return false">Helmut Zacharias</a>,&nbsp;
<a href="#" onclick="readyTerm('Hugo Montenegro'); return false">Hugo Montenegro</a>,&nbsp;
<a href="#" onclick="readyTerm('Hugo Strasser'); return false">Hugo Strasser</a>,&nbsp;
<a href="#" onclick="readyTerm('James Last'); return false">James Last</a>,&nbsp;
<a href="#" onclick="readyTerm('Klaus Wunderlich'); return false">Klaus Wunderlich</a>,&nbsp;
<a href="#" onclick="readyTerm('Maximo Spodek'); return false">Maximo Spodek</a>,&nbsp;
<a href="#" onclick="readyTerm('Nicolas de Angelis'); return false">Nicolas de Angelis</a>,&nbsp;
<a href="#" onclick="readyTerm('Paul Mauriat'); return false">Paul Mauriat</a>,&nbsp;
<a href="#" onclick="readyTerm('Ray Anthony'); return false">Ray Anthony</a>,&nbsp;
<a href="#" onclick="readyTerm('Ray Conniff'); return false">Ray Conniff</a>,&nbsp;
<a href="#" onclick="readyTerm('Richard Clayderman'); return false">Richard Clayderman</a>,&nbsp;
<a href="#" onclick="readyTerm('Ricky King'); return false">Ricky King</a>,&nbsp;
<a href="#" onclick="readyTerm('Romantic Guitar'); return false">Romantic Guitar</a>,&nbsp;
<a href="#" onclick="readyTerm('The Shadows'); return false">The Shadows</a>,&nbsp;
<br></div>
<br>
<b><i>Search Text may be anything:</i></b>&nbsp;Elvis Presley, Teresa Teng, china travel, ...
<br>
<b><i>Or the exact youtube username:</i></b>&nbsp;
Andreea Petcu, Expoza travel, pvhung20 ...
<br>
<br>
file:///H:/xampp/htdocs/v3t/SUMARY-search-videos/s1-code-rutgon-simp...
4 of 8 12/5/2015 9:40 PM
<div class='bar'>
<b>SEARCH RESULTS</b>&nbsp;&nbsp;
<button onclick="clearContent('r1')">Clear This Table</button>
</div><br>
<div id="list1"
style="width:620px;;height:300px;overflow:auto;background-color:white;text-align:left">
<table id="tableA" width="100%"><tbody id="r1">
</tbody></table>
</div>
<br>
<br>
<a name="bott"></a>
</div> <!-- center -->
</body>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js">
</script>
<script>
///////////////////// SEARCH YOUTUBE VIDEOS WITH API V.3 //////////////////////
tit = []; vid = [];
var nextPageToken;
portion = 30; // portion to be <= 50
var searchText = "";
var maxRes = portion;
var want = 120;
sum = 0; sumN = 0;
function oldstart(num){
want = num;
gapi.client.load('youtube', 'v3', onApiLoad);
}
function start(num){
want = num;
searchVid()
}
function searchVid(PageToken){
var searchText= $('#searchtext1').val();
$('#response1').html("<b>Searching for "+searchText+"</b>");
$.get(
"https://www.googleapis.com/youtube/v3/search",{
part : 'snippet',
q : searchText,
maxResults : 50,
pageToken : PageToken,
key: 'AIz*********************************zm4'},
/* REPLACE with your API KEY */
function myPlan(response){
nextPageToken=response.nextPageToken;
var resultCount = response.pageInfo.totalResults;
stList = '';
if(want >= resultCount){ want = resultCount}
file:///H:/xampp/htdocs/v3t/SUMARY-search-videos/s1-code-rutgon-simp...
5 of 8 12/5/2015 9:40 PM
itemsLen = response.items.length;
for (var i=0; i<response.items.length;i++){
var videoID =response.items[i].id.videoId;
if(typeof videoID != 'undefined'){
var titSt =response.items[i].snippet.title;
vid.push(videoID);
tit.push(titSt);
ss='<tr>'+
'<td style="width:80px;">'+
'<img width="80" height="60" src="http://img.youtube.com/vi/'+
videoID +'/default.jpg">'+
'</td><td valign="top"><b>'+ (sumN+1) +'</b>&nbsp;<a href="#" '+
'onclick="playVid('+sumN +', this); return false">'+
titSt +'</a><br>'+
videoID +'</td></tr>';
stList += ss;
document.getElementById('foundText').innerHTML =
'<span style="color:green"><b>'+sum+'</b></span>';
document.getElementById('wantSpan').innerHTML = '<b>'+ sumN + '</b>&nbsp;';
sum++ ; sumN++ ;
if((sum == want)||(sum == resultCount)){
document.getElementById('foundText').innerHTML =
'<span style="color:red"><b>'+sum+'</b></span>';
document.getElementById('wantSpan').innerHTML =
'<span style="color:#6600FF"><b>'+ sumN + '</b></span>';
document.getElementById('r1').innerHTML += stList;
sum = 0;
want = 120;
len = vid.length;
last = len - 1;
return;
}
} // End - if(typeof ...
} // End - for ...
document.getElementById('r1').innerHTML += stList;
x = want - sum;
if(x >= portion){
maxRes = portion;
}else{
maxRes = x;
}
searchVid(nextPageToken);
}); // End - $.get
} // End - searchVid(
////////////////////////// PLAY VIDEOS CONTINUOUSLY //////////////////////////
normalW = '812';
normalH = '516'
var player;
startvid = 'oY_eepAxzAM';
var jj = 0;
var tag = document.createElement('script');
tag.src = "http://www.youtube.com/player_api";
file:///H:/xampp/htdocs/v3t/SUMARY-search-videos/s1-code-rutgon-simp...
6 of 8 12/5/2015 9:40 PM
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
function onYouTubePlayerAPIReady() {
player = new YT.Player('player', {
width: normalW,
height:normalH,
videoId: startvid,
playerVars: { 'autoplay': 0, 'rel': 0, 'showinfo': 0, 'showsearch': 0, },
events: {
'onStateChange': onPlayerStateChange,
'onError': onPlayerError
}
});
}
function onPlayerError(error){
if ( error ){
nextVid();
}
}
function onPlayerStateChange(event) {
if (event.data == 0) {
nextVid();
return false;
}
}
function playVid(num){
jj=num;
showTit(num);
ide = vid[num];
player.loadVideoById(ide, "large");
ob = document.getElementById('list1')
ar = ob.getElementsByTagName('tr');
for(i=0;i<ar.length;i++){
if(ar[i].style.backgroundColor != "#EEEEEE"){
ar[i].style.backgroundColor = "#EEEEEE"
}
}
ar[num].style.backgroundColor = '#CCFF99';
}
function nextVid(){
len = vid.length;
if(len > 0){
last = len-1;
if(jj <= last){jj=jj+1};
if (jj > last){jj=0};
playVid(jj);
}else{
alert('At the openning, this page has only one video.nnYou should search them more')
}
}
function stopYoutube() {
player.seekTo(0, true);
file:///H:/xampp/htdocs/v3t/SUMARY-search-videos/s1-code-rutgon-simp...
7 of 8 12/5/2015 9:40 PM
player.stopVideo();
}
function showTit(k){
document.getElementById("vtitle").innerHTML = (k+1) +
'/'+ vid.length + ' : ' + tit[k];
}
////////////////// COMMON FUNCTIONS //////////////////
function init(){
leftNum = $('#player').position().left;
document.getElementById('header1').style.left = leftNum;
document.getElementById("vtitle").innerHTML = 'Clip A mave mai de Rataro Ohotoua.mov';
//document.getElementById(ele).innerHTML = '';
}
function clearContent(ele){
res = confirm('Are You sure? All newly found will be cleared');
if(res == false){
return
}else{
document.getElementById(ele).innerHTML = '';
sumN = 0;
vid = [];
tit = [];
document.getElementById('foundText').innerHTML =
'<span style="color:green"><b>'+'0'+'</b></span>';
document.getElementById('wantSpan').innerHTML = '<b>0</b>';
}
}
function readyTerm(term){
$("#searchtext1").val(term);
}
function goto(nam) {
window.location.hash= nam;
}
function scrollToElement(elem, add){
var top = $("#"+ elem).position().top;
$(window).scrollTop(top - add);
}
function makeLink1(file, thi, text2save){
thi.download = document.getElementById(file).value;
thi.href = "data:html/text; charset=utf-8, " + encodeURIComponent(text2save);
}
</script></html> <!--399 lines-->
file:///H:/xampp/htdocs/v3t/SUMARY-search-videos/s1-code-rutgon-simp...
8 of 8 12/5/2015 9:40 PM

More Related Content

What's hot

Using Buildout, GenericSetup and a Policy Package to Rule the World
Using Buildout, GenericSetup and a Policy Package to Rule the WorldUsing Buildout, GenericSetup and a Policy Package to Rule the World
Using Buildout, GenericSetup and a Policy Package to Rule the WorldClayton Parker
 
Wordpress Beyond Websites
Wordpress Beyond WebsitesWordpress Beyond Websites
Wordpress Beyond WebsitesScott Saunders
 
Rails Presentation (Anton Dmitriyev)
Rails Presentation (Anton Dmitriyev)Rails Presentation (Anton Dmitriyev)
Rails Presentation (Anton Dmitriyev)True-Vision
 
Adam Dangoor - Verified Fakes of Web Services
Adam Dangoor - Verified Fakes of Web ServicesAdam Dangoor - Verified Fakes of Web Services
Adam Dangoor - Verified Fakes of Web ServicesAdam Dangoor
 
Cheap frontend tricks
Cheap frontend tricksCheap frontend tricks
Cheap frontend tricksambiescent
 
The Best (and Worst) of Django
The Best (and Worst) of DjangoThe Best (and Worst) of Django
The Best (and Worst) of DjangoJacob Kaplan-Moss
 
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Mike Schinkel
 
Laravel 로 배우는 서버사이드 #5
Laravel 로 배우는 서버사이드 #5Laravel 로 배우는 서버사이드 #5
Laravel 로 배우는 서버사이드 #5성일 한
 
Socket applications
Socket applicationsSocket applications
Socket applicationsJoão Moura
 
What's new in Rails 2?
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?brynary
 
Pioneer a Strategic Change in Content Organization with Plone
Pioneer a Strategic Change in Content Organization with PlonePioneer a Strategic Change in Content Organization with Plone
Pioneer a Strategic Change in Content Organization with PloneClayton Parker
 
Mobile Device APIs
Mobile Device APIsMobile Device APIs
Mobile Device APIsJames Pearce
 
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...Atlassian
 
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014Hardcore URL Routing for WordPress - WordCamp Atlanta 2014
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014Mike Schinkel
 
Php Basic Security
Php Basic SecurityPhp Basic Security
Php Basic Securitymussawir20
 

What's hot (20)

Using Buildout, GenericSetup and a Policy Package to Rule the World
Using Buildout, GenericSetup and a Policy Package to Rule the WorldUsing Buildout, GenericSetup and a Policy Package to Rule the World
Using Buildout, GenericSetup and a Policy Package to Rule the World
 
Wordpress Beyond Websites
Wordpress Beyond WebsitesWordpress Beyond Websites
Wordpress Beyond Websites
 
Rails Presentation (Anton Dmitriyev)
Rails Presentation (Anton Dmitriyev)Rails Presentation (Anton Dmitriyev)
Rails Presentation (Anton Dmitriyev)
 
Adam Dangoor - Verified Fakes of Web Services
Adam Dangoor - Verified Fakes of Web ServicesAdam Dangoor - Verified Fakes of Web Services
Adam Dangoor - Verified Fakes of Web Services
 
Dr.Repi
Dr.Repi Dr.Repi
Dr.Repi
 
Cheap frontend tricks
Cheap frontend tricksCheap frontend tricks
Cheap frontend tricks
 
The Best (and Worst) of Django
The Best (and Worst) of DjangoThe Best (and Worst) of Django
The Best (and Worst) of Django
 
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
 
The Loop
The LoopThe Loop
The Loop
 
Laravel 로 배우는 서버사이드 #5
Laravel 로 배우는 서버사이드 #5Laravel 로 배우는 서버사이드 #5
Laravel 로 배우는 서버사이드 #5
 
Socket applications
Socket applicationsSocket applications
Socket applications
 
What's new in Rails 2?
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?
 
Pioneer a Strategic Change in Content Organization with Plone
Pioneer a Strategic Change in Content Organization with PlonePioneer a Strategic Change in Content Organization with Plone
Pioneer a Strategic Change in Content Organization with Plone
 
I Love codeigniter, You?
I Love codeigniter, You?I Love codeigniter, You?
I Love codeigniter, You?
 
Mobile Device APIs
Mobile Device APIsMobile Device APIs
Mobile Device APIs
 
Havij dork
Havij dorkHavij dork
Havij dork
 
Rails by example
Rails by exampleRails by example
Rails by example
 
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...
 
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014Hardcore URL Routing for WordPress - WordCamp Atlanta 2014
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014
 
Php Basic Security
Php Basic SecurityPhp Basic Security
Php Basic Security
 

Similar to Search videos with youtube api3

Search 500-video-clips
Search 500-video-clipsSearch 500-video-clips
Search 500-video-clipsphanhung20
 
关于 Html5 那点事
关于 Html5 那点事关于 Html5 那点事
关于 Html5 那点事Sofish Lin
 
What you need to know bout html5
What you need to know bout html5What you need to know bout html5
What you need to know bout html5Kevin DeRudder
 
SINATRA + HAML + TWITTER
SINATRA + HAML + TWITTERSINATRA + HAML + TWITTER
SINATRA + HAML + TWITTERElber Ribeiro
 
HTTP For the Good or the Bad - FSEC Edition
HTTP For the Good or the Bad - FSEC EditionHTTP For the Good or the Bad - FSEC Edition
HTTP For the Good or the Bad - FSEC EditionXavier Mertens
 
Zero to Sixty: AWS Elastic Beanstalk (DMG204) | AWS re:Invent 2013
Zero to Sixty: AWS Elastic Beanstalk (DMG204) | AWS re:Invent 2013Zero to Sixty: AWS Elastic Beanstalk (DMG204) | AWS re:Invent 2013
Zero to Sixty: AWS Elastic Beanstalk (DMG204) | AWS re:Invent 2013Amazon Web Services
 
HTML5 workshop, part 1
HTML5 workshop, part 1HTML5 workshop, part 1
HTML5 workshop, part 1Robert Nyman
 
Танки_в_Лунапарке: нагрузочное_тестирование_в_Яндексе
Танки_в_Лунапарке: нагрузочное_тестирование_в_ЯндексеТанки_в_Лунапарке: нагрузочное_тестирование_в_Яндексе
Танки_в_Лунапарке: нагрузочное_тестирование_в_ЯндексеYandex
 
Using HTML5 for a great Open Web
Using HTML5 for a great Open WebUsing HTML5 for a great Open Web
Using HTML5 for a great Open WebRobert Nyman
 
HTML5, The Open Web, and what it means for you - Altran
HTML5, The Open Web, and what it means for you - AltranHTML5, The Open Web, and what it means for you - Altran
HTML5, The Open Web, and what it means for you - AltranRobert Nyman
 
Leave No One Behind with HTML5 - FFWD.PRO, Croatia
Leave No One Behind with HTML5 - FFWD.PRO, CroatiaLeave No One Behind with HTML5 - FFWD.PRO, Croatia
Leave No One Behind with HTML5 - FFWD.PRO, CroatiaRobert Nyman
 
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and ImprovedTimothy Fisher
 
Search and play more than 50 clips
Search and play more than 50 clipsSearch and play more than 50 clips
Search and play more than 50 clipsphanhung20
 
Desenvolvimento web com Ruby on Rails (parte 2)
Desenvolvimento web com Ruby on Rails (parte 2)Desenvolvimento web com Ruby on Rails (parte 2)
Desenvolvimento web com Ruby on Rails (parte 2)Joao Lucas Santana
 

Similar to Search videos with youtube api3 (20)

Search 500-video-clips
Search 500-video-clipsSearch 500-video-clips
Search 500-video-clips
 
关于 Html5 那点事
关于 Html5 那点事关于 Html5 那点事
关于 Html5 那点事
 
9. lower in Symfony 4
9. lower in Symfony 49. lower in Symfony 4
9. lower in Symfony 4
 
What you need to know bout html5
What you need to know bout html5What you need to know bout html5
What you need to know bout html5
 
SINATRA + HAML + TWITTER
SINATRA + HAML + TWITTERSINATRA + HAML + TWITTER
SINATRA + HAML + TWITTER
 
HTTP For the Good or the Bad - FSEC Edition
HTTP For the Good or the Bad - FSEC EditionHTTP For the Good or the Bad - FSEC Edition
HTTP For the Good or the Bad - FSEC Edition
 
Zero to Sixty: AWS Elastic Beanstalk (DMG204) | AWS re:Invent 2013
Zero to Sixty: AWS Elastic Beanstalk (DMG204) | AWS re:Invent 2013Zero to Sixty: AWS Elastic Beanstalk (DMG204) | AWS re:Invent 2013
Zero to Sixty: AWS Elastic Beanstalk (DMG204) | AWS re:Invent 2013
 
HTML5 workshop, part 1
HTML5 workshop, part 1HTML5 workshop, part 1
HTML5 workshop, part 1
 
Танки_в_Лунапарке: нагрузочное_тестирование_в_Яндексе
Танки_в_Лунапарке: нагрузочное_тестирование_в_ЯндексеТанки_в_Лунапарке: нагрузочное_тестирование_в_Яндексе
Танки_в_Лунапарке: нагрузочное_тестирование_в_Яндексе
 
Html5 intro
Html5 introHtml5 intro
Html5 intro
 
Blog Hacks 2011
Blog Hacks 2011Blog Hacks 2011
Blog Hacks 2011
 
Using HTML5 for a great Open Web
Using HTML5 for a great Open WebUsing HTML5 for a great Open Web
Using HTML5 for a great Open Web
 
HTML5, The Open Web, and what it means for you - Altran
HTML5, The Open Web, and what it means for you - AltranHTML5, The Open Web, and what it means for you - Altran
HTML5, The Open Web, and what it means for you - Altran
 
Leave No One Behind with HTML5 - FFWD.PRO, Croatia
Leave No One Behind with HTML5 - FFWD.PRO, CroatiaLeave No One Behind with HTML5 - FFWD.PRO, Croatia
Leave No One Behind with HTML5 - FFWD.PRO, Croatia
 
Ant
Ant Ant
Ant
 
11. move in Symfony 4
11. move in Symfony 411. move in Symfony 4
11. move in Symfony 4
 
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and Improved
 
Search and play more than 50 clips
Search and play more than 50 clipsSearch and play more than 50 clips
Search and play more than 50 clips
 
Desenvolvimento web com Ruby on Rails (parte 2)
Desenvolvimento web com Ruby on Rails (parte 2)Desenvolvimento web com Ruby on Rails (parte 2)
Desenvolvimento web com Ruby on Rails (parte 2)
 
สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1
 

More from phanhung20

Graph for Coulomb damped oscillation
Graph for Coulomb damped oscillationGraph for Coulomb damped oscillation
Graph for Coulomb damped oscillationphanhung20
 
Color ss2-pvh-bta1
Color ss2-pvh-bta1Color ss2-pvh-bta1
Color ss2-pvh-bta1phanhung20
 
Pvh bai-tap-a2-2014-th-11(1)
Pvh bai-tap-a2-2014-th-11(1)Pvh bai-tap-a2-2014-th-11(1)
Pvh bai-tap-a2-2014-th-11(1)phanhung20
 
Cau hoi thi vatly 2014 4 tin chi
Cau hoi thi vatly 2014 4 tin chiCau hoi thi vatly 2014 4 tin chi
Cau hoi thi vatly 2014 4 tin chiphanhung20
 
Cau hoi-thi-catly-2014-thang11
Cau hoi-thi-catly-2014-thang11Cau hoi-thi-catly-2014-thang11
Cau hoi-thi-catly-2014-thang11phanhung20
 
Pvh 11-2014-btvl-a1
Pvh 11-2014-btvl-a1Pvh 11-2014-btvl-a1
Pvh 11-2014-btvl-a1phanhung20
 
Ly thuyetdosai so1
Ly thuyetdosai so1Ly thuyetdosai so1
Ly thuyetdosai so1phanhung20
 
Play audio-continuously
Play audio-continuouslyPlay audio-continuously
Play audio-continuouslyphanhung20
 
How to-save-video-list
How to-save-video-listHow to-save-video-list
How to-save-video-listphanhung20
 
Xem video-lien-tuc
Xem video-lien-tucXem video-lien-tuc
Xem video-lien-tucphanhung20
 
Non stop random2b
Non stop random2bNon stop random2b
Non stop random2bphanhung20
 
Playing videos. See:slideshare.net/phanhung20/non-stop-random2b
Playing videos. See:slideshare.net/phanhung20/non-stop-random2bPlaying videos. See:slideshare.net/phanhung20/non-stop-random2b
Playing videos. See:slideshare.net/phanhung20/non-stop-random2bphanhung20
 
Playing videos continously
Playing videos continously Playing videos continously
Playing videos continously phanhung20
 

More from phanhung20 (18)

Graph for Coulomb damped oscillation
Graph for Coulomb damped oscillationGraph for Coulomb damped oscillation
Graph for Coulomb damped oscillation
 
Color ss2-pvh-bta1
Color ss2-pvh-bta1Color ss2-pvh-bta1
Color ss2-pvh-bta1
 
Pvh bai-tap-a2-2014-th-11(1)
Pvh bai-tap-a2-2014-th-11(1)Pvh bai-tap-a2-2014-th-11(1)
Pvh bai-tap-a2-2014-th-11(1)
 
Cau hoi thi vatly 2014 4 tin chi
Cau hoi thi vatly 2014 4 tin chiCau hoi thi vatly 2014 4 tin chi
Cau hoi thi vatly 2014 4 tin chi
 
Cau hoi-thi-catly-2014-thang11
Cau hoi-thi-catly-2014-thang11Cau hoi-thi-catly-2014-thang11
Cau hoi-thi-catly-2014-thang11
 
Pvh 11-2014-btvl-a1
Pvh 11-2014-btvl-a1Pvh 11-2014-btvl-a1
Pvh 11-2014-btvl-a1
 
Debai table1
Debai table1Debai table1
Debai table1
 
Bai tap-a1
Bai tap-a1Bai tap-a1
Bai tap-a1
 
Thi nghiema2
Thi nghiema2Thi nghiema2
Thi nghiema2
 
Thi nghiema1
Thi nghiema1Thi nghiema1
Thi nghiema1
 
Ly thuyetdosai so1
Ly thuyetdosai so1Ly thuyetdosai so1
Ly thuyetdosai so1
 
Bai tap a1
Bai tap a1Bai tap a1
Bai tap a1
 
Play audio-continuously
Play audio-continuouslyPlay audio-continuously
Play audio-continuously
 
How to-save-video-list
How to-save-video-listHow to-save-video-list
How to-save-video-list
 
Xem video-lien-tuc
Xem video-lien-tucXem video-lien-tuc
Xem video-lien-tuc
 
Non stop random2b
Non stop random2bNon stop random2b
Non stop random2b
 
Playing videos. See:slideshare.net/phanhung20/non-stop-random2b
Playing videos. See:slideshare.net/phanhung20/non-stop-random2bPlaying videos. See:slideshare.net/phanhung20/non-stop-random2b
Playing videos. See:slideshare.net/phanhung20/non-stop-random2b
 
Playing videos continously
Playing videos continously Playing videos continously
Playing videos continously
 

Recently uploaded

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 

Recently uploaded (20)

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 

Search videos with youtube api3

  • 1. SEARCH YOUTUBE VIDEOS USING JAVASCRIPT AND API3 You can test this html file at the following address http://phanhung20.blogspot.com/2015/09/javascript-for-searching-videos.html This is the image of the web page Don't forget to replace "AIz*********************************zm4" with your Youtube API3 KEY <!DOCTYPE> <html> <head> file:///H:/xampp/htdocs/v3t/SUMARY-search-videos/s1-code-rutgon-simp... 1 of 8 12/5/2015 9:40 PM
  • 2. <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>more than 50 videos</title> <style> body{ background-color:#999999; margin:0px; padding:0px; font-family:Arial; font-size:10pt; } #r1 td{ border:1px solid gray; font-size:10pt; } a{ text-decoration:none; } a:hover{ color:green; } input[type="button"], button{ background-color:#DDDDDD; cursor:pointer; padding:0px; } #vtitle{ width:980px;height:25px;color:white;background-color:#1B1B1B; margin-top:-2px;overflow:hidden; padding-top:10px; } .bar{ width:608px; height:20px; background-color:#99CCFF; color:black; font-weight:bold; padding:6px; } #header1{ /*color:white; */ font-weight:bold; width:812px; height:24px; background-color:#006699; padding:3px; position: fixed; left: 0px; top: 0px; } #header1 td {border: none;} </style> </head> file:///H:/xampp/htdocs/v3t/SUMARY-search-videos/s1-code-rutgon-simp... 2 of 8 12/5/2015 9:40 PM
  • 3. <body onload="init()"> <div align="center"> <table id="header1" width="620px" height="42px" style="margin-bottom:-7px;"> <tr> <td width="30%" style="color:white;font-family:'Time New Roman';font-size:14pt"> <b><i>&nbsp;SIMPLE SEARCH</i></b> </td> <td style="text-align:right;vertical-align:middle">&nbsp; <span style="font-size:11pt;color:white"><i>Go to&nbsp;</i></span> <input type="button" onclick="scrollToElement('searchtext1',40)" value="Search"> <input type="button" onclick="goto('bott')" value="Bott"> <input type="button" onclick="window.scrollTo(0,0)" value="Top"> </td> <td width="40%" align="right"> <button type="button" onclick="stopYoutube();">Stop</button> <button type="button" onclick="player.pauseVideo();">Pause</button> <button type="button" onclick="player.playVideo();">Play</button> <button type="button" onclick="nextVid();">Next</button>&nbsp;&nbsp; </td> </tr> </table> <div style="width:100%;height:36px;"></div> <div id='player'></div> <div id="vtitle" style="text-align:center;width:812px;height:23px;color:white;background-color:#333333;padding-top:7px;"> </div> <!-------------------> <br> <table id="searchTBL" width="620" style="background-color:#99CCFF"> <tr> <td align="center" style="vertical-align:middle;font-size:12pt;font-weight:bold">&nbsp; <b><i>Search:</i></b>&nbsp;<input type="text" value="Franck Pourcel" id="searchtext1" size="75" style="border-style:inset"><br> <table width="90%"><tr><td width="120" style="border:none;vertical-align:middle"> <b><i>Total:</i></b>&nbsp;<span id="wantSpan" style="font-size:12pt;font-style: italic">0</span> </td ><td width="120" style="border:none;vertical-align:middle"> <b><i>Found:</i></b>&nbsp;<span id="foundText" style="font-size:12pt;font-style: italic">0</span> </td><td align="right" style="border:none;vertical-align:middle"> <button type="button" onclick="start(40)">S40</button> <button type="button" onclick="start(180)">S180</button> <button type="button" onclick="start(300)">S300</button> <button type="button" onclick="start(400)">S400</button> <button type="button" onclick="start(500)">S500</button> </tr></table> </td> </td> </tr> </table> <br> <div id="tip" style = "width:580px;height:130px;overflow:auto;background-color:white;text-align:left;padding:20px;line-height:160%"> <b>ABSOLUTLY EXACT USER NAME:</b><br> <a href="#" onclick="readyTerm('Andreea Petcu'); return false">Andreea Petcu</a>,&nbsp; <a href="#" onclick="readyTerm('Expoza travel'); return false">Expoza travel</a>,&nbsp; <br> file:///H:/xampp/htdocs/v3t/SUMARY-search-videos/s1-code-rutgon-simp... 3 of 8 12/5/2015 9:40 PM
  • 4. <b>FREE TEXT (ANYTHING):</b> <br> <a href="#" onclick="readyTerm('china travel'); return false">china travel</a>,&nbsp; <a href="#" onclick="readyTerm('india travel'); return false">india travel</a>,&nbsp; <br> <a href="#" onclick="readyTerm('youtube data api version 3'); return false"> youtube data api version 3</a>, <a href="#" onclick="readyTerm('youtube iframe player javascript'); return false"> youtube iframe player javascript</a>, <br><br> <a href="#" onclick="readyTerm('101 Strings'); return false">101 Strings</a>,&nbsp; <a href="#" onclick="readyTerm('Abba'); return false">Abba</a>,&nbsp; <a href="#" onclick="readyTerm('Bee Gees'); return false">Bee Gees</a>,&nbsp; <a href="#" onclick="readyTerm('Bert Kaempfert'); return false">Bert Kaempfert</a>,&nbsp; <a href="#" onclick="readyTerm('Billy Vaughn'); return false">Billy Vaughn</a>,&nbsp; <a href="#" onclick="readyTerm('Caravelli'); return false">Caravelli</a>,&nbsp; <a href="#" onclick="readyTerm('Carpenters'); return false">Carpenters</a>,&nbsp; <a href="#" onclick="readyTerm('Cecil Gonzalez instrumental'); return false"> Cecil Gonzalez instrumental</a>,&nbsp; <a href="#" onclick="readyTerm('Enrique Chia'); return false">Enrique Chia</a>,&nbsp; <a href="#" onclick="readyTerm('Francisco Garcia guitarist'); return false"> Francisco Garcia guitarist</a>,&nbsp; <a href="#" onclick="readyTerm('Franck Pourcel'); return false">Franck Pourcel</a>,&nbsp; <a href="#" onclick="readyTerm('Frank Chacksfield'); return false">Frank Chacksfield</a>,&nbsp; <a href="#" onclick="readyTerm('Guitar Mood'); return false">Guitar Mood</a>,&nbsp; <a href="#" onclick="readyTerm('Helmut Zacharias'); return false">Helmut Zacharias</a>,&nbsp; <a href="#" onclick="readyTerm('Hugo Montenegro'); return false">Hugo Montenegro</a>,&nbsp; <a href="#" onclick="readyTerm('Hugo Strasser'); return false">Hugo Strasser</a>,&nbsp; <a href="#" onclick="readyTerm('James Last'); return false">James Last</a>,&nbsp; <a href="#" onclick="readyTerm('Klaus Wunderlich'); return false">Klaus Wunderlich</a>,&nbsp; <a href="#" onclick="readyTerm('Maximo Spodek'); return false">Maximo Spodek</a>,&nbsp; <a href="#" onclick="readyTerm('Nicolas de Angelis'); return false">Nicolas de Angelis</a>,&nbsp; <a href="#" onclick="readyTerm('Paul Mauriat'); return false">Paul Mauriat</a>,&nbsp; <a href="#" onclick="readyTerm('Ray Anthony'); return false">Ray Anthony</a>,&nbsp; <a href="#" onclick="readyTerm('Ray Conniff'); return false">Ray Conniff</a>,&nbsp; <a href="#" onclick="readyTerm('Richard Clayderman'); return false">Richard Clayderman</a>,&nbsp; <a href="#" onclick="readyTerm('Ricky King'); return false">Ricky King</a>,&nbsp; <a href="#" onclick="readyTerm('Romantic Guitar'); return false">Romantic Guitar</a>,&nbsp; <a href="#" onclick="readyTerm('The Shadows'); return false">The Shadows</a>,&nbsp; <br></div> <br> <b><i>Search Text may be anything:</i></b>&nbsp;Elvis Presley, Teresa Teng, china travel, ... <br> <b><i>Or the exact youtube username:</i></b>&nbsp; Andreea Petcu, Expoza travel, pvhung20 ... <br> <br> file:///H:/xampp/htdocs/v3t/SUMARY-search-videos/s1-code-rutgon-simp... 4 of 8 12/5/2015 9:40 PM
  • 5. <div class='bar'> <b>SEARCH RESULTS</b>&nbsp;&nbsp; <button onclick="clearContent('r1')">Clear This Table</button> </div><br> <div id="list1" style="width:620px;;height:300px;overflow:auto;background-color:white;text-align:left"> <table id="tableA" width="100%"><tbody id="r1"> </tbody></table> </div> <br> <br> <a name="bott"></a> </div> <!-- center --> </body> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"> </script> <script> ///////////////////// SEARCH YOUTUBE VIDEOS WITH API V.3 ////////////////////// tit = []; vid = []; var nextPageToken; portion = 30; // portion to be <= 50 var searchText = ""; var maxRes = portion; var want = 120; sum = 0; sumN = 0; function oldstart(num){ want = num; gapi.client.load('youtube', 'v3', onApiLoad); } function start(num){ want = num; searchVid() } function searchVid(PageToken){ var searchText= $('#searchtext1').val(); $('#response1').html("<b>Searching for "+searchText+"</b>"); $.get( "https://www.googleapis.com/youtube/v3/search",{ part : 'snippet', q : searchText, maxResults : 50, pageToken : PageToken, key: 'AIz*********************************zm4'}, /* REPLACE with your API KEY */ function myPlan(response){ nextPageToken=response.nextPageToken; var resultCount = response.pageInfo.totalResults; stList = ''; if(want >= resultCount){ want = resultCount} file:///H:/xampp/htdocs/v3t/SUMARY-search-videos/s1-code-rutgon-simp... 5 of 8 12/5/2015 9:40 PM
  • 6. itemsLen = response.items.length; for (var i=0; i<response.items.length;i++){ var videoID =response.items[i].id.videoId; if(typeof videoID != 'undefined'){ var titSt =response.items[i].snippet.title; vid.push(videoID); tit.push(titSt); ss='<tr>'+ '<td style="width:80px;">'+ '<img width="80" height="60" src="http://img.youtube.com/vi/'+ videoID +'/default.jpg">'+ '</td><td valign="top"><b>'+ (sumN+1) +'</b>&nbsp;<a href="#" '+ 'onclick="playVid('+sumN +', this); return false">'+ titSt +'</a><br>'+ videoID +'</td></tr>'; stList += ss; document.getElementById('foundText').innerHTML = '<span style="color:green"><b>'+sum+'</b></span>'; document.getElementById('wantSpan').innerHTML = '<b>'+ sumN + '</b>&nbsp;'; sum++ ; sumN++ ; if((sum == want)||(sum == resultCount)){ document.getElementById('foundText').innerHTML = '<span style="color:red"><b>'+sum+'</b></span>'; document.getElementById('wantSpan').innerHTML = '<span style="color:#6600FF"><b>'+ sumN + '</b></span>'; document.getElementById('r1').innerHTML += stList; sum = 0; want = 120; len = vid.length; last = len - 1; return; } } // End - if(typeof ... } // End - for ... document.getElementById('r1').innerHTML += stList; x = want - sum; if(x >= portion){ maxRes = portion; }else{ maxRes = x; } searchVid(nextPageToken); }); // End - $.get } // End - searchVid( ////////////////////////// PLAY VIDEOS CONTINUOUSLY ////////////////////////// normalW = '812'; normalH = '516' var player; startvid = 'oY_eepAxzAM'; var jj = 0; var tag = document.createElement('script'); tag.src = "http://www.youtube.com/player_api"; file:///H:/xampp/htdocs/v3t/SUMARY-search-videos/s1-code-rutgon-simp... 6 of 8 12/5/2015 9:40 PM
  • 7. var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); function onYouTubePlayerAPIReady() { player = new YT.Player('player', { width: normalW, height:normalH, videoId: startvid, playerVars: { 'autoplay': 0, 'rel': 0, 'showinfo': 0, 'showsearch': 0, }, events: { 'onStateChange': onPlayerStateChange, 'onError': onPlayerError } }); } function onPlayerError(error){ if ( error ){ nextVid(); } } function onPlayerStateChange(event) { if (event.data == 0) { nextVid(); return false; } } function playVid(num){ jj=num; showTit(num); ide = vid[num]; player.loadVideoById(ide, "large"); ob = document.getElementById('list1') ar = ob.getElementsByTagName('tr'); for(i=0;i<ar.length;i++){ if(ar[i].style.backgroundColor != "#EEEEEE"){ ar[i].style.backgroundColor = "#EEEEEE" } } ar[num].style.backgroundColor = '#CCFF99'; } function nextVid(){ len = vid.length; if(len > 0){ last = len-1; if(jj <= last){jj=jj+1}; if (jj > last){jj=0}; playVid(jj); }else{ alert('At the openning, this page has only one video.nnYou should search them more') } } function stopYoutube() { player.seekTo(0, true); file:///H:/xampp/htdocs/v3t/SUMARY-search-videos/s1-code-rutgon-simp... 7 of 8 12/5/2015 9:40 PM
  • 8. player.stopVideo(); } function showTit(k){ document.getElementById("vtitle").innerHTML = (k+1) + '/'+ vid.length + ' : ' + tit[k]; } ////////////////// COMMON FUNCTIONS ////////////////// function init(){ leftNum = $('#player').position().left; document.getElementById('header1').style.left = leftNum; document.getElementById("vtitle").innerHTML = 'Clip A mave mai de Rataro Ohotoua.mov'; //document.getElementById(ele).innerHTML = ''; } function clearContent(ele){ res = confirm('Are You sure? All newly found will be cleared'); if(res == false){ return }else{ document.getElementById(ele).innerHTML = ''; sumN = 0; vid = []; tit = []; document.getElementById('foundText').innerHTML = '<span style="color:green"><b>'+'0'+'</b></span>'; document.getElementById('wantSpan').innerHTML = '<b>0</b>'; } } function readyTerm(term){ $("#searchtext1").val(term); } function goto(nam) { window.location.hash= nam; } function scrollToElement(elem, add){ var top = $("#"+ elem).position().top; $(window).scrollTop(top - add); } function makeLink1(file, thi, text2save){ thi.download = document.getElementById(file).value; thi.href = "data:html/text; charset=utf-8, " + encodeURIComponent(text2save); } </script></html> <!--399 lines--> file:///H:/xampp/htdocs/v3t/SUMARY-search-videos/s1-code-rutgon-simp... 8 of 8 12/5/2015 9:40 PM