mirror of
https://github.com/Xameren/YouTubeStatTracker.git
synced 2025-04-20 01:56:09 +02:00
320 lines
9.9 KiB
HTML
320 lines
9.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>YT Checker</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
background-color: #00151a;
|
|
color: white;
|
|
text-align: center;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
.container {
|
|
max-width: 90%;
|
|
margin: 20px auto;
|
|
padding: 20px;
|
|
background-color: rgba(1,46,46,.45);
|
|
border-radius: 10px;
|
|
box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
|
|
box-sizing: border-box;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.box.mainStats {
|
|
max-width: 100%;
|
|
overflow: hidden;
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 10px;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
|
|
input[type="text"] {
|
|
background-color: rgba(1,46,46,.65);
|
|
color: white;
|
|
width: 80%;
|
|
padding: 10px;
|
|
border: none;
|
|
border-radius: 5px;
|
|
font-size: 16px;
|
|
}
|
|
.submitt {
|
|
padding: 10px 15px;
|
|
background-color: rgb(0, 58, 78);
|
|
color: white;
|
|
border: none;
|
|
border-radius: 5px;
|
|
cursor: pointer;
|
|
font-size: 16px;
|
|
}
|
|
.stats, .videos {
|
|
margin-top: 20px;
|
|
text-align: left;
|
|
}
|
|
.video-item {
|
|
padding: 10px;
|
|
border-bottom: 1px solid #444;
|
|
}
|
|
.box {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 10px;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
.image-container img {
|
|
max-width: 100%;
|
|
border-radius: 8px;
|
|
margin-left: 3%;
|
|
border-radius: 20%;
|
|
}
|
|
.mostpopularvideo {
|
|
border-radius: 5%;
|
|
|
|
}
|
|
.mainStats p {
|
|
background-color: rgba(1,46,46,.65);
|
|
border:solid;
|
|
border-color: #00000000;
|
|
border-radius: 20px;
|
|
max-width: 30%;
|
|
text-align: center;
|
|
margin: 20px;
|
|
margin-top: 10px;
|
|
padding: 20px;
|
|
padding-top: 30px;
|
|
padding-bottom: 20px;
|
|
margin-left: 0%;
|
|
text-wrap-mode: nowrap;
|
|
min-width: 160px;
|
|
}
|
|
.mainStats span{
|
|
font-size: 24px;
|
|
text-align: center;
|
|
text-wrap-mode: wrap;
|
|
margin-bottom: 10px;
|
|
line-height: 45px;
|
|
}
|
|
.description, .video-container {
|
|
background-color: rgba(1,46,46,.65); /* */
|
|
border-radius: 20px;
|
|
padding: 20px;
|
|
text-align: center;
|
|
}
|
|
.description {
|
|
text-align: center; margin-left: -20%; margin-right: 10%; height: 230px; padding-top: 20px; overflow: auto;
|
|
}
|
|
.mostpopularvideo {
|
|
background-size: cover;
|
|
background-position: center;
|
|
width: 320px;
|
|
height: 180px;
|
|
background-position: center center;
|
|
display: flex;
|
|
margin: auto;
|
|
}
|
|
canvas {
|
|
max-height: 250px;
|
|
border-radius: 10px;
|
|
background-color: rgba(1,46,46,.45);
|
|
padding: 10px;
|
|
margin-bottom: 10px;
|
|
width: fit-content;
|
|
}
|
|
@media (max-width: 810px) {
|
|
.description {
|
|
text-align: center; margin-left: 0%; margin-right: 0%; height: 230px; padding-top: 20px; overflow: auto;
|
|
}
|
|
.image-container {
|
|
max-width: 100%;
|
|
border-radius: 8px;
|
|
margin: auto;
|
|
}
|
|
}
|
|
table {
|
|
position:absolute;
|
|
bottom: 0;
|
|
left: 40px;
|
|
}
|
|
td img {
|
|
width: 40px;
|
|
height: 40px;
|
|
padding-right: 10px;
|
|
padding-left: 10px;
|
|
}
|
|
td {
|
|
text-align: center;
|
|
vertical-align: middle;
|
|
padding-right: 10px;
|
|
padding-left: 10px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>Xameren's YouTube Stats Tracker</h1>
|
|
<form action="/submit" method="post">
|
|
<input type="text" id="channelInput" placeholder="Enter Channel ID..." name="username">
|
|
<input type="submit" placeholder="search" class="submitt">
|
|
</form>
|
|
<div class="stats" id="statsSection">
|
|
<h2 style="text-align: center;">Showing stats for channel {{Channel_title}}</h2>
|
|
<h5 style="text-align: center; margin-top: -1%; color: #6e6e6e;">
|
|
<i>Custom URL: {{ channel_custom_URL }}</i>
|
|
</h5>
|
|
<div class="box mainStats" style="margin-right: -5%;">
|
|
<p><strong>Created On</strong> <br> <span id="channelCreation"> {{channel_creation_date}} </span></p>
|
|
<p><strong>Subscribers</strong> <br> <span id="subscribers">{{subscriber_count}}</span></p>
|
|
<p><strong>Views/video</strong> <br> <span id="videos"> {{viewspervideo}} </span></p>
|
|
<p><strong>Views</strong> <br> <span id="views">{{ view_count }}</span></p>
|
|
<p style="margin-right: -10%;"><strong>Videos</strong> <br> <span id="videos">{{ video_count }}</span></p>
|
|
</div>
|
|
|
|
<div class="box" style="grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); align-items: center;">
|
|
<div class="image-container">
|
|
<img src="{{channel_profile_picture}}" alt="Placeholder Image" id="channelImage">
|
|
</div>
|
|
<p class="description"><strong style="font-size: 28px;">Description</strong><br><br><span id="channelDescription" style="white-space: pre-line;"> {{ channel_description }} </span></p>
|
|
<div class="video-container">
|
|
<h2 style="margin-top: 10px;">{{Channel_title}}'s recent video</h2>
|
|
<div class="mostpopularvideo" id = "mostpopularvideo" style="position: relative">
|
|
<table>
|
|
<tr>
|
|
<td><img src="{{ url_for('static', filename='assets/img/view.png') }}"></td>
|
|
<td><img src="{{ url_for('static', filename='assets/img/likes.png') }}"></td>
|
|
<td><img src="{{ url_for('static', filename='assets/img/comment.png') }}"></td>
|
|
</tr>
|
|
<tr>
|
|
<td>{{recent_video_views}}</td>
|
|
<td>{{recent_video_likes}}</td>
|
|
<td>{{recent_video_comments}}</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="history" id="historySection">
|
|
<h2>History</h2>
|
|
<div id="history">
|
|
<div>
|
|
<canvas id="chartSubscribers"></canvas>
|
|
<canvas id="chartViews"></canvas>
|
|
</div>
|
|
</div>
|
|
<br>
|
|
</div>
|
|
</div>
|
|
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
<script>
|
|
async function fetchChartData() {
|
|
let response = await fetch('/chart-data');
|
|
let data = await response.json();
|
|
|
|
const ctx = document.getElementById('chartSubscribers');
|
|
new Chart(ctx, {
|
|
type: 'line',
|
|
data: {
|
|
labels: data.labels_date,
|
|
datasets: [{
|
|
label: 'Subscribers',
|
|
data: data.data_subscribers,
|
|
borderWidth: 1
|
|
}]
|
|
},
|
|
options: {
|
|
plugins: {
|
|
legend: {
|
|
labels: {
|
|
color: 'white'
|
|
}
|
|
}
|
|
},
|
|
scales: {
|
|
x: {
|
|
ticks: {
|
|
color: 'white'
|
|
},
|
|
title: {
|
|
color: 'white'
|
|
}
|
|
},
|
|
y: {
|
|
ticks: {
|
|
color: 'white'
|
|
},
|
|
title: {
|
|
color: 'white'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
const ctx2 = document.getElementById('chartViews');
|
|
new Chart(ctx2, {
|
|
type: 'line',
|
|
data: {
|
|
labels: data.labels_date,
|
|
datasets: [{
|
|
label: 'Views',
|
|
data: data.data_views,
|
|
borderWidth: 1
|
|
}]
|
|
},
|
|
options: {
|
|
plugins: {
|
|
legend: {
|
|
labels: {
|
|
color: 'white'
|
|
}
|
|
}
|
|
},
|
|
scales: {
|
|
x: {
|
|
ticks: {
|
|
color: 'white'
|
|
},
|
|
title: {
|
|
color: 'white'
|
|
}
|
|
},
|
|
y: {
|
|
ticks: {
|
|
color: 'white'
|
|
},
|
|
title: {
|
|
color: 'white'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
document.addEventListener("DOMContentLoaded", fetchChartData);
|
|
</script>
|
|
<script>
|
|
async function updateBackground() {
|
|
let response = await fetch('/get_recent_video_thumbnail');
|
|
let data = await response.json();
|
|
let container = document.getElementById('mostpopularvideo');
|
|
|
|
if (container) {
|
|
container.style.backgroundImage =
|
|
`linear-gradient(rgba(0, 0, 0, 0), rgb(0, 0, 0)), url('${data.thumbnail_url}')`;
|
|
}
|
|
}
|
|
|
|
// Ensure JavaScript runs after the HTML has loaded
|
|
document.addEventListener("DOMContentLoaded", () => {
|
|
updateBackground()
|
|
});
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|