SlideShare a Scribd company logo
1 of 8
Download to read offline
HOW TO SEARCH YOUTUBE VIDEOS USING API 3
I would like to share with you my 2 web pages:
1- demo-search.html
With it you can find 210, 300 or 510 youtube video clips, by only one mouse click.
Because it is a demo (testing) web, the source code is strongly simplified.
In the result you can read only one clip from 300 or 510 that ware found and stored in PC
memory (as elements of two arrays).
Select all the content you see, copy it, open a new file in your program "Notepad", paste it
there and save it as js file (javascript file).
To play clips in this javascritpt file you can you my page:
http://play-videos.url.ph/v3/search2.html
Just click the button "browser" and choose this js file (from your PC).
2-simple-search.html
1
This web also can find 300 or 510 clips. But all found clips are shown as links (anchor tags).
If you click on any link, all clips will be played continuously, one after another.
In the following you wll see
The source code of "demo-search.html" and "simple-search.html
2
Page:1/2pdf-simplest-search.html
Last modification: 9/14/2015 5:08:34 PMH:xampphtdocshoc-book-Vikram-timv3aready-2-goog-slideshow
<!DOCTYPE>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>api3 search</title>
<style>
body{
font-family:Arial;
font-size:10pt;
}
</style>
</head>
<body>
<div align="center">
<br>
<div id="menu" style="background-color:#99CCFF;padding:4px;width:100%">
<b>All Found:&nbsp;<span id="allSpan"
style="font-size:12pt;font-style: italic">0</span></b>
&nbsp;
<b><i>Search Text:</i></b>&nbsp;<input type="text"
value="Folli Michelangelo"
id="searchtext1" size="66" style="border-style:inset">&nbsp;
<button type="button" onclick="start(30)">S30</button>
<button type="button" onclick="start(210)">S210</button>
<button type="button" onclick="start(300)">S300</button>
<button type="button" onclick="start(510)">S510</button>
</div>
<br>
<b><i>Search Text may be:</i></b>&nbsp;Abba, Folli Michelangelo, Franck Pourcel,
Paul Mauriat, Richard Clayderman, Romantic Guitar ...
<br>
<b><i>Or the exact youtube username:</i></b>&nbsp;
Tatiana Blue, Expoza travel,pvhung20 ...
<br>
<br>
<div id="div1" style=
"width:75%;height:420px;text-align:left;padding:15px;overflow:auto;border:gray solid
1px;">
vst += "";<br><br>
</div>
<br>
<br>
</div> <!-- center -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="https://apis.google.com/js/client.js?onload=onClientLoad"
type="text/javascript">
</script>
<script>
tit = []; vid = [];
var nextPageToken;
portion = 30; // portion to be <= 50
var searchText = "";
var maxRes = portion;
var want = 210; sum = 0; sumN = 0;
function start(num){
PSPad editor 4.5.7 (2450) www.pspad.com 9/14/2015 5:11:22 PM Administrator
Page:2/2pdf-simplest-search.html
Last modification: 9/14/2015 5:08:34 PMH:xampphtdocshoc-book-Vikram-timv3aready-2-goog-slideshow
want = num;
gapi.client.load('youtube', 'v3', onApiLoad);
}
function onApiLoad(){
gapi.client.setApiKey('Abc*********************************123');
// Replace it with your API key and run this web with XAMPP (on PC)
// OR upload it to your hosting web then run it
searchVid();
}
function searchVid(PageToken){
searchText= $('#searchtext1').val();
var request = gapi.client.youtube.search.list({
part: 'snippet',
q:searchText,
maxResults:maxRes,
pageToken:PageToken
});
request.execute(myPlan);
}
function myPlan(response){
nextPageToken=response.nextPageToken;
var resultCount = response.pageInfo.totalResults;
if(want >= resultCount){ want = resultCount}
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);
document.getElementById('allSpan').innerHTML = sumN + '';
sum++ ; sumN++ ;
if((sum == want)||(sum == resultCount)){
document.getElementById('allSpan').innerHTML =
'<span style="color:red">'+ sumN + '</span>';
len = vid.length;
st = '// Searching '+ searchText + '<br>';
st += '// ' + sum + ' videos found. Among them:<br>'+
'vst += "' + tit[len-1] + '"+<br>"' + vid[len-1] + '@";<br><br>';
document.getElementById('div1').innerHTML += st;
sum = 0;
return;
}
}
}
x = want - sum;
if(x >= portion){
maxRes = portion;
}else{
maxRes = x;
}
searchVid(nextPageToken);
}
</script>
</body></html>
PSPad editor 4.5.7 (2450) www.pspad.com 9/14/2015 5:11:22 PM Administrator
Page:1/4pdf-simple-search.html
H:xampphtdocshoc-book-Vikram-timv3a Last modification: 9/14/2015 2:57:32 PM
<!DOCTYPE>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>api3 search</title>
<style>
body{
background-color:#CCCCCC;
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:812px;height:25px;color:white;background-color:#1B1B1B;
margin-top:-2px;overflow:hidden;
padding-top:10px;
}
</style>
</head>
<body>
<div align="center">
<div id='player'></div>
<div id="vtitle"></div>
<br>
<div id="menu" style="background-color:#6699CC;padding:4px;width:100%">
<table ><tr style="font-size:10pt;">
<td style="background-color:#EEEEEE" style="border:1px gray solid">
<b>All:&nbsp;
<span id="allSpan" style="font-size:12pt;font-style: italic">0</span></b>
&nbsp;
<b><i>Found:</i>&nbsp;
<span id="foundSpan" style="font-size:12pt;font-style: italic;color:green">0
</span>&nbsp;</td></b>
<td style="border:1px gray solid;vertical-align:middle">&nbsp;
<b><i>Search Text:</i></b>&nbsp;<input type="text"
value="Folli Michelangelo"
id="searchtext1" size="72" style="border-style:inset">&nbsp;
<button type="button" onclick="start(30)">S30</button>
<button type="button" onclick="start(210)">S210</button>
<button type="button" onclick="start(300)">S300</button>
<button type="button" onclick="start(510)">S510</button>
</td>
PSPad editor 4.5.7 (2450) www.pspad.com Administrator9/14/2015 2:59:10 PM
Page:2/4pdf-simple-search.html
H:xampphtdocshoc-book-Vikram-timv3a Last modification: 9/14/2015 2:57:32 PM
</tr></table>
</div>
<br>
<b><i>Search Text may be:</i></b>&nbsp;
Abba, Folli Michelangelo, Paul Mauriat, Richard Clayderman, Romantic Guitar ...
<br><br>
<b>Search Results</b>&nbsp;&nbsp;
<button onclick="clearContent('r1')">Clear This Table</button>
<br><br>
<div id="list1"
style="width:750px;;height:300px;overflow:auto;background-color:white;text-align:left">
<table id="tableA" width="100%"><tbody id="r1">
</tbody></table>
</div>
<br><br>
</div> <!-- center -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="https://apis.google.com/js/client.js?onload=onClientLoad"
type="text/javascript">
</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 = 210; sum = 0; sumN = 0;
function start(num){
want = num;
gapi.client.load('youtube', 'v3', onApiLoad);
}
function onApiLoad(){
gapi.client.setApiKey('Abc**********************************123');
// Replace it with your API key and run this web with XAMPP (on PC)
// OR upload it to your hosting web then run it
searchVid();
}
function searchVid(PageToken){
var searchText= $('#searchtext1').val();
var request = gapi.client.youtube.search.list({
part: 'snippet',
q:searchText,
maxResults:maxRes,
pageToken:PageToken
});
request.execute(myPlan);
}
function myPlan(response){
nextPageToken=response.nextPageToken;
var resultCount = response.pageInfo.totalResults;
stList = '';
if(want >= resultCount){ want = resultCount}
for (var i=0; i<response.items.length;i++){
PSPad editor 4.5.7 (2450) www.pspad.com Administrator9/14/2015 2:59:10 PM
Page:3/4pdf-simple-search.html
H:xampphtdocshoc-book-Vikram-timv3a Last modification: 9/14/2015 2:57:32 PM
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><b>'+ (sumN+1) +'</b>&nbsp;<a href="#" '+
'onclick="playVid('+sumN +', this); return false">'+
titSt +'</a></td></tr>';
stList += ss;
document.getElementById('foundSpan').innerHTML =
'<span style="color:green"><b>'+sum+'</b></span>';
document.getElementById('allSpan').innerHTML = sumN + '';
sum++ ; sumN++ ;
if((sum == want)||(sum == resultCount)){
document.getElementById('foundSpan').innerHTML =
'<span style="color:red"><b>'+sum+'</b></span>';
document.getElementById('allSpan').innerHTML =
'<span style="color:#6600FF">'+ sumN + '</span>';
document.getElementById('r1').innerHTML += stList;
sum = 0;
// want = 120;
len = vid.length;
last = len - 1;
return;
}
}
}
document.getElementById('r1').innerHTML += stList;
x = want - sum;
if(x >= portion){
maxRes = portion;
}else{
maxRes = x;
}
searchVid(nextPageToken);
}
/////////////// PLAY VIDEOS CONTINUOUSLY ///////////////
normalW = '812'; normalH = '516'
var player; startvid = vid[0];
var jj = 0;
var tag = document.createElement('script');
tag.src = "http://www.youtube.com/player_api";
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,
PSPad editor 4.5.7 (2450) www.pspad.com Administrator9/14/2015 2:59:10 PM
Page:4/4pdf-simple-search.html
H:xampphtdocshoc-book-Vikram-timv3a Last modification: 9/14/2015 2:57:32 PM
'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; last = len-1;
if(jj <= last){jj=jj+1};
if (jj > last){jj=0};
playVid(jj);
}
function showTit(k){
document.getElementById("vtitle").innerHTML = (k+1) +
'/'+ vid.length + ' : ' + tit[k];
}
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 = []; jj = 0;
document.getElementById('foundSpan').innerHTML =
'<span style="color:green"><b>'+'0'+'</b></span>';
document.getElementById('allSpan').innerHTML = '<b>0</b>';
}
}
</script>
</body></html>
PSPad editor 4.5.7 (2450) www.pspad.com Administrator9/14/2015 2:59:10 PM

More Related Content

What's hot

Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...Ondřej Machulda
 
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Ondřej Machulda
 
HTML5 tutorial: canvas, offfline & sockets
HTML5 tutorial: canvas, offfline & socketsHTML5 tutorial: canvas, offfline & sockets
HTML5 tutorial: canvas, offfline & socketsRemy Sharp
 
High Performance Snippets
High Performance SnippetsHigh Performance Snippets
High Performance SnippetsSteve Souders
 
Lights, Camera, Docker: Streaming Video at DramaFever
Lights, Camera, Docker: Streaming Video at DramaFeverLights, Camera, Docker: Streaming Video at DramaFever
Lights, Camera, Docker: Streaming Video at DramaFeverbridgetkromhout
 
Denys Serhiienko "ASGI in depth"
Denys Serhiienko "ASGI in depth"Denys Serhiienko "ASGI in depth"
Denys Serhiienko "ASGI in depth"Fwdays
 
"Your script just killed my site" by Steve Souders
"Your script just killed my site" by Steve Souders"Your script just killed my site" by Steve Souders
"Your script just killed my site" by Steve SoudersDmitry Makarchuk
 
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...Ryan Weaver
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpOptimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpMatthew Davis
 
Testing frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabsTesting frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabsTudor Barbu
 
[cssdevconf] Adaptive Images in Responsive Web Design
[cssdevconf] Adaptive Images in Responsive Web Design[cssdevconf] Adaptive Images in Responsive Web Design
[cssdevconf] Adaptive Images in Responsive Web DesignChristopher Schmitt
 
Chrome Devtools Protocol via Selenium/Appium (Japanese)
Chrome Devtools Protocol via Selenium/Appium (Japanese)Chrome Devtools Protocol via Selenium/Appium (Japanese)
Chrome Devtools Protocol via Selenium/Appium (Japanese)Kazuaki Matsuo
 
Ionic으로 모바일앱 만들기 #4
Ionic으로 모바일앱 만들기 #4Ionic으로 모바일앱 만들기 #4
Ionic으로 모바일앱 만들기 #4성일 한
 
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSHTame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSHDavid Stockton
 
Webpack Encore Symfony Live 2017 San Francisco
Webpack Encore Symfony Live 2017 San FranciscoWebpack Encore Symfony Live 2017 San Francisco
Webpack Encore Symfony Live 2017 San FranciscoRyan Weaver
 
Google I/O 2012 - Protecting your user experience while integrating 3rd party...
Google I/O 2012 - Protecting your user experience while integrating 3rd party...Google I/O 2012 - Protecting your user experience while integrating 3rd party...
Google I/O 2012 - Protecting your user experience while integrating 3rd party...Patrick Meenan
 
Hands on Pier
Hands on PierHands on Pier
Hands on PierESUG
 
Symfony: Your Next Microframework (SymfonyCon 2015)
Symfony: Your Next Microframework (SymfonyCon 2015)Symfony: Your Next Microframework (SymfonyCon 2015)
Symfony: Your Next Microframework (SymfonyCon 2015)Ryan Weaver
 
Scraping recalcitrant web sites with Python & Selenium
Scraping recalcitrant web sites with Python & SeleniumScraping recalcitrant web sites with Python & Selenium
Scraping recalcitrant web sites with Python & SeleniumRoger Barnes
 

What's hot (20)

Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
 
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
 
HTML5 tutorial: canvas, offfline & sockets
HTML5 tutorial: canvas, offfline & socketsHTML5 tutorial: canvas, offfline & sockets
HTML5 tutorial: canvas, offfline & sockets
 
High Performance Snippets
High Performance SnippetsHigh Performance Snippets
High Performance Snippets
 
Lights, Camera, Docker: Streaming Video at DramaFever
Lights, Camera, Docker: Streaming Video at DramaFeverLights, Camera, Docker: Streaming Video at DramaFever
Lights, Camera, Docker: Streaming Video at DramaFever
 
Denys Serhiienko "ASGI in depth"
Denys Serhiienko "ASGI in depth"Denys Serhiienko "ASGI in depth"
Denys Serhiienko "ASGI in depth"
 
"Your script just killed my site" by Steve Souders
"Your script just killed my site" by Steve Souders"Your script just killed my site" by Steve Souders
"Your script just killed my site" by Steve Souders
 
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpOptimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
 
Testing frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabsTesting frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabs
 
[cssdevconf] Adaptive Images in Responsive Web Design
[cssdevconf] Adaptive Images in Responsive Web Design[cssdevconf] Adaptive Images in Responsive Web Design
[cssdevconf] Adaptive Images in Responsive Web Design
 
Chrome Devtools Protocol via Selenium/Appium (Japanese)
Chrome Devtools Protocol via Selenium/Appium (Japanese)Chrome Devtools Protocol via Selenium/Appium (Japanese)
Chrome Devtools Protocol via Selenium/Appium (Japanese)
 
Ionic으로 모바일앱 만들기 #4
Ionic으로 모바일앱 만들기 #4Ionic으로 모바일앱 만들기 #4
Ionic으로 모바일앱 만들기 #4
 
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSHTame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
 
Webpack Encore Symfony Live 2017 San Francisco
Webpack Encore Symfony Live 2017 San FranciscoWebpack Encore Symfony Live 2017 San Francisco
Webpack Encore Symfony Live 2017 San Francisco
 
Google I/O 2012 - Protecting your user experience while integrating 3rd party...
Google I/O 2012 - Protecting your user experience while integrating 3rd party...Google I/O 2012 - Protecting your user experience while integrating 3rd party...
Google I/O 2012 - Protecting your user experience while integrating 3rd party...
 
Hands on Pier
Hands on PierHands on Pier
Hands on Pier
 
Symfony: Your Next Microframework (SymfonyCon 2015)
Symfony: Your Next Microframework (SymfonyCon 2015)Symfony: Your Next Microframework (SymfonyCon 2015)
Symfony: Your Next Microframework (SymfonyCon 2015)
 
Scraping recalcitrant web sites with Python & Selenium
Scraping recalcitrant web sites with Python & SeleniumScraping recalcitrant web sites with Python & Selenium
Scraping recalcitrant web sites with Python & Selenium
 
Night Watch with QA
Night Watch with QANight Watch with QA
Night Watch with QA
 

Similar to Find YouTube Videos Using API

Search 500-video-clips
Search 500-video-clipsSearch 500-video-clips
Search 500-video-clipsphanhung20
 
Protractor framework architecture with example
Protractor framework architecture with exampleProtractor framework architecture with example
Protractor framework architecture with exampleshadabgilani
 
Using HttpWatch Plug-in with Selenium Automation in Java
Using HttpWatch Plug-in with Selenium Automation in JavaUsing HttpWatch Plug-in with Selenium Automation in Java
Using HttpWatch Plug-in with Selenium Automation in JavaSandeep Tol
 
Quickly function add by Eclipse Monkey
Quickly function add by Eclipse MonkeyQuickly function add by Eclipse Monkey
Quickly function add by Eclipse Monkeybose999
 
Future of Web Apps: Google Gears
Future of Web Apps: Google GearsFuture of Web Apps: Google Gears
Future of Web Apps: Google Gearsdion
 
DrupalCon Dublin 2016 - Automated browser testing with Nightwatch.js
DrupalCon Dublin 2016 - Automated browser testing with Nightwatch.jsDrupalCon Dublin 2016 - Automated browser testing with Nightwatch.js
DrupalCon Dublin 2016 - Automated browser testing with Nightwatch.jsVladimir Roudakov
 
[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web DesignChristopher Schmitt
 
Writing your Third Plugin
Writing your Third PluginWriting your Third Plugin
Writing your Third PluginJustin Ryan
 
Plack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and serversPlack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and serversTatsuhiko Miyagawa
 
Build Your Own CMS with Apache Sling
Build Your Own CMS with Apache SlingBuild Your Own CMS with Apache Sling
Build Your Own CMS with Apache SlingBob Paulin
 
Puppeteer - A web scraping & UI Testing Tool
Puppeteer - A web scraping & UI Testing ToolPuppeteer - A web scraping & UI Testing Tool
Puppeteer - A web scraping & UI Testing ToolMiki Lombardi
 
Technical Tips: Visual Regression Testing and Environment Comparison with Bac...
Technical Tips: Visual Regression Testing and Environment Comparison with Bac...Technical Tips: Visual Regression Testing and Environment Comparison with Bac...
Technical Tips: Visual Regression Testing and Environment Comparison with Bac...Building Blocks
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Herokuronnywang_tw
 
Velocity EU 2012 - Third party scripts and you
Velocity EU 2012 - Third party scripts and youVelocity EU 2012 - Third party scripts and you
Velocity EU 2012 - Third party scripts and youPatrick Meenan
 
Selenium Automation in Java Using HttpWatch Plug-in
 Selenium Automation in Java Using HttpWatch Plug-in  Selenium Automation in Java Using HttpWatch Plug-in
Selenium Automation in Java Using HttpWatch Plug-in Sandeep Tol
 
Even Faster Web Sites at jQuery Conference '09
Even Faster Web Sites at jQuery Conference '09Even Faster Web Sites at jQuery Conference '09
Even Faster Web Sites at jQuery Conference '09Steve Souders
 

Similar to Find YouTube Videos Using API (20)

Search 500-video-clips
Search 500-video-clipsSearch 500-video-clips
Search 500-video-clips
 
Protractor framework architecture with example
Protractor framework architecture with exampleProtractor framework architecture with example
Protractor framework architecture with example
 
Using HttpWatch Plug-in with Selenium Automation in Java
Using HttpWatch Plug-in with Selenium Automation in JavaUsing HttpWatch Plug-in with Selenium Automation in Java
Using HttpWatch Plug-in with Selenium Automation in Java
 
Quickly function add by Eclipse Monkey
Quickly function add by Eclipse MonkeyQuickly function add by Eclipse Monkey
Quickly function add by Eclipse Monkey
 
Future of Web Apps: Google Gears
Future of Web Apps: Google GearsFuture of Web Apps: Google Gears
Future of Web Apps: Google Gears
 
DrupalCon Dublin 2016 - Automated browser testing with Nightwatch.js
DrupalCon Dublin 2016 - Automated browser testing with Nightwatch.jsDrupalCon Dublin 2016 - Automated browser testing with Nightwatch.js
DrupalCon Dublin 2016 - Automated browser testing with Nightwatch.js
 
[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design
 
Play framework
Play frameworkPlay framework
Play framework
 
Writing your Third Plugin
Writing your Third PluginWriting your Third Plugin
Writing your Third Plugin
 
Plack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and serversPlack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and servers
 
Build Your Own CMS with Apache Sling
Build Your Own CMS with Apache SlingBuild Your Own CMS with Apache Sling
Build Your Own CMS with Apache Sling
 
Puppeteer - A web scraping & UI Testing Tool
Puppeteer - A web scraping & UI Testing ToolPuppeteer - A web scraping & UI Testing Tool
Puppeteer - A web scraping & UI Testing Tool
 
Technical Tips: Visual Regression Testing and Environment Comparison with Bac...
Technical Tips: Visual Regression Testing and Environment Comparison with Bac...Technical Tips: Visual Regression Testing and Environment Comparison with Bac...
Technical Tips: Visual Regression Testing and Environment Comparison with Bac...
 
Nodejs in Production
Nodejs in ProductionNodejs in Production
Nodejs in Production
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku
 
Velocity EU 2012 - Third party scripts and you
Velocity EU 2012 - Third party scripts and youVelocity EU 2012 - Third party scripts and you
Velocity EU 2012 - Third party scripts and you
 
Dancing with websocket
Dancing with websocketDancing with websocket
Dancing with websocket
 
Makezine
MakezineMakezine
Makezine
 
Selenium Automation in Java Using HttpWatch Plug-in
 Selenium Automation in Java Using HttpWatch Plug-in  Selenium Automation in Java Using HttpWatch Plug-in
Selenium Automation in Java Using HttpWatch Plug-in
 
Even Faster Web Sites at jQuery Conference '09
Even Faster Web Sites at jQuery Conference '09Even Faster Web Sites at jQuery Conference '09
Even Faster Web Sites at jQuery Conference '09
 

More from phanhung20

Graph for Coulomb damped oscillation
Graph for Coulomb damped oscillationGraph for Coulomb damped oscillation
Graph for Coulomb damped oscillationphanhung20
 
Search videos with youtube api3
Search videos with youtube api3Search videos with youtube api3
Search videos with youtube api3phanhung20
 
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 (19)

Graph for Coulomb damped oscillation
Graph for Coulomb damped oscillationGraph for Coulomb damped oscillation
Graph for Coulomb damped oscillation
 
Search videos with youtube api3
Search videos with youtube api3Search videos with youtube api3
Search videos with youtube api3
 
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

Q4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxQ4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxeditsforyah
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)Christopher H Felton
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作ys8omjxb
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一Fs
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhimiss dipika
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Sonam Pathan
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxDyna Gilbert
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Excelmac1
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predieusebiomeyer
 
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书rnrncn29
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa494f574xmv
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012rehmti665
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Paul Calvano
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationLinaWolf1
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一z xss
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书rnrncn29
 
Elevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New OrleansElevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New Orleanscorenetworkseo
 

Recently uploaded (20)

Q4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxQ4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptx
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhi
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptx
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predi
 
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
 
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 Documentation
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
 
Elevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New OrleansElevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New Orleans
 

Find YouTube Videos Using API

  • 1. HOW TO SEARCH YOUTUBE VIDEOS USING API 3 I would like to share with you my 2 web pages: 1- demo-search.html With it you can find 210, 300 or 510 youtube video clips, by only one mouse click. Because it is a demo (testing) web, the source code is strongly simplified. In the result you can read only one clip from 300 or 510 that ware found and stored in PC memory (as elements of two arrays). Select all the content you see, copy it, open a new file in your program "Notepad", paste it there and save it as js file (javascript file). To play clips in this javascritpt file you can you my page: http://play-videos.url.ph/v3/search2.html Just click the button "browser" and choose this js file (from your PC). 2-simple-search.html 1
  • 2. This web also can find 300 or 510 clips. But all found clips are shown as links (anchor tags). If you click on any link, all clips will be played continuously, one after another. In the following you wll see The source code of "demo-search.html" and "simple-search.html 2
  • 3. Page:1/2pdf-simplest-search.html Last modification: 9/14/2015 5:08:34 PMH:xampphtdocshoc-book-Vikram-timv3aready-2-goog-slideshow <!DOCTYPE> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>api3 search</title> <style> body{ font-family:Arial; font-size:10pt; } </style> </head> <body> <div align="center"> <br> <div id="menu" style="background-color:#99CCFF;padding:4px;width:100%"> <b>All Found:&nbsp;<span id="allSpan" style="font-size:12pt;font-style: italic">0</span></b> &nbsp; <b><i>Search Text:</i></b>&nbsp;<input type="text" value="Folli Michelangelo" id="searchtext1" size="66" style="border-style:inset">&nbsp; <button type="button" onclick="start(30)">S30</button> <button type="button" onclick="start(210)">S210</button> <button type="button" onclick="start(300)">S300</button> <button type="button" onclick="start(510)">S510</button> </div> <br> <b><i>Search Text may be:</i></b>&nbsp;Abba, Folli Michelangelo, Franck Pourcel, Paul Mauriat, Richard Clayderman, Romantic Guitar ... <br> <b><i>Or the exact youtube username:</i></b>&nbsp; Tatiana Blue, Expoza travel,pvhung20 ... <br> <br> <div id="div1" style= "width:75%;height:420px;text-align:left;padding:15px;overflow:auto;border:gray solid 1px;"> vst += "";<br><br> </div> <br> <br> </div> <!-- center --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script src="https://apis.google.com/js/client.js?onload=onClientLoad" type="text/javascript"> </script> <script> tit = []; vid = []; var nextPageToken; portion = 30; // portion to be <= 50 var searchText = ""; var maxRes = portion; var want = 210; sum = 0; sumN = 0; function start(num){ PSPad editor 4.5.7 (2450) www.pspad.com 9/14/2015 5:11:22 PM Administrator
  • 4. Page:2/2pdf-simplest-search.html Last modification: 9/14/2015 5:08:34 PMH:xampphtdocshoc-book-Vikram-timv3aready-2-goog-slideshow want = num; gapi.client.load('youtube', 'v3', onApiLoad); } function onApiLoad(){ gapi.client.setApiKey('Abc*********************************123'); // Replace it with your API key and run this web with XAMPP (on PC) // OR upload it to your hosting web then run it searchVid(); } function searchVid(PageToken){ searchText= $('#searchtext1').val(); var request = gapi.client.youtube.search.list({ part: 'snippet', q:searchText, maxResults:maxRes, pageToken:PageToken }); request.execute(myPlan); } function myPlan(response){ nextPageToken=response.nextPageToken; var resultCount = response.pageInfo.totalResults; if(want >= resultCount){ want = resultCount} 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); document.getElementById('allSpan').innerHTML = sumN + ''; sum++ ; sumN++ ; if((sum == want)||(sum == resultCount)){ document.getElementById('allSpan').innerHTML = '<span style="color:red">'+ sumN + '</span>'; len = vid.length; st = '// Searching '+ searchText + '<br>'; st += '// ' + sum + ' videos found. Among them:<br>'+ 'vst += "' + tit[len-1] + '"+<br>"' + vid[len-1] + '@";<br><br>'; document.getElementById('div1').innerHTML += st; sum = 0; return; } } } x = want - sum; if(x >= portion){ maxRes = portion; }else{ maxRes = x; } searchVid(nextPageToken); } </script> </body></html> PSPad editor 4.5.7 (2450) www.pspad.com 9/14/2015 5:11:22 PM Administrator
  • 5. Page:1/4pdf-simple-search.html H:xampphtdocshoc-book-Vikram-timv3a Last modification: 9/14/2015 2:57:32 PM <!DOCTYPE> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>api3 search</title> <style> body{ background-color:#CCCCCC; 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:812px;height:25px;color:white;background-color:#1B1B1B; margin-top:-2px;overflow:hidden; padding-top:10px; } </style> </head> <body> <div align="center"> <div id='player'></div> <div id="vtitle"></div> <br> <div id="menu" style="background-color:#6699CC;padding:4px;width:100%"> <table ><tr style="font-size:10pt;"> <td style="background-color:#EEEEEE" style="border:1px gray solid"> <b>All:&nbsp; <span id="allSpan" style="font-size:12pt;font-style: italic">0</span></b> &nbsp; <b><i>Found:</i>&nbsp; <span id="foundSpan" style="font-size:12pt;font-style: italic;color:green">0 </span>&nbsp;</td></b> <td style="border:1px gray solid;vertical-align:middle">&nbsp; <b><i>Search Text:</i></b>&nbsp;<input type="text" value="Folli Michelangelo" id="searchtext1" size="72" style="border-style:inset">&nbsp; <button type="button" onclick="start(30)">S30</button> <button type="button" onclick="start(210)">S210</button> <button type="button" onclick="start(300)">S300</button> <button type="button" onclick="start(510)">S510</button> </td> PSPad editor 4.5.7 (2450) www.pspad.com Administrator9/14/2015 2:59:10 PM
  • 6. Page:2/4pdf-simple-search.html H:xampphtdocshoc-book-Vikram-timv3a Last modification: 9/14/2015 2:57:32 PM </tr></table> </div> <br> <b><i>Search Text may be:</i></b>&nbsp; Abba, Folli Michelangelo, Paul Mauriat, Richard Clayderman, Romantic Guitar ... <br><br> <b>Search Results</b>&nbsp;&nbsp; <button onclick="clearContent('r1')">Clear This Table</button> <br><br> <div id="list1" style="width:750px;;height:300px;overflow:auto;background-color:white;text-align:left"> <table id="tableA" width="100%"><tbody id="r1"> </tbody></table> </div> <br><br> </div> <!-- center --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script src="https://apis.google.com/js/client.js?onload=onClientLoad" type="text/javascript"> </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 = 210; sum = 0; sumN = 0; function start(num){ want = num; gapi.client.load('youtube', 'v3', onApiLoad); } function onApiLoad(){ gapi.client.setApiKey('Abc**********************************123'); // Replace it with your API key and run this web with XAMPP (on PC) // OR upload it to your hosting web then run it searchVid(); } function searchVid(PageToken){ var searchText= $('#searchtext1').val(); var request = gapi.client.youtube.search.list({ part: 'snippet', q:searchText, maxResults:maxRes, pageToken:PageToken }); request.execute(myPlan); } function myPlan(response){ nextPageToken=response.nextPageToken; var resultCount = response.pageInfo.totalResults; stList = ''; if(want >= resultCount){ want = resultCount} for (var i=0; i<response.items.length;i++){ PSPad editor 4.5.7 (2450) www.pspad.com Administrator9/14/2015 2:59:10 PM
  • 7. Page:3/4pdf-simple-search.html H:xampphtdocshoc-book-Vikram-timv3a Last modification: 9/14/2015 2:57:32 PM 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><b>'+ (sumN+1) +'</b>&nbsp;<a href="#" '+ 'onclick="playVid('+sumN +', this); return false">'+ titSt +'</a></td></tr>'; stList += ss; document.getElementById('foundSpan').innerHTML = '<span style="color:green"><b>'+sum+'</b></span>'; document.getElementById('allSpan').innerHTML = sumN + ''; sum++ ; sumN++ ; if((sum == want)||(sum == resultCount)){ document.getElementById('foundSpan').innerHTML = '<span style="color:red"><b>'+sum+'</b></span>'; document.getElementById('allSpan').innerHTML = '<span style="color:#6600FF">'+ sumN + '</span>'; document.getElementById('r1').innerHTML += stList; sum = 0; // want = 120; len = vid.length; last = len - 1; return; } } } document.getElementById('r1').innerHTML += stList; x = want - sum; if(x >= portion){ maxRes = portion; }else{ maxRes = x; } searchVid(nextPageToken); } /////////////// PLAY VIDEOS CONTINUOUSLY /////////////// normalW = '812'; normalH = '516' var player; startvid = vid[0]; var jj = 0; var tag = document.createElement('script'); tag.src = "http://www.youtube.com/player_api"; 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, PSPad editor 4.5.7 (2450) www.pspad.com Administrator9/14/2015 2:59:10 PM
  • 8. Page:4/4pdf-simple-search.html H:xampphtdocshoc-book-Vikram-timv3a Last modification: 9/14/2015 2:57:32 PM '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; last = len-1; if(jj <= last){jj=jj+1}; if (jj > last){jj=0}; playVid(jj); } function showTit(k){ document.getElementById("vtitle").innerHTML = (k+1) + '/'+ vid.length + ' : ' + tit[k]; } 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 = []; jj = 0; document.getElementById('foundSpan').innerHTML = '<span style="color:green"><b>'+'0'+'</b></span>'; document.getElementById('allSpan').innerHTML = '<b>0</b>'; } } </script> </body></html> PSPad editor 4.5.7 (2450) www.pspad.com Administrator9/14/2015 2:59:10 PM