Is there a way to generate a YouTube URL using JavaScript or PHP that searches for videos on a specific user account and displays the best title match at the top of the search results?
This is the code I am currently using:
<!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 issue I'm facing is that the best title match is not displayed at the top of the search results on YouTube. For example, the video "The show must go on" is ranked 13th instead of being at the top.
Does anyone know how to modify the URL so that YouTube shows the best title match at the top? Or is it necessary to use the YouTube API for this functionality?