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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>YouTube Frame Randomizer</title>
|
| 7 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 8 |
+
<style>
|
| 9 |
+
:root {
|
| 10 |
+
--primary: #ff0000;
|
| 11 |
+
--primary-dark: #cc0000;
|
| 12 |
+
--background: #f9f9f9;
|
| 13 |
+
--card-bg: #ffffff;
|
| 14 |
+
--text: #333333;
|
| 15 |
+
--text-light: #606060;
|
| 16 |
+
--border: #e0e0e0;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
* {
|
| 20 |
+
margin: 0;
|
| 21 |
+
padding: 0;
|
| 22 |
+
box-sizing: border-box;
|
| 23 |
+
font-family: 'Roboto', Arial, sans-serif;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
body {
|
| 27 |
+
background-color: var(--background);
|
| 28 |
+
color: var(--text);
|
| 29 |
+
min-height: 100vh;
|
| 30 |
+
padding: 20px;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
header {
|
| 34 |
+
display: flex;
|
| 35 |
+
justify-content: space-between;
|
| 36 |
+
align-items: center;
|
| 37 |
+
margin-bottom: 30px;
|
| 38 |
+
padding-bottom: 15px;
|
| 39 |
+
border-bottom: 1px solid var(--border);
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
.logo {
|
| 43 |
+
display: flex;
|
| 44 |
+
align-items: center;
|
| 45 |
+
gap: 10px;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
.logo i {
|
| 49 |
+
color: var(--primary);
|
| 50 |
+
font-size: 2rem;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
.logo h1 {
|
| 54 |
+
font-size: 1.8rem;
|
| 55 |
+
font-weight: 500;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
.controls {
|
| 59 |
+
display: flex;
|
| 60 |
+
gap: 15px;
|
| 61 |
+
align-items: center;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
.count-selector {
|
| 65 |
+
display: flex;
|
| 66 |
+
align-items: center;
|
| 67 |
+
gap: 10px;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
select {
|
| 71 |
+
padding: 8px 12px;
|
| 72 |
+
border-radius: 4px;
|
| 73 |
+
border: 1px solid var(--border);
|
| 74 |
+
background-color: var(--card-bg);
|
| 75 |
+
color: var(--text);
|
| 76 |
+
cursor: pointer;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
button {
|
| 80 |
+
padding: 8px 16px;
|
| 81 |
+
background-color: var(--primary);
|
| 82 |
+
color: white;
|
| 83 |
+
border: none;
|
| 84 |
+
border-radius: 4px;
|
| 85 |
+
cursor: pointer;
|
| 86 |
+
font-weight: 500;
|
| 87 |
+
transition: background-color 0.2s;
|
| 88 |
+
display: flex;
|
| 89 |
+
align-items: center;
|
| 90 |
+
gap: 8px;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
button:hover {
|
| 94 |
+
background-color: var(--primary-dark);
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
.grid {
|
| 98 |
+
display: grid;
|
| 99 |
+
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
| 100 |
+
gap: 20px;
|
| 101 |
+
margin-top: 20px;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
.video-card {
|
| 105 |
+
background-color: var(--card-bg);
|
| 106 |
+
border-radius: 8px;
|
| 107 |
+
overflow: hidden;
|
| 108 |
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
| 109 |
+
transition: transform 0.2s;
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
.video-card:hover {
|
| 113 |
+
transform: translateY(-5px);
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
.thumbnail {
|
| 117 |
+
width: 100%;
|
| 118 |
+
height: 180px;
|
| 119 |
+
object-fit: cover;
|
| 120 |
+
cursor: pointer;
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
.video-info {
|
| 124 |
+
padding: 12px;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
.video-title {
|
| 128 |
+
font-size: 1rem;
|
| 129 |
+
font-weight: 500;
|
| 130 |
+
margin-bottom: 8px;
|
| 131 |
+
display: -webkit-box;
|
| 132 |
+
-webkit-line-clamp: 2;
|
| 133 |
+
-webkit-box-orient: vertical;
|
| 134 |
+
overflow: hidden;
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
.video-channel {
|
| 138 |
+
font-size: 0.9rem;
|
| 139 |
+
color: var(--text-light);
|
| 140 |
+
margin-bottom: 4px;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
.video-views {
|
| 144 |
+
font-size: 0.8rem;
|
| 145 |
+
color: var(--text-light);
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
.attribution {
|
| 149 |
+
margin-top: 30px;
|
| 150 |
+
text-align: center;
|
| 151 |
+
color: var(--text-light);
|
| 152 |
+
font-size: 0.9rem;
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
.attribution a {
|
| 156 |
+
color: var(--primary);
|
| 157 |
+
text-decoration: none;
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
.attribution a:hover {
|
| 161 |
+
text-decoration: underline;
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
@media (max-width: 768px) {
|
| 165 |
+
header {
|
| 166 |
+
flex-direction: column;
|
| 167 |
+
gap: 15px;
|
| 168 |
+
align-items: flex-start;
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
.controls {
|
| 172 |
+
width: 100%;
|
| 173 |
+
flex-direction: column;
|
| 174 |
+
align-items: flex-start;
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
.grid {
|
| 178 |
+
grid-template-columns: 1fr;
|
| 179 |
+
}
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
/* Loading animation */
|
| 183 |
+
.loading {
|
| 184 |
+
display: flex;
|
| 185 |
+
justify-content: center;
|
| 186 |
+
align-items: center;
|
| 187 |
+
height: 100px;
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
.spinner {
|
| 191 |
+
width: 40px;
|
| 192 |
+
height: 40px;
|
| 193 |
+
border: 4px solid rgba(0, 0, 0, 0.1);
|
| 194 |
+
border-radius: 50%;
|
| 195 |
+
border-top-color: var(--primary);
|
| 196 |
+
animation: spin 1s ease-in-out infinite;
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
@keyframes spin {
|
| 200 |
+
to { transform: rotate(360deg); }
|
| 201 |
+
}
|
| 202 |
+
</style>
|
| 203 |
+
</head>
|
| 204 |
+
<body>
|
| 205 |
+
<header>
|
| 206 |
+
<div class="logo">
|
| 207 |
+
<i class="fab fa-youtube"></i>
|
| 208 |
+
<h1>YouTube Frame Randomizer</h1>
|
| 209 |
+
</div>
|
| 210 |
+
<div class="controls">
|
| 211 |
+
<div class="count-selector">
|
| 212 |
+
<label for="count">Frames:</label>
|
| 213 |
+
<select id="count">
|
| 214 |
+
<option value="4">4</option>
|
| 215 |
+
<option value="8" selected>8</option>
|
| 216 |
+
<option value="12">12</option>
|
| 217 |
+
<option value="16">16</option>
|
| 218 |
+
</select>
|
| 219 |
+
</div>
|
| 220 |
+
<button id="randomize">
|
| 221 |
+
<i class="fas fa-random"></i>
|
| 222 |
+
Randomize
|
| 223 |
+
</button>
|
| 224 |
+
</div>
|
| 225 |
+
</header>
|
| 226 |
+
|
| 227 |
+
<div id="loading" class="loading">
|
| 228 |
+
<div class="spinner"></div>
|
| 229 |
+
</div>
|
| 230 |
+
|
| 231 |
+
<div id="grid" class="grid"></div>
|
| 232 |
+
|
| 233 |
+
<div class="attribution">
|
| 234 |
+
<p>Built with <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank">anycoder</a></p>
|
| 235 |
+
</div>
|
| 236 |
+
|
| 237 |
+
<script>
|
| 238 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 239 |
+
const grid = document.getElementById('grid');
|
| 240 |
+
const randomizeBtn = document.getElementById('randomize');
|
| 241 |
+
const countSelect = document.getElementById('count');
|
| 242 |
+
const loading = document.getElementById('loading');
|
| 243 |
+
|
| 244 |
+
// Sample video data (in a real app, you might fetch this from an API)
|
| 245 |
+
const videoDatabase = [
|
| 246 |
+
{ id: 'dQw4w9WgXcQ', title: 'Never Gonna Give You Up', channel: 'Rick Astley', views: '1.2B views' },
|
| 247 |
+
{ id: '9bZkp7q19f0', title: 'Gangnam Style', channel: 'PSY', views: '4.5B views' },
|
| 248 |
+
{ id: 'kJQP7kiw5Fk', title: 'Despacito', channel: 'Luis Fonsi', views: '7.9B views' },
|
| 249 |
+
{ id: 'JGwWNGJdvx8', title: 'Shape of You', channel: 'Ed Sheeran', views: '5.9B views' },
|
| 250 |
+
{ id: 'RgKAFK5djSk', title: 'See You Again', channel: 'Wiz Khalifa', views: '5.9B views' },
|
| 251 |
+
{ id: 'OPf0YbXqDm0', title: 'Uptown Funk', channel: 'Mark Ronson', views: '4.7B views' },
|
| 252 |
+
{ id: 'kJQP7kiw5Fk', title: 'Minecraft Theme', channel: 'C418', views: '200M views' },
|
| 253 |
+
{ id: 'JGwWNGJdvx8', title: 'Baby Shark Dance', channel: 'Pinkfong', views: '13B views' },
|
| 254 |
+
{ id: 'RgKAFK5djSk', title: 'Learning to Fly', channel: 'Pink Floyd', views: '45M views' },
|
| 255 |
+
{ id: 'OPf0YbXqDm0', title: 'Bohemian Rhapsody', channel: 'Queen', views: '1.8B views' },
|
| 256 |
+
{ id: 'dQw4w9WgXcQ', title: 'Sweet Child O\' Mine', channel: 'Guns N\' Roses', views: '1.5B views' },
|
| 257 |
+
{ id: '9bZkp7q19f0', title: 'Hotel California', channel: 'Eagles', views: '1B views' },
|
| 258 |
+
{ id: 'kJQP7kiw5Fk', title: 'Smells Like Teen Spirit', channel: 'Nirvana', views: '1.4B views' },
|
| 259 |
+
{ id: 'JGwWNGJdvx8', title: 'Imagine', channel: 'John Lennon', views: '500M views' },
|
| 260 |
+
{ id: 'RgKAFK5djSk', title: 'Billie Jean', channel: 'Michael Jackson', views: '1.2B views' },
|
| 261 |
+
{ id: 'OPf0YbXqDm0', title: 'Like a Rolling Stone', channel: 'Bob Dylan', views: '300M views' }
|
| 262 |
+
];
|
| 263 |
+
|
| 264 |
+
// Function to get random videos
|
| 265 |
+
function getRandomVideos(count) {
|
| 266 |
+
const shuffled = [...videoDatabase].sort(() => 0.5 - Math.random());
|
| 267 |
+
return shuffled.slice(0, count);
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
// Function to generate thumbnail URL
|
| 271 |
+
function getThumbnailUrl(videoId) {
|
| 272 |
+
// Randomly select a thumbnail version (1-4) for variety
|
| 273 |
+
const version = Math.floor(Math.random() * 4) + 1;
|
| 274 |
+
return `https://img.youtube.com/vi/${videoId}/${version}.jpg`;
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
// Function to display videos
|
| 278 |
+
function displayVideos(videos) {
|
| 279 |
+
grid.innerHTML = '';
|
| 280 |
+
videos.forEach(video => {
|
| 281 |
+
const card = document.createElement('div');
|
| 282 |
+
card.className = 'video-card';
|
| 283 |
+
card.innerHTML = `
|
| 284 |
+
<img src="${getThumbnailUrl(video.id)}" alt="${video.title}" class="thumbnail">
|
| 285 |
+
<div class="video-info">
|
| 286 |
+
<h3 class="video-title">${video.title}</h3>
|
| 287 |
+
<p class="video-channel">${video.channel}</p>
|
| 288 |
+
<p class="video-views">${video.views}</p>
|
| 289 |
+
</div>
|
| 290 |
+
`;
|
| 291 |
+
grid.appendChild(card);
|
| 292 |
+
});
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
+
// Initial load
|
| 296 |
+
function loadVideos() {
|
| 297 |
+
loading.style.display = 'flex';
|
| 298 |
+
grid.style.display = 'none';
|
| 299 |
+
|
| 300 |
+
// Simulate loading delay
|
| 301 |
+
setTimeout(() => {
|
| 302 |
+
const count = parseInt(countSelect.value);
|
| 303 |
+
const randomVideos = getRandomVideos(count);
|
| 304 |
+
displayVideos(randomVideos);
|
| 305 |
+
loading.style.display = 'none';
|
| 306 |
+
grid.style.display = 'grid';
|
| 307 |
+
}, 800);
|
| 308 |
+
}
|
| 309 |
+
|
| 310 |
+
// Event listeners
|
| 311 |
+
randomizeBtn.addEventListener('click', loadVideos);
|
| 312 |
+
countSelect.addEventListener('change', loadVideos);
|
| 313 |
+
|
| 314 |
+
// First load
|
| 315 |
+
loadVideos();
|
| 316 |
+
});
|
| 317 |
+
</script>
|
| 318 |
+
</body>
|
| 319 |
+
</html>
|