-
Notifications
You must be signed in to change notification settings - Fork 0
/
my.js
104 lines (53 loc) · 2.07 KB
/
my.js
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
document.getElementById("searchbtn").addEventListener("click",show)
async function show (){
let API_KEYS =["AIzaSyASPLAWmjCPDRoiMtt1AHGQ0TGyRx9wTRU","AIzaSyASPLAWmjCPDRoiMtt1AHGQ0TGyRx9wTRU","AIzaSyBihnXKUmx9h6DHAlTNkrZ-6znzrz3ME1M","AIzaSyA8HVQEsyROLmeZ4P3GhKRCU2BajTnJUNc","AIzaSyAgE8JOY06kJSUxBYYXCGKhQnhx1qD8jdA"]
let num= Math.floor(Math.random()*3)
let API_KEY = API_KEYS[num]
let search=document.getElementById("videoname").value
let data = await fetch(`https://youtube.googleapis.com/youtube/v3/search?part=snippet&maxResults=50&q=${search}&key=${API_KEY}`)
data = await data.json()
console.log(data)
}
https://www.googleapis.com/youtube/v3/channels?&
const ghy = async (data)=> {
}
// empty()
// function empty(){
// let api_key="AIzaSyCGz_8bE32q4NAkjdAXjpAiigBS6z9ZASU";
// let channel_http="https://www.googleapis.com/youtube/v3/channels?&"
// async function empty(){
// let contebt= await fetch(`https://www.googleapis.com/youtube/v3/videos?&key=${api_key}&part=snippet&chart=mostPopular&maxResults=50®ionCode=IN`)
// let d= await contebt.json()
// console.log(d)
// // getChannelIcon(d.items)
// }
// // const getChannelIcon = (video_data) => {
// // fetch(channel_http + new URLSearchParams({
// // key: api_key,
// // part: "snippet",
// // id: video_data.snippet.channelId
// // }))
// // .then(res => res.json())
// // .then(data => {
// // video_data.channelThumbnail = data.items[0].snippet.thumbnails.default.url
// // videosicon(video_data)
// // })
// // }
// // }
// const videosicon = (data) => {
// for(let el of data){
// let child=document.createElement("div")
// child.className="video"
// child.innerHTML=`
// <img src="${el.snippet.thumbnails.high.url}" class="thumbnail" alt="">
// <div class="content">
// <img src="${el.channelThumbnail}" class="channel-icon" alt="">
// <div class="info">
// <h4 class="title">${el.snippet.title}</h4>
// <p class="channel-name">${el.snippet.channelTitle}</p>
// </div>
// </div>
// `
// parent.append(child)
// }
// }