search 500-video-clips
TRANSCRIPT
HOW TO SEARCH MORE THAN 50 YOUTUBE VIDEO CLIPS
With this web page you can try to get 30, 210, 300 or 510 clips.
Here is the source code. To be easy to read, it is very compact, strongly simplified
Real web pages for searching and play videos continuously:
http://play-videos.url.ph/v3/simple-search.html
http://play-videos.url.ph/v3/search2.html
1
Page:1/2search-videos-test.htmlLast modification: 9/13/2015 11:05:46 PMH:\xampp\htdocs\hoc-book-Vikram-tim\v3a\
<!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: <span id="wantSpan" style="font-size:12pt;font-style: italic" >0</span></b> <b><i>Search Text: </i></b> <input type="text" value="Folli Michelangelo" id="searchtext1" size="66" style="border-style:inset" > <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> Abba, Folli Michelangelo, Franck Pourcel, Paul Ma uriat, Richard Clayderman, Romantic Guitar ... <br> <b><i>Or the exact youtube username: </i></b> Tatiana Blue, Expoza travel,pvhung20 ... <br> <br> <div id="div1" style="width:75%; height:420px; padding:15px;overflow:aut o;border:gray solid 1px;text-align:left" > </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?o nload=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/13/2015 11:06:20 PM Administrator
Page:2/2search-videos-test.htmlLast modification: 9/13/2015 11:05:46 PMH:\xampp\htdocs\hoc-book-Vikram-tim\v3a\
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 ( 'wantSpan' ) . innerHTML = sumN + '' ; sum++ ; sumN++ ; if( ( sum == want ) || ( sum == resultCount ) ) { document . getElementById ( 'wantSpan' ) . innerHTML = '<span style="color:red">' + sumN + '</span>' ; len = vid . length ; st = '<b>Searching ' + searchText + '</b><br>' ; st += sum + ' videos found. The last is:<br>' + tit [ len - 1] + '<br>ID: ' + vid [ len - 1] + '<br><hr>' ; 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/13/2015 11:06:20 PM Administrator