-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
32 lines (27 loc) · 1.05 KB
/
script.js
File metadata and controls
32 lines (27 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$(document).ready(function(){
var API_KEY = "AIzaSyBpIgocvh7ibNAbC0i8D1-K2Zhuj9TyjfU"
var video = ''
$("#form").submit(function(event){
event.preventDefault()
var search = $("#search").val()
videoSearch(API_KEY, search, 10)
})
function videoSearch(key, search, maxResults){
$.get("https://www.googleapis.com/youtube/v3/search?key="+ key
+ "&type=video&part=snippet&maxResults=" + maxResults + "&q=" + search + "karaoke", function(data){
console.log(data)
data.items.forEach(item => {
video = `
<li>
<a href="https://cutormj.github.io/youtubekaraoke/Node.js?songId=${item.id.videoId}">
${item.snippet.title}
</a>
</li>
`
$("#videos").append(video)
});
})
}
})
//https://cutormj.github.io/youtubekaraoke/service.html?songId=${item.id.videoId}
//onclick="send('${item.id.videoId}')