278 lines
		
	
	
		
			8.2 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			278 lines
		
	
	
		
			8.2 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <!DOCTYPE html>
 | |
| <html lang="de">
 | |
| <head>
 | |
|     <meta charset="UTF-8">
 | |
|     <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | |
|     <title>YouTube Thumbnail Viewer</title>
 | |
|     <meta property="og:title" content="YouTube Thumbnail Viewer">
 | |
|     <meta property="og:description" content="Zeige und speichere Thumbnails von YouTube-Videos">
 | |
|     <meta property="og:type" content="website">
 | |
|     <meta property="og:url" content="https://tools.ponywave.de/yt_thumb">
 | |
|     <script defer src="https://stats.ponywave.de/script" data-website-id="9ef713d2-adb9-4906-9df5-708d8a8b9131" data-tag="yt_thumb"></script>
 | |
|     <style>
 | |
|         body {
 | |
|             font-family: 'Segoe UI', Arial, sans-serif;
 | |
|             text-align: center;
 | |
|             margin: 20px;
 | |
|             background-color: #f5f5f5;
 | |
|         }
 | |
| 
 | |
|         h1 {
 | |
|             color: #ff0000;
 | |
|             margin-bottom: 30px;
 | |
|         }
 | |
| 
 | |
|         .input-container {
 | |
|             margin: 30px auto;
 | |
|             max-width: 600px;
 | |
|         }
 | |
| 
 | |
|         input {
 | |
|             padding: 12px 20px;
 | |
|             width: 70%;
 | |
|             border: 2px solid #ddd;
 | |
|             border-radius: 25px;
 | |
|             font-size: 16px;
 | |
|             transition: all 0.3s ease;
 | |
|         }
 | |
| 
 | |
|         input:focus {
 | |
|             outline: none;
 | |
|             border-color: #ff0000;
 | |
|             box-shadow: 0 0 8px rgba(255, 0, 0, 0.2);
 | |
|         }
 | |
| 
 | |
|         button {
 | |
|             padding: 12px 25px;
 | |
|             background-color: #ff0000;
 | |
|             color: white;
 | |
|             border: none;
 | |
|             border-radius: 25px;
 | |
|             cursor: pointer;
 | |
|             font-size: 16px;
 | |
|             transition: all 0.3s ease;
 | |
|         }
 | |
| 
 | |
|         button:hover {
 | |
|             background-color: #cc0000;
 | |
|             transform: translateY(-1px);
 | |
|         }
 | |
| 
 | |
|         .thumbnail-container {
 | |
|             display: grid;
 | |
|             grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
 | |
|             gap: 30px;
 | |
|             padding: 20px;
 | |
|             max-width: 1200px;
 | |
|             margin: 0 auto;
 | |
|         }
 | |
| 
 | |
|         .thumbnail {
 | |
|             background: white;
 | |
|             border-radius: 12px;
 | |
|             padding: 15px;
 | |
|             box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
 | |
|             transition: transform 0.3s ease;
 | |
|         }
 | |
| 
 | |
|         .thumbnail:hover {
 | |
|             transform: translateY(-5px);
 | |
|         }
 | |
| 
 | |
|         img {
 | |
|             width: 100%;
 | |
|             height: auto;
 | |
|             border-radius: 8px;
 | |
|             margin-bottom: 10px;
 | |
|         }
 | |
| 
 | |
|         .button-group {
 | |
|             display: flex;
 | |
|             gap: 10px;
 | |
|             justify-content: center;
 | |
|             margin-top: 10px;
 | |
|         }
 | |
| 
 | |
|         .button-group button {
 | |
|             padding: 8px 15px;
 | |
|             font-size: 14px;
 | |
|             background-color: #444;
 | |
|         }
 | |
| 
 | |
|         .button-group button:hover {
 | |
|             background-color: #666;
 | |
|         }
 | |
| 
 | |
|         p.label {
 | |
|             margin: 10px 0;
 | |
|             color: #666;
 | |
|             font-weight: bold;
 | |
|         }
 | |
| 
 | |
|         .toast {
 | |
|             position: fixed;
 | |
|             bottom: 30px;
 | |
|             left: 50%;
 | |
|             transform: translateX(-50%);
 | |
|             background: rgba(0, 0, 0, 0.9);
 | |
|             color: white;
 | |
|             padding: 15px 25px;
 | |
|             border-radius: 25px;
 | |
|             display: none;
 | |
|             align-items: center;
 | |
|             gap: 10px;
 | |
|             font-size: 14px;
 | |
|             opacity: 0;
 | |
|             transition: opacity 0.3s ease;
 | |
|             z-index: 1000;
 | |
|         }
 | |
| 
 | |
|         .toast.visible {
 | |
|             display: flex;
 | |
|             opacity: 1;
 | |
|         }
 | |
| 
 | |
|         .toast-success {
 | |
|             background: #4CAF50;
 | |
|         }
 | |
| 
 | |
|         .toast-error {
 | |
|             background: #f44336;
 | |
|         }
 | |
| 
 | |
|         .toast-icon {
 | |
|             width: 20px;
 | |
|             height: 20px;
 | |
|         }
 | |
|     </style>
 | |
| </head>
 | |
| <body>
 | |
|     <h1>🎥 YouTube Thumbnail Viewer</h1>
 | |
|     
 | |
|     <div class="input-container">
 | |
|         <input type="text" 
 | |
|                id="youtube-url" 
 | |
|                placeholder="YouTube URL eingeben (z.B. https://youtube.com/watch?v=...)"
 | |
|                onkeypress="handleEnter(event)">
 | |
|         <button onclick="fetchThumbnails()">Thumbnails anzeigen</button>
 | |
|     </div>
 | |
| 
 | |
|     <div id="thumbnails" class="thumbnail-container"></div>
 | |
| 
 | |
|     <div id="toast" class="toast"></div>
 | |
| 
 | |
|     <script>
 | |
|         function handleEnter(event) {
 | |
|             if (event.key === 'Enter') {
 | |
|                 fetchThumbnails();
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         function fetchThumbnails() {
 | |
|             const urlInput = document.getElementById('youtube-url').value;
 | |
|             const videoId = extractVideoId(urlInput);
 | |
| 
 | |
|             if (!videoId) {
 | |
|                 showToast('Ungültige YouTube-URL!', 'error');
 | |
|                 return;
 | |
|             }
 | |
| 
 | |
|             const sizes = [
 | |
|                 { label: 'Maximale Auflösung (1280x720)', code: 'maxresdefault' },
 | |
|                 { label: 'HD (640x480)', code: 'sddefault' },
 | |
|                 { label: 'Standard (480x360)', code: 'hqdefault' },
 | |
|                 { label: 'Medium (320x180)', code: 'mqdefault' },
 | |
|                 { label: 'Vorschau (120x90)', code: 'default' }
 | |
|             ];
 | |
| 
 | |
|             const container = document.getElementById('thumbnails');
 | |
|             container.innerHTML = '';
 | |
| 
 | |
|             sizes.forEach(size => {
 | |
|                 const thumbUrl = `https://img.youtube.com/vi/${videoId}/${size.code}.jpg`;
 | |
|                 
 | |
|                 const thumbDiv = document.createElement('div');
 | |
|                 thumbDiv.className = 'thumbnail';
 | |
| 
 | |
|                 const img = new Image();
 | |
|                 img.src = thumbUrl;
 | |
|                 img.alt = `Thumbnail ${size.label}`;
 | |
|                 img.loading = 'lazy';
 | |
| 
 | |
|                 const label = document.createElement('p');
 | |
|                 label.className = 'label';
 | |
|                 label.textContent = size.label;
 | |
| 
 | |
|                 const buttonGroup = document.createElement('div');
 | |
|                 buttonGroup.className = 'button-group';
 | |
| 
 | |
|                 const copyButton = createButton('📋 URL kopieren', async () => {
 | |
|                     try {
 | |
|                         await navigator.clipboard.writeText(thumbUrl);
 | |
|                         showToast('URL kopiert!');
 | |
|                     } catch (error) {
 | |
|                         showToast('Fehler beim Kopieren!', 'error');
 | |
|                     }
 | |
|                 });
 | |
| 
 | |
|                 const downloadButton = createButton('⬇️ Herunterladen', () => {
 | |
|                     const link = document.createElement('a');
 | |
|                     link.href = thumbUrl;
 | |
|                     link.download = `thumbnail_${size.code}.jpg`;
 | |
|                     document.body.appendChild(link);
 | |
|                     link.click();
 | |
|                     document.body.removeChild(link);
 | |
|                 });
 | |
| 
 | |
|                 buttonGroup.appendChild(copyButton);
 | |
|                 buttonGroup.appendChild(downloadButton);
 | |
| 
 | |
|                 thumbDiv.appendChild(img);
 | |
|                 thumbDiv.appendChild(label);
 | |
|                 thumbDiv.appendChild(buttonGroup);
 | |
|                 container.appendChild(thumbDiv);
 | |
|             });
 | |
|         }
 | |
| 
 | |
|         function extractVideoId(url) {
 | |
|             const patterns = [
 | |
|                 /v=([^&#]+)/,
 | |
|                 /youtu\.be\/([^?#]+)/,
 | |
|                 /embed\/([^?#]+)/,
 | |
|                 /\/v\/([^?#]+)/
 | |
|             ];
 | |
| 
 | |
|             for (const pattern of patterns) {
 | |
|                 const match = url.match(pattern);
 | |
|                 if (match && match[1]) return match[1];
 | |
|             }
 | |
|             return null;
 | |
|         }
 | |
| 
 | |
|         function createButton(text, onClick) {
 | |
|             const button = document.createElement('button');
 | |
|             button.textContent = text;
 | |
|             button.onclick = onClick;
 | |
|             return button;
 | |
|         }
 | |
| 
 | |
|         function showToast(message, type = 'success') {
 | |
|             const toast = document.getElementById('toast');
 | |
|             toast.className = `toast toast-${type} visible`;
 | |
|             toast.innerHTML = `
 | |
|                 <svg class="toast-icon" viewBox="0 0 24 24">
 | |
|                     ${type === 'success' ? 
 | |
|                     '<path fill="currentColor" d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"/>' : 
 | |
|                     '<path fill="currentColor" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/>'}
 | |
|                 </svg>
 | |
|                 ${message}
 | |
|             `;
 | |
| 
 | |
|             setTimeout(() => {
 | |
|                 toast.classList.remove('visible');
 | |
|             }, 3000);
 | |
|         }
 | |
|     </script>
 | |
| </body>
 | |
| </html>
 |