javascript - Generate a url for youtube search -
how can use javascript or php generate url youtube, searches videos on specific user account best title match on top?
i using code:
<!doctype html> <head> <meta charset="utf-8" /> </head> <script type="text/javascript"> function mysearch() { var elem=document.getelementbyid('inputsearchquery'); var url="http://www.youtube.com/user/queenvevo/videos?query="+encodeuricomponent(elem.value); var win=window.open(url, '_blank'); win.focus(); } </script> <body> <h2>enter search string (user: queen)</h2> <input id="inputsearchquery" type="text" value="the show must go on"> <button type="button" onclick="mysearch()">search</button> </body>
the problem youtube not place best title match @ top! video "the show must go on" on 13th place, , expected on top?
can tell me how change url youtube places best title match on top? or have use youtube api task?
i'm not sure if understand problem use search get.
like http://www.youtube.com/results?search_query=the+show+must+go+on&oq=the+show+must+go+on
the "search_query" part come user website. you'd have parse get-syntax , send youtube. source of results , search string using regex , maybe high view counts or that.
but believe learning youtube api save more time , work!
Comments
Post a Comment