Last active
August 10, 2017 18:27
-
-
Save dimaslanjaka/c9c5a17deb9b60f4fb4f73f0f16f8320 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
function getQueryVariable(variable) { | |
var query = window.location.search.substring(1); | |
var vars = query.split("&"); | |
for (var i=0;i<vars.length;i++) { | |
var pair = vars[i].split("="); | |
if(pair[0] == variable){return pair[1];} | |
} | |
return(false); | |
} | |
var queries = getQueryVariable("q"); | |
var yturl = "https://www.googleapis.com/youtube/v3/search?q="+queries+"&part=snippet&maxResults=1&key=AIzaSyAx6gnU8v7jQDi6ZFg_ERCtJRJUIC9VuoQ"; | |
$.getJSON(yturl, function(data) { | |
//alert(data.query.lang); | |
document.write('<iframe src="https://www.youtube.com/embed/'+data.items[0].id.videoId+'?autoplay=1&fs=1&iv_load_policy=1&showinfo=1&rel=1&cc_load_policy=1&start=0&end=0&vq=large&origin=https://webmanajemen.xyz"></iframe>'); | |
}) | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment