-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
101 lines (85 loc) · 3.77 KB
/
index.html
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
101
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href='https://fonts.googleapis.com/css?family=Audiowide' rel='stylesheet'>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="odometer-style.css">
<title>Windah Basudara Subs Count</title>
</head>
<body>
<img class="pfp"></img>
<p class="youtuber-name">undefined</p>
<h1>Current Subs</h1>
<div class="subs-odometer" id="subs-odometer">0</div>
<script src="odometer.min.js"></script>
<script>
const subsOdometer = document.querySelector(".subs-odometer");
const ProfilePicture = document.querySelector(".pfp");
const youtuberName = document.querySelector(".youtuber-name");
//your youtube channel id
const YoutubeChannel = "UCoIiiHof6BJ85PLuLkuxuhw"
//your Youtube API V3 Token
const YoutubeAPIToken = "AIzaSyAS-12hHIYWkaDV9fZ0uY9fsJMRgIFQSBM"
//Time Delay in seconds
const delay = 4000
const useID = true
const odometer = new Odometer({
el: subsOdometer,
})
let getChannel = () => {
if (useID == true) {
fetch(`https://www.googleapis.com/youtube/v3/channels?part=statistics&id=${YoutubeChannel}&key=${YoutubeAPIToken}`)
.then(response => {
return response.json()
})
.then(data => {
const subsData = data["items"][0].statistics.subscriberCount
setTimeout(function () { subsOdometer.innerHTML = subsData })
})
} else {
fetch(`https://www.googleapis.com/youtube/v3/channels?part=statistics&q=${YoutubeChannel}&key=${YoutubeAPIToken}`)
.then(response => {
return response.json()
})
.then(data => {
const subsData = data["items"][0].statistics.subscriberCount
setTimeout(function () { subsOdometer.innerHTML = subsData })
})
}
}
let getChannelData = () => {
if (useID == true) {
fetch(`https://www.googleapis.com/youtube/v3/channels?part=snippet&id=${YoutubeChannel}&key=${YoutubeAPIToken}`)
.then(response => {
return response.json()
})
.then(data => {
const channelName = data["items"][0].snippet.title
const profileData = data["items"][0].snippet.thumbnails.high.url
ProfilePicture.src = profileData
youtuberName.innerHTML = channelName
})
} else {
fetch(`https://www.googleapis.com/youtube/v3/channels?part=snippet&q=${YoutubeChannel}&key=${YoutubeAPIToken}`)
.then(response => {
return response.json()
})
.then(data => {
const channelName = data["items"][0].snippet.title
const profileData = data["items"][0].snippet.thumbnails.high.url
ProfilePicture.src = profileData
youtuberName.innerHTML = channelName
})
}
}
setInterval(getChannel, delay);
setInterval(getChannelData, delay);
</script>
<footer>
<p> Made By WilloIzCitron </q>
</footer>
</body>
</html>