America.html
894 Bytes
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
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<html>
<body>
<div><h1>미국 음식</h1></div>
<script src="https://code.jquery.com/jquery-3.0.0.js"></script>
<script type="text/javascript">
let apikey = "AIzaSyC1UDfc18D0ebNPMRjC6LW9vzTZZEXlJak";
let keyword ="미국 음식";
$.ajax({
url:'https://www.googleapis.com/youtube/v3/search',
type:'get',
dataType:'json',
data:{part:'snippet',key:apikey,q:keyword, maxResults:50,type:'video',videoEmbeddable:'true'},
success:function (data){
console.log(data);
data.items.forEach(function(element,index){$('body').append('<iframe width="560" height="315" src="https://www.youtube.com/embed/'+element.id.videoId+' " frameborder="0" allow="accelerometer; autoplay;clipboard-write;encrypted-media;gyroscope;picture-in-picture" allowfullscreen></ifreame>');});
},
complete:function(data){},
error:function(xhr,status,error){}
});
</script>
</body>
</html>