Spaces:
Running
Running
i want to do it on my provided videos link - Initial Deployment
Browse files- README.md +7 -5
- index.html +667 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: yt
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: yellow
|
| 5 |
+
colorTo: red
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,667 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Advanced YouTube Watch Time Monitor</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
.progress-bar {
|
| 11 |
+
height: 8px;
|
| 12 |
+
border-radius: 4px;
|
| 13 |
+
background-color: #e5e7eb;
|
| 14 |
+
overflow: hidden;
|
| 15 |
+
}
|
| 16 |
+
.progress-fill {
|
| 17 |
+
height: 100%;
|
| 18 |
+
border-radius: 4px;
|
| 19 |
+
background: linear-gradient(90deg, #3b82f6, #8b5cf6);
|
| 20 |
+
transition: width 0.3s ease;
|
| 21 |
+
}
|
| 22 |
+
.glow {
|
| 23 |
+
box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
|
| 24 |
+
}
|
| 25 |
+
.device-card {
|
| 26 |
+
transition: all 0.3s ease;
|
| 27 |
+
}
|
| 28 |
+
.device-card:hover {
|
| 29 |
+
transform: translateY(-5px);
|
| 30 |
+
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
|
| 31 |
+
}
|
| 32 |
+
.user-agent-badge {
|
| 33 |
+
font-family: 'Courier New', monospace;
|
| 34 |
+
font-size: 0.75rem;
|
| 35 |
+
}
|
| 36 |
+
.analytics-chart {
|
| 37 |
+
height: 300px;
|
| 38 |
+
background-color: #f8fafc;
|
| 39 |
+
border-radius: 0.5rem;
|
| 40 |
+
position: relative;
|
| 41 |
+
}
|
| 42 |
+
.chart-line {
|
| 43 |
+
position: absolute;
|
| 44 |
+
bottom: 0;
|
| 45 |
+
left: 0;
|
| 46 |
+
width: 100%;
|
| 47 |
+
height: 2px;
|
| 48 |
+
background-color: #e2e8f0;
|
| 49 |
+
}
|
| 50 |
+
.chart-bar {
|
| 51 |
+
position: absolute;
|
| 52 |
+
bottom: 0;
|
| 53 |
+
width: 30px;
|
| 54 |
+
background: linear-gradient(to top, #3b82f6, #8b5cf6);
|
| 55 |
+
border-radius: 4px 4px 0 0;
|
| 56 |
+
transition: height 0.5s ease;
|
| 57 |
+
}
|
| 58 |
+
@keyframes pulse {
|
| 59 |
+
0%, 100% {
|
| 60 |
+
opacity: 1;
|
| 61 |
+
}
|
| 62 |
+
50% {
|
| 63 |
+
opacity: 0.5;
|
| 64 |
+
}
|
| 65 |
+
}
|
| 66 |
+
.pulse {
|
| 67 |
+
animation: pulse 2s infinite;
|
| 68 |
+
}
|
| 69 |
+
</style>
|
| 70 |
+
</head>
|
| 71 |
+
<body class="bg-gray-50 text-gray-800">
|
| 72 |
+
<div class="container mx-auto px-4 py-8">
|
| 73 |
+
<!-- Header -->
|
| 74 |
+
<header class="mb-8">
|
| 75 |
+
<h1 class="text-3xl font-bold text-gray-900 mb-2">YouTube Watch Time Monitor</h1>
|
| 76 |
+
<p class="text-gray-600">Advanced analytics dashboard for tracking watch hours with detailed session data</p>
|
| 77 |
+
</header>
|
| 78 |
+
|
| 79 |
+
<!-- Main Dashboard -->
|
| 80 |
+
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6 mb-8">
|
| 81 |
+
<!-- Video Player Section -->
|
| 82 |
+
<div class="lg:col-span-2 bg-white rounded-xl shadow-md overflow-hidden">
|
| 83 |
+
<div class="p-4 border-b border-gray-200">
|
| 84 |
+
<h2 class="text-xl font-semibold">Video Monitoring</h2>
|
| 85 |
+
</div>
|
| 86 |
+
<div class="p-4">
|
| 87 |
+
<div class="aspect-w-16 aspect-h-9 bg-black rounded-lg overflow-hidden mb-4">
|
| 88 |
+
<iframe id="yt-player" class="w-full h-96" src="https://www.youtube.com/embed/dQw4w9WgXcQ?enablejsapi=1&autoplay=1&mute=1" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
| 89 |
+
</div>
|
| 90 |
+
<div class="flex items-center justify-between mb-4">
|
| 91 |
+
<div>
|
| 92 |
+
<h3 class="font-medium">Never Gonna Give You Up</h3>
|
| 93 |
+
<p class="text-sm text-gray-500">Rick Astley • 1.3B views</p>
|
| 94 |
+
</div>
|
| 95 |
+
<button id="change-video" class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition">Change Video</button>
|
| 96 |
+
</div>
|
| 97 |
+
</div>
|
| 98 |
+
</div>
|
| 99 |
+
|
| 100 |
+
<!-- Stats Overview -->
|
| 101 |
+
<div class="bg-white rounded-xl shadow-md overflow-hidden">
|
| 102 |
+
<div class="p-4 border-b border-gray-200">
|
| 103 |
+
<h2 class="text-xl font-semibold">Watch Time Analytics</h2>
|
| 104 |
+
</div>
|
| 105 |
+
<div class="p-4 space-y-6">
|
| 106 |
+
<div>
|
| 107 |
+
<div class="flex justify-between mb-2">
|
| 108 |
+
<span class="text-sm font-medium">Total Watch Hours</span>
|
| 109 |
+
<span id="total-hours" class="text-sm font-bold">0.00</span>
|
| 110 |
+
</div>
|
| 111 |
+
<div class="progress-bar">
|
| 112 |
+
<div id="hours-progress" class="progress-fill" style="width: 0%"></div>
|
| 113 |
+
</div>
|
| 114 |
+
<p class="text-xs text-gray-500 mt-1">Target: 4,000 hours (for monetization)</p>
|
| 115 |
+
</div>
|
| 116 |
+
|
| 117 |
+
<div class="grid grid-cols-2 gap-4">
|
| 118 |
+
<div class="bg-gray-50 p-3 rounded-lg">
|
| 119 |
+
<p class="text-xs text-gray-500 mb-1">Today</p>
|
| 120 |
+
<p id="today-hours" class="text-xl font-bold">0.00</p>
|
| 121 |
+
<p class="text-xs text-green-600">+0% from yesterday</p>
|
| 122 |
+
</div>
|
| 123 |
+
<div class="bg-gray-50 p-3 rounded-lg">
|
| 124 |
+
<p class="text-xs text-gray-500 mb-1">This Week</p>
|
| 125 |
+
<p id="week-hours" class="text-xl font-bold">0.00</p>
|
| 126 |
+
<p class="text-xs text-green-600">+0% from last week</p>
|
| 127 |
+
</div>
|
| 128 |
+
</div>
|
| 129 |
+
|
| 130 |
+
<div>
|
| 131 |
+
<h4 class="text-sm font-medium mb-2">Traffic Sources</h4>
|
| 132 |
+
<div class="space-y-2">
|
| 133 |
+
<div class="flex items-center">
|
| 134 |
+
<div class="w-3 h-3 bg-blue-500 rounded-full mr-2"></div>
|
| 135 |
+
<span class="text-sm flex-1">Google Ads</span>
|
| 136 |
+
<span id="google-ads" class="text-sm font-medium">0%</span>
|
| 137 |
+
</div>
|
| 138 |
+
<div class="flex items-center">
|
| 139 |
+
<div class="w-3 h-3 bg-purple-500 rounded-full mr-2"></div>
|
| 140 |
+
<span class="text-sm flex-1">Organic Search</span>
|
| 141 |
+
<span id="organic-search" class="text-sm font-medium">0%</span>
|
| 142 |
+
</div>
|
| 143 |
+
<div class="flex items-center">
|
| 144 |
+
<div class="w-3 h-3 bg-green-500 rounded-full mr-2"></div>
|
| 145 |
+
<span class="text-sm flex-1">Direct</span>
|
| 146 |
+
<span id="direct" class="text-sm font-medium">0%</span>
|
| 147 |
+
</div>
|
| 148 |
+
<div class="flex items-center">
|
| 149 |
+
<div class="w-3 h-3 bg-yellow-500 rounded-full mr-2"></div>
|
| 150 |
+
<span class="text-sm flex-1">Social Media</span>
|
| 151 |
+
<span id="social" class="text-sm font-medium">0%</span>
|
| 152 |
+
</div>
|
| 153 |
+
</div>
|
| 154 |
+
</div>
|
| 155 |
+
</div>
|
| 156 |
+
</div>
|
| 157 |
+
</div>
|
| 158 |
+
|
| 159 |
+
<!-- Detailed Analytics -->
|
| 160 |
+
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-8">
|
| 161 |
+
<!-- Watch Time Chart -->
|
| 162 |
+
<div class="bg-white rounded-xl shadow-md overflow-hidden">
|
| 163 |
+
<div class="p-4 border-b border-gray-200">
|
| 164 |
+
<h2 class="text-xl font-semibold">Watch Time Distribution</h2>
|
| 165 |
+
</div>
|
| 166 |
+
<div class="p-4">
|
| 167 |
+
<div class="analytics-chart mb-4" id="watch-time-chart">
|
| 168 |
+
<div class="chart-line"></div>
|
| 169 |
+
<!-- Bars will be added dynamically -->
|
| 170 |
+
</div>
|
| 171 |
+
<div class="flex justify-between text-xs text-gray-500">
|
| 172 |
+
<span>Mon</span>
|
| 173 |
+
<span>Tue</span>
|
| 174 |
+
<span>Wed</span>
|
| 175 |
+
<span>Thu</span>
|
| 176 |
+
<span>Fri</span>
|
| 177 |
+
<span>Sat</span>
|
| 178 |
+
<span>Sun</span>
|
| 179 |
+
</div>
|
| 180 |
+
</div>
|
| 181 |
+
</div>
|
| 182 |
+
|
| 183 |
+
<!-- Device Distribution -->
|
| 184 |
+
<div class="bg-white rounded-xl shadow-md overflow-hidden">
|
| 185 |
+
<div class="p-4 border-b border-gray-200">
|
| 186 |
+
<h2 class="text-xl font-semibold">Device Distribution</h2>
|
| 187 |
+
</div>
|
| 188 |
+
<div class="p-4">
|
| 189 |
+
<div class="grid grid-cols-2 gap-4 mb-4">
|
| 190 |
+
<div class="device-card bg-gray-50 p-4 rounded-lg text-center">
|
| 191 |
+
<i class="fas fa-mobile-alt text-3xl text-blue-500 mb-2"></i>
|
| 192 |
+
<p class="font-medium">Mobile</p>
|
| 193 |
+
<p id="mobile-percent" class="text-2xl font-bold">0%</p>
|
| 194 |
+
</div>
|
| 195 |
+
<div class="device-card bg-gray-50 p-4 rounded-lg text-center">
|
| 196 |
+
<i class="fas fa-desktop text-3xl text-purple-500 mb-2"></i>
|
| 197 |
+
<p class="font-medium">Desktop</p>
|
| 198 |
+
<p id="desktop-percent" class="text-2xl font-bold">0%</p>
|
| 199 |
+
</div>
|
| 200 |
+
<div class="device-card bg-gray-50 p-4 rounded-lg text-center">
|
| 201 |
+
<i class="fas fa-tablet-alt text-3xl text-green-500 mb-2"></i>
|
| 202 |
+
<p class="font-medium">Tablet</p>
|
| 203 |
+
<p id="tablet-percent" class="text-2xl font-bold">0%</p>
|
| 204 |
+
</div>
|
| 205 |
+
<div class="device-card bg-gray-50 p-4 rounded-lg text-center">
|
| 206 |
+
<i class="fas fa-tv text-3xl text-yellow-500 mb-2"></i>
|
| 207 |
+
<p class="font-medium">TV</p>
|
| 208 |
+
<p id="tv-percent" class="text-2xl font-bold">0%</p>
|
| 209 |
+
</div>
|
| 210 |
+
</div>
|
| 211 |
+
</div>
|
| 212 |
+
</div>
|
| 213 |
+
</div>
|
| 214 |
+
|
| 215 |
+
<!-- Active Sessions -->
|
| 216 |
+
<div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
|
| 217 |
+
<div class="p-4 border-b border-gray-200 flex justify-between items-center">
|
| 218 |
+
<h2 class="text-xl font-semibold">Active Viewing Sessions</h2>
|
| 219 |
+
<div class="flex items-center">
|
| 220 |
+
<span class="text-sm text-gray-500 mr-2">Simulation Speed:</span>
|
| 221 |
+
<select id="simulation-speed" class="text-sm border rounded px-2 py-1">
|
| 222 |
+
<option value="1">1x</option>
|
| 223 |
+
<option value="2">2x</option>
|
| 224 |
+
<option value="5">5x</option>
|
| 225 |
+
<option value="10">10x</option>
|
| 226 |
+
</select>
|
| 227 |
+
</div>
|
| 228 |
+
</div>
|
| 229 |
+
<div class="p-4">
|
| 230 |
+
<div class="overflow-x-auto">
|
| 231 |
+
<table class="min-w-full divide-y divide-gray-200">
|
| 232 |
+
<thead class="bg-gray-50">
|
| 233 |
+
<tr>
|
| 234 |
+
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Time</th>
|
| 235 |
+
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Device</th>
|
| 236 |
+
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Location</th>
|
| 237 |
+
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">User Agent</th>
|
| 238 |
+
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Duration</th>
|
| 239 |
+
</tr>
|
| 240 |
+
</thead>
|
| 241 |
+
<tbody id="sessions-table" class="bg-white divide-y divide-gray-200">
|
| 242 |
+
<!-- Sessions will be added dynamically -->
|
| 243 |
+
</tbody>
|
| 244 |
+
</table>
|
| 245 |
+
</div>
|
| 246 |
+
<div class="mt-4 flex justify-center">
|
| 247 |
+
<button id="add-session" class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition flex items-center">
|
| 248 |
+
<i class="fas fa-plus mr-2"></i> Add Simulated Session
|
| 249 |
+
</button>
|
| 250 |
+
</div>
|
| 251 |
+
</div>
|
| 252 |
+
</div>
|
| 253 |
+
|
| 254 |
+
<!-- Real-time Stats -->
|
| 255 |
+
<div class="bg-white rounded-xl shadow-md overflow-hidden">
|
| 256 |
+
<div class="p-4 border-b border-gray-200">
|
| 257 |
+
<h2 class="text-xl font-semibold">Real-time Statistics</h2>
|
| 258 |
+
</div>
|
| 259 |
+
<div class="p-4 grid grid-cols-1 md:grid-cols-3 gap-4">
|
| 260 |
+
<div class="bg-blue-50 p-4 rounded-lg flex items-center">
|
| 261 |
+
<div class="bg-blue-100 p-3 rounded-full mr-4">
|
| 262 |
+
<i class="fas fa-users text-blue-600 text-xl"></i>
|
| 263 |
+
</div>
|
| 264 |
+
<div>
|
| 265 |
+
<p class="text-sm text-gray-600">Current Viewers</p>
|
| 266 |
+
<p id="current-viewers" class="text-2xl font-bold">0</p>
|
| 267 |
+
</div>
|
| 268 |
+
</div>
|
| 269 |
+
<div class="bg-purple-50 p-4 rounded-lg flex items-center">
|
| 270 |
+
<div class="bg-purple-100 p-3 rounded-full mr-4">
|
| 271 |
+
<i class="fas fa-clock text-purple-600 text-xl"></i>
|
| 272 |
+
</div>
|
| 273 |
+
<div>
|
| 274 |
+
<p class="text-sm text-gray-600">Avg. Watch Time</p>
|
| 275 |
+
<p id="avg-watch-time" class="text-2xl font-bold">0:00</p>
|
| 276 |
+
</div>
|
| 277 |
+
</div>
|
| 278 |
+
<div class="bg-green-50 p-4 rounded-lg flex items-center">
|
| 279 |
+
<div class="bg-green-100 p-3 rounded-full mr-4">
|
| 280 |
+
<i class="fas fa-percentage text-green-600 text-xl"></i>
|
| 281 |
+
</div>
|
| 282 |
+
<div>
|
| 283 |
+
<p class="text-sm text-gray-600">Retention Rate</p>
|
| 284 |
+
<p id="retention-rate" class="text-2xl font-bold">0%</p>
|
| 285 |
+
</div>
|
| 286 |
+
</div>
|
| 287 |
+
</div>
|
| 288 |
+
</div>
|
| 289 |
+
</div>
|
| 290 |
+
|
| 291 |
+
<script>
|
| 292 |
+
// Global variables
|
| 293 |
+
let totalWatchHours = 0;
|
| 294 |
+
let todayWatchHours = 0;
|
| 295 |
+
let weekWatchHours = 0;
|
| 296 |
+
let currentViewers = 0;
|
| 297 |
+
let simulationSpeed = 1;
|
| 298 |
+
let activeSessions = [];
|
| 299 |
+
let watchTimeData = [0, 0, 0, 0, 0, 0, 0];
|
| 300 |
+
let deviceDistribution = {
|
| 301 |
+
mobile: 0,
|
| 302 |
+
desktop: 0,
|
| 303 |
+
tablet: 0,
|
| 304 |
+
tv: 0
|
| 305 |
+
};
|
| 306 |
+
let trafficSources = {
|
| 307 |
+
googleAds: 0,
|
| 308 |
+
organicSearch: 0,
|
| 309 |
+
direct: 0,
|
| 310 |
+
social: 0
|
| 311 |
+
};
|
| 312 |
+
let sessionIdCounter = 0;
|
| 313 |
+
let videoPlayer;
|
| 314 |
+
let videoDuration = 213; // Rick Astley video duration in seconds
|
| 315 |
+
|
| 316 |
+
// Device and location data for simulation
|
| 317 |
+
const devices = [
|
| 318 |
+
{ type: 'mobile', name: 'iPhone 13', os: 'iOS 15' },
|
| 319 |
+
{ type: 'mobile', name: 'Samsung Galaxy S22', os: 'Android 12' },
|
| 320 |
+
{ type: 'desktop', name: 'Windows PC', os: 'Windows 11' },
|
| 321 |
+
{ type: 'desktop', name: 'MacBook Pro', os: 'macOS Monterey' },
|
| 322 |
+
{ type: 'tablet', name: 'iPad Pro', os: 'iPadOS 15' },
|
| 323 |
+
{ type: 'tablet', name: 'Samsung Galaxy Tab S8', os: 'Android 12' },
|
| 324 |
+
{ type: 'tv', name: 'Smart TV', os: 'Android TV' }
|
| 325 |
+
];
|
| 326 |
+
|
| 327 |
+
const locations = [
|
| 328 |
+
{ country: 'United States', city: 'New York' },
|
| 329 |
+
{ country: 'United Kingdom', city: 'London' },
|
| 330 |
+
{ country: 'Canada', city: 'Toronto' },
|
| 331 |
+
{ country: 'Australia', city: 'Sydney' },
|
| 332 |
+
{ country: 'Germany', city: 'Berlin' },
|
| 333 |
+
{ country: 'Japan', city: 'Tokyo' },
|
| 334 |
+
{ country: 'Brazil', city: 'São Paulo' }
|
| 335 |
+
];
|
| 336 |
+
|
| 337 |
+
// User agents for different devices
|
| 338 |
+
const userAgents = {
|
| 339 |
+
mobile: [
|
| 340 |
+
'Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Mobile/15E148 Safari/604.1',
|
| 341 |
+
'Mozilla/5.0 (Linux; Android 12; SM-S901B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 Mobile Safari/537.36'
|
| 342 |
+
],
|
| 343 |
+
desktop: [
|
| 344 |
+
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36',
|
| 345 |
+
'Mozilla/5.0 (Macintosh; Intel Mac OS X 12_3_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Safari/605.1.15'
|
| 346 |
+
],
|
| 347 |
+
tablet: [
|
| 348 |
+
'Mozilla/5.0 (iPad; CPU OS 15_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1',
|
| 349 |
+
'Mozilla/5.0 (Linux; Android 12; SM-X800) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 Safari/537.36'
|
| 350 |
+
],
|
| 351 |
+
tv: [
|
| 352 |
+
'Mozilla/5.0 (Linux; Android 11; Mi TV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 Safari/537.36'
|
| 353 |
+
]
|
| 354 |
+
};
|
| 355 |
+
|
| 356 |
+
// Traffic sources
|
| 357 |
+
const trafficSourcesList = [
|
| 358 |
+
{ type: 'googleAds', name: 'Google Ads' },
|
| 359 |
+
{ type: 'organicSearch', name: 'Organic Search' },
|
| 360 |
+
{ type: 'direct', name: 'Direct' },
|
| 361 |
+
{ type: 'social', name: 'Social Media' }
|
| 362 |
+
];
|
| 363 |
+
|
| 364 |
+
// Initialize the dashboard
|
| 365 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 366 |
+
// Load YouTube API
|
| 367 |
+
const tag = document.createElement('script');
|
| 368 |
+
tag.src = "https://www.youtube.com/iframe_api";
|
| 369 |
+
const firstScriptTag = document.getElementsByTagName('script')[0];
|
| 370 |
+
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
| 371 |
+
|
| 372 |
+
// Initialize chart
|
| 373 |
+
updateWatchTimeChart();
|
| 374 |
+
updateDeviceDistribution();
|
| 375 |
+
updateTrafficSources();
|
| 376 |
+
|
| 377 |
+
// Set up event listeners
|
| 378 |
+
document.getElementById('add-session').addEventListener('click', addSimulatedSession);
|
| 379 |
+
document.getElementById('simulation-speed').addEventListener('change', function() {
|
| 380 |
+
simulationSpeed = parseInt(this.value);
|
| 381 |
+
});
|
| 382 |
+
document.getElementById('change-video').addEventListener('click', changeVideo);
|
| 383 |
+
|
| 384 |
+
// Start with 5 simulated sessions
|
| 385 |
+
for (let i = 0; i < 5; i++) {
|
| 386 |
+
setTimeout(() => addSimulatedSession(), i * 2000);
|
| 387 |
+
}
|
| 388 |
+
|
| 389 |
+
// Update stats every second
|
| 390 |
+
setInterval(updateStats, 1000);
|
| 391 |
+
});
|
| 392 |
+
|
| 393 |
+
// YouTube API callback
|
| 394 |
+
function onYouTubeIframeAPIReady() {
|
| 395 |
+
videoPlayer = new YT.Player('yt-player', {
|
| 396 |
+
events: {
|
| 397 |
+
'onReady': onPlayerReady,
|
| 398 |
+
'onStateChange': onPlayerStateChange
|
| 399 |
+
}
|
| 400 |
+
});
|
| 401 |
+
}
|
| 402 |
+
|
| 403 |
+
function onPlayerReady(event) {
|
| 404 |
+
// Player is ready
|
| 405 |
+
}
|
| 406 |
+
|
| 407 |
+
function onPlayerStateChange(event) {
|
| 408 |
+
// Handle player state changes if needed
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
function changeVideo() {
|
| 412 |
+
const videos = [
|
| 413 |
+
'YOUR_VIDEO_ID_1', // Replace with your first video ID
|
| 414 |
+
'YOUR_VIDEO_ID_2', // Replace with your second video ID
|
| 415 |
+
'YOUR_VIDEO_ID_3', // Replace with your third video ID
|
| 416 |
+
'YOUR_VIDEO_ID_4', // Replace with your fourth video ID
|
| 417 |
+
'YOUR_VIDEO_ID_5' // Replace with your fifth video ID
|
| 418 |
+
];
|
| 419 |
+
|
| 420 |
+
const randomVideo = videos[Math.floor(Math.random() * videos.length)];
|
| 421 |
+
videoPlayer.loadVideoById(randomVideo);
|
| 422 |
+
|
| 423 |
+
// Update video info
|
| 424 |
+
document.querySelector('#yt-player + div h3').textContent = getVideoTitle(randomVideo);
|
| 425 |
+
document.querySelector('#yt-player + div p').textContent = getVideoInfo(randomVideo);
|
| 426 |
+
}
|
| 427 |
+
|
| 428 |
+
function getVideoTitle(videoId) {
|
| 429 |
+
const titles = {
|
| 430 |
+
'YOUR_VIDEO_ID_1': 'Your Video 1 Title',
|
| 431 |
+
'YOUR_VIDEO_ID_2': 'Your Video 2 Title',
|
| 432 |
+
'YOUR_VIDEO_ID_3': 'Your Video 3 Title',
|
| 433 |
+
'YOUR_VIDEO_ID_4': 'Your Video 4 Title',
|
| 434 |
+
'YOUR_VIDEO_ID_5': 'Your Video 5 Title'
|
| 435 |
+
};
|
| 436 |
+
return titles[videoId] || 'Unknown Video';
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
function getVideoInfo(videoId) {
|
| 440 |
+
const infos = {
|
| 441 |
+
'YOUR_VIDEO_ID_1': 'Your Channel • 0 views',
|
| 442 |
+
'YOUR_VIDEO_ID_2': 'Your Channel • 0 views',
|
| 443 |
+
'YOUR_VIDEO_ID_3': 'Your Channel • 0 views',
|
| 444 |
+
'YOUR_VIDEO_ID_4': 'Your Channel • 0 views',
|
| 445 |
+
'YOUR_VIDEO_ID_5': 'Your Channel • 0 views'
|
| 446 |
+
};
|
| 447 |
+
return infos[videoId] || 'Unknown Artist • 0 views';
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
+
// Add a simulated viewing session
|
| 451 |
+
function addSimulatedSession() {
|
| 452 |
+
sessionIdCounter++;
|
| 453 |
+
|
| 454 |
+
// Randomly select device, location, and traffic source
|
| 455 |
+
const device = devices[Math.floor(Math.random() * devices.length)];
|
| 456 |
+
const location = locations[Math.floor(Math.random() * locations.length)];
|
| 457 |
+
const trafficSource = trafficSourcesList[Math.floor(Math.random() * trafficSourcesList.length)];
|
| 458 |
+
|
| 459 |
+
// Get appropriate user agent
|
| 460 |
+
const userAgent = userAgents[device.type][Math.floor(Math.random() * userAgents[device.type].length)];
|
| 461 |
+
|
| 462 |
+
// Random watch duration between 30 seconds and full video length
|
| 463 |
+
const duration = Math.floor(Math.random() * (videoDuration - 30)) + 30;
|
| 464 |
+
|
| 465 |
+
// Create session object
|
| 466 |
+
const session = {
|
| 467 |
+
id: sessionIdCounter,
|
| 468 |
+
device: device,
|
| 469 |
+
location: location,
|
| 470 |
+
userAgent: userAgent,
|
| 471 |
+
trafficSource: trafficSource,
|
| 472 |
+
duration: duration,
|
| 473 |
+
startTime: new Date(),
|
| 474 |
+
watched: 0,
|
| 475 |
+
active: true
|
| 476 |
+
};
|
| 477 |
+
|
| 478 |
+
activeSessions.push(session);
|
| 479 |
+
currentViewers++;
|
| 480 |
+
|
| 481 |
+
// Update device distribution
|
| 482 |
+
deviceDistribution[device.type]++;
|
| 483 |
+
updateDeviceDistribution();
|
| 484 |
+
|
| 485 |
+
// Update traffic sources
|
| 486 |
+
trafficSources[trafficSource.type]++;
|
| 487 |
+
updateTrafficSources();
|
| 488 |
+
|
| 489 |
+
// Add to sessions table
|
| 490 |
+
addSessionToTable(session);
|
| 491 |
+
|
| 492 |
+
// Schedule session completion
|
| 493 |
+
setTimeout(() => completeSession(session), (duration * 1000) / simulationSpeed);
|
| 494 |
+
}
|
| 495 |
+
|
| 496 |
+
// Add session to the table
|
| 497 |
+
function addSessionToTable(session) {
|
| 498 |
+
const tableBody = document.getElementById('sessions-table');
|
| 499 |
+
const row = document.createElement('tr');
|
| 500 |
+
row.id = `session-${session.id}`;
|
| 501 |
+
row.className = 'p-2';
|
| 502 |
+
|
| 503 |
+
const timeCell = document.createElement('td');
|
| 504 |
+
timeCell.className = 'px-4 py-2 whitespace-nowrap text-sm text-gray-500';
|
| 505 |
+
timeCell.textContent = session.startTime.toLocaleTimeString();
|
| 506 |
+
|
| 507 |
+
const deviceCell = document.createElement('td');
|
| 508 |
+
deviceCell.className = 'px-4 py-2 whitespace-nowrap text-sm text-gray-900';
|
| 509 |
+
|
| 510 |
+
const deviceDiv = document.createElement('div');
|
| 511 |
+
deviceDiv.className = 'flex items-center';
|
| 512 |
+
|
| 513 |
+
const deviceIcon = document.createElement('i');
|
| 514 |
+
deviceIcon.className = device.type === 'mobile' ? 'fas fa-mobile-alt mr-2 text-blue-500' :
|
| 515 |
+
device.type === 'desktop' ? 'fas fa-desktop mr-2 text-purple-500' :
|
| 516 |
+
device.type === 'tablet' ? 'fas fa-tablet-alt mr-2 text-green-500' :
|
| 517 |
+
'fas fa-tv mr-2 text-yellow-500';
|
| 518 |
+
|
| 519 |
+
const deviceText = document.createElement('div');
|
| 520 |
+
deviceText.innerHTML = `<div class="font-medium">${session.device.name}</div><div class="text-xs text-gray-500">${session.device.os}</div>`;
|
| 521 |
+
|
| 522 |
+
deviceDiv.appendChild(deviceIcon);
|
| 523 |
+
deviceDiv.appendChild(deviceText);
|
| 524 |
+
deviceCell.appendChild(deviceDiv);
|
| 525 |
+
|
| 526 |
+
const locationCell = document.createElement('td');
|
| 527 |
+
locationCell.className = 'px-4 py-2 whitespace-nowrap text-sm text-gray-900';
|
| 528 |
+
locationCell.innerHTML = `<div class="font-medium">${session.location.city}</div><div class="text-xs text-gray-500">${session.location.country}</div>`;
|
| 529 |
+
|
| 530 |
+
const userAgentCell = document.createElement('td');
|
| 531 |
+
userAgentCell.className = 'px-4 py-2 whitespace-nowrap text-sm text-gray-900';
|
| 532 |
+
|
| 533 |
+
const userAgentBadge = document.createElement('span');
|
| 534 |
+
userAgentBadge.className = 'user-agent-badge inline-block bg-gray-100 rounded px-2 py-1 text-gray-800 truncate max-w-xs';
|
| 535 |
+
userAgentBadge.textContent = session.userAgent;
|
| 536 |
+
userAgentBadge.title = session.userAgent;
|
| 537 |
+
userAgentCell.appendChild(userAgentBadge);
|
| 538 |
+
|
| 539 |
+
const durationCell = document.createElement('td');
|
| 540 |
+
durationCell.className = 'px-4 py-2 whitespace-nowrap text-sm text-gray-900 font-medium';
|
| 541 |
+
durationCell.id = `duration-${session.id}`;
|
| 542 |
+
durationCell.textContent = '0:00';
|
| 543 |
+
|
| 544 |
+
row.appendChild(timeCell);
|
| 545 |
+
row.appendChild(deviceCell);
|
| 546 |
+
row.appendChild(locationCell);
|
| 547 |
+
row.appendChild(userAgentCell);
|
| 548 |
+
row.appendChild(durationCell);
|
| 549 |
+
|
| 550 |
+
tableBody.prepend(row);
|
| 551 |
+
}
|
| 552 |
+
|
| 553 |
+
// Complete a session
|
| 554 |
+
function completeSession(session) {
|
| 555 |
+
session.active = false;
|
| 556 |
+
currentViewers--;
|
| 557 |
+
|
| 558 |
+
// Calculate watch time in hours
|
| 559 |
+
const watchHours = session.duration / 3600;
|
| 560 |
+
|
| 561 |
+
// Update watch time stats
|
| 562 |
+
totalWatchHours += watchHours;
|
| 563 |
+
todayWatchHours += watchHours;
|
| 564 |
+
weekWatchHours += watchHours;
|
| 565 |
+
|
| 566 |
+
// Update watch time data for the current day of week
|
| 567 |
+
const dayOfWeek = new Date().getDay();
|
| 568 |
+
watchTimeData[dayOfWeek] += watchHours;
|
| 569 |
+
updateWatchTimeChart();
|
| 570 |
+
|
| 571 |
+
// Remove session from active sessions
|
| 572 |
+
activeSessions = activeSessions.filter(s => s.id !== session.id);
|
| 573 |
+
|
| 574 |
+
// Update UI
|
| 575 |
+
updateStats();
|
| 576 |
+
}
|
| 577 |
+
|
| 578 |
+
// Update all stats
|
| 579 |
+
function updateStats() {
|
| 580 |
+
// Update watch time
|
| 581 |
+
document.getElementById('total-hours').textContent = totalWatchHours.toFixed(2);
|
| 582 |
+
document.getElementById('today-hours').textContent = todayWatchHours.toFixed(2);
|
| 583 |
+
document.getElementById('week-hours').textContent = weekWatchHours.toFixed(2);
|
| 584 |
+
|
| 585 |
+
// Update progress bar
|
| 586 |
+
const progressPercent = Math.min((totalWatchHours / 4000) * 100, 100);
|
| 587 |
+
document.getElementById('hours-progress').style.width = `${progressPercent}%`;
|
| 588 |
+
|
| 589 |
+
// Update current viewers
|
| 590 |
+
document.getElementById('current-viewers').textContent = currentViewers;
|
| 591 |
+
|
| 592 |
+
// Update average watch time
|
| 593 |
+
const avgWatchTime = activeSessions.length > 0 ?
|
| 594 |
+
activeSessions.reduce((sum, session) => sum + session.duration, 0) / activeSessions.length : 0;
|
| 595 |
+
document.getElementById('avg-watch-time').textContent = formatTime(avgWatchTime);
|
| 596 |
+
|
| 597 |
+
// Update retention rate (simplified)
|
| 598 |
+
const retentionRate = Math.min(Math.floor((avgWatchTime / videoDuration) * 100), 100);
|
| 599 |
+
document.getElementById('retention-rate').textContent = `${retentionRate}%`;
|
| 600 |
+
|
| 601 |
+
// Update session durations
|
| 602 |
+
activeSessions.forEach(session => {
|
| 603 |
+
const elapsed = Math.min(Math.floor((new Date() - session.startTime) / 1000 * simulationSpeed), session.duration);
|
| 604 |
+
document.getElementById(`duration-${session.id}`).textContent = formatTime(elapsed);
|
| 605 |
+
});
|
| 606 |
+
}
|
| 607 |
+
|
| 608 |
+
// Update watch time chart
|
| 609 |
+
function updateWatchTimeChart() {
|
| 610 |
+
const chart = document.getElementById('watch-time-chart');
|
| 611 |
+
|
| 612 |
+
// Clear existing bars
|
| 613 |
+
const existingBars = chart.querySelectorAll('.chart-bar');
|
| 614 |
+
existingBars.forEach(bar => bar.remove());
|
| 615 |
+
|
| 616 |
+
// Find max value for scaling
|
| 617 |
+
const maxValue = Math.max(...watchTimeData, 1);
|
| 618 |
+
|
| 619 |
+
// Add new bars
|
| 620 |
+
for (let i = 0; i < watchTimeData.length; i++) {
|
| 621 |
+
const bar = document.createElement('div');
|
| 622 |
+
bar.className = 'chart-bar';
|
| 623 |
+
bar.style.left = `${10 + i * 14}%`;
|
| 624 |
+
bar.style.height = `${(watchTimeData[i] / maxValue) * 100}%`;
|
| 625 |
+
chart.appendChild(bar);
|
| 626 |
+
}
|
| 627 |
+
}
|
| 628 |
+
|
| 629 |
+
// Update device distribution
|
| 630 |
+
function updateDeviceDistribution() {
|
| 631 |
+
const totalDevices = Object.values(deviceDistribution).reduce((sum, val) => sum + val, 1);
|
| 632 |
+
|
| 633 |
+
const mobilePercent = Math.round((deviceDistribution.mobile / totalDevices) * 100);
|
| 634 |
+
const desktopPercent = Math.round((deviceDistribution.desktop / totalDevices) * 100);
|
| 635 |
+
const tabletPercent = Math.round((deviceDistribution.tablet / totalDevices) * 100);
|
| 636 |
+
const tvPercent = Math.round((deviceDistribution.tv / totalDevices) * 100);
|
| 637 |
+
|
| 638 |
+
document.getElementById('mobile-percent').textContent = `${mobilePercent}%`;
|
| 639 |
+
document.getElementById('desktop-percent').textContent = `${desktopPercent}%`;
|
| 640 |
+
document.getElementById('tablet-percent').textContent = `${tabletPercent}%`;
|
| 641 |
+
document.getElementById('tv-percent').textContent = `${tvPercent}%`;
|
| 642 |
+
}
|
| 643 |
+
|
| 644 |
+
// Update traffic sources
|
| 645 |
+
function updateTrafficSources() {
|
| 646 |
+
const totalSources = Object.values(trafficSources).reduce((sum, val) => sum + val, 1);
|
| 647 |
+
|
| 648 |
+
const googleAdsPercent = Math.round((trafficSources.googleAds / totalSources) * 100);
|
| 649 |
+
const organicSearchPercent = Math.round((trafficSources.organicSearch / totalSources) * 100);
|
| 650 |
+
const directPercent = Math.round((trafficSources.direct / totalSources) * 100);
|
| 651 |
+
const socialPercent = Math.round((trafficSources.social / totalSources) * 100);
|
| 652 |
+
|
| 653 |
+
document.getElementById('google-ads').textContent = `${googleAdsPercent}%`;
|
| 654 |
+
document.getElementById('organic-search').textContent = `${organicSearchPercent}%`;
|
| 655 |
+
document.getElementById('direct').textContent = `${directPercent}%`;
|
| 656 |
+
document.getElementById('social').textContent = `${socialPercent}%`;
|
| 657 |
+
}
|
| 658 |
+
|
| 659 |
+
// Format time (seconds to MM:SS)
|
| 660 |
+
function formatTime(seconds) {
|
| 661 |
+
const mins = Math.floor(seconds / 60);
|
| 662 |
+
const secs = Math.floor(seconds % 60);
|
| 663 |
+
return `${mins}:${secs < 10 ? '0' : ''}${secs}`;
|
| 664 |
+
}
|
| 665 |
+
</script>
|
| 666 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Muhammadumar786/yt" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 667 |
+
</html>
|