.card{background-color:#fff;border-radius:12px;box-shadow:0 6px 15px rgba(0,0,0,.1);padding:30px;margin-bottom:30px;transition:box-shadow .3s;border:1px solid #e2e8f0}.action-buttons .btn,.btn-search{padding:14px 25px;color:#fff;cursor:pointer;transition:background-color .3s,transform .1s,box-shadow .2s;font-size:1.1rem}.card:hover{box-shadow:0 8px 20px rgba(0,0,0,.15)}.action-buttons .btn:hover,.btn-search:hover{transform:translateY(-2px);box-shadow:0 4px 8px rgba(0,0,0,.15)}.card h2{font-size:1.85rem;color:#1a202c;margin-bottom:25px;font-weight:600;letter-spacing:-.02em}.input-group{display:flex;align-items:center}#video-url{flex:1;padding:14px;border-radius:8px 0 0 8px;border:2px solid #e2e8f0;font-size:1.1rem;transition:border-color .3s;outline:0;color:#2d3748;box-shadow:inset 0 1px 3px rgba(0,0,0,.05)}#video-url:focus{border-color:#4299e1;box-shadow:0 0 0 3px rgba(66,153,225,.15)}.btn-search{border-radius:0 8px 8px 0;background-color:#4299e1;border:none;box-shadow:0 2px 5px rgba(0,0,0,.1)}.btn-search:hover{background-color:#3182ce}.btn-search:active{background-color:#285e96;transform:translateY(0);box-shadow:0 1px 3px rgba(0,0,0,.1)}.loading{display:none;align-items:center;justify-content:center;margin-top:30px}.loading p{margin-left:15px;font-size:1.2rem;color:#4a5568}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.spinner{border:5px solid rgba(66,153,225,.3);border-top:5px solid #4299e1;border-radius:50%;width:30px;height:30px;animation:1s linear infinite spin}#video-container{display:none;margin-top:40px}.video-wrapper{position:relative;padding-bottom:56.25%;height:0;overflow:hidden;border-radius:12px;box-shadow:0 3px 7px rgba(0,0,0,.1);border:1px solid #e2e8f0}.video-js{position:absolute!important;top:0;left:0;width:100%;height:100%}.action-buttons{margin-top:30px;display:flex;justify-content:center}.action-buttons a{margin-right:15px;margin-left:15px}.action-buttons .btn{border-radius:8px;background-color:#48bb78;border:none;box-shadow:0 2px 5px rgba(0,0,0,.1);display:flex;align-items:center}.action-buttons .btn:hover{background-color:#38a169}.action-buttons .btn:active{background-color:#2d7f5e;transform:translateY(0);box-shadow:0 1px 3px rgba(0,0,0,.1)}.action-buttons .btn i{margin-right:8px;font-size:1.1rem}@media (max-width:768px){.container{padding:0 15px}h1{font-size:2.4rem}.card{padding:20px}.card h2{font-size:1.65rem}.input-group{flex-direction:column}#video-url{border-radius:8px 8px 0 0;margin-bottom:10px}.btn-search{border-radius:0 0 8px 8px}.action-buttons{flex-direction:column;align-items:center}.action-buttons a,.action-buttons button{margin-right:0;margin-left:0;margin-bottom:15px;width:100%;text-align:center}}@media (max-width:576px){h1{font-size:2rem}.card{padding:15px}.card h2{font-size:1.45rem}#video-url,.action-buttons .btn i,.loading p{font-size:1rem}#video-url{padding:12px}.action-buttons .btn,.btn-search{font-size:1rem;padding:12px 20px}} Terabox Video Player Enter Video Link Load Loading your video... Download Video let player; function extractTeraboxId(url) { // Handle multiple URL formats let matches; // Try to match standard format matches = url.match(/[^\/]+$/); if (matches && matches[0]) return matches[0]; // Try to match URL with parameters matches = url.match(/\/([^\/]+)(?:\?|$)/); if (matches && matches[1]) return matches[1]; return null; } function showLoading(show) { document.getElementById("loading").style.display = show ? "block" : "none"; } function loadVideo() { const teraboxUrl = document.getElementById("video-url").value.trim(); if (!teraboxUrl) { showNotification("Please enter a valid Terabox URL", "error"); return; } showLoading(true); const teraboxId = extractTeraboxId(teraboxUrl); if (!teraboxId) { showLoading(false); showNotification("Could not extract valid ID from URL", "error"); return; } const videoUrl = `https://mdisksetup.shraj.workers.dev/m3u8?id=${teraboxId}`; // Check if the URL is accessible fetch(videoUrl) .then(response => { if (!response.ok) { throw new Error(`Error: ${response.status}`); } return response; }) .then(() => { initializePlayer(videoUrl); }) .catch(error => { console.error("Error loading video:", error); showLoading(false); showNotification("Could not load video. Please check the URL and try again.", "error"); }); } function initializePlayer(videoUrl) { document.getElementById("video-container").style.display = "block"; showLoading(false); // Destroy previous player instance if it exists if (player) { player.dispose(); } // Create new player player = videojs('video-player', { controls: true, autoplay: false, preload: 'auto', responsive: true, fluid: true, playbackRates: [0.5, 1, 1.5, 2], sources: [{ src: videoUrl, type: 'application/x-mpegURL' }] }); player.on('error', function() { showNotification("Error playing video. Please try another URL.", "error"); }); document.getElementById("download-btn").href = videoUrl; // Scroll to player document.getElementById("video-container").scrollIntoView({ behavior: 'smooth' }); showNotification("Video loaded successfully!", "success"); } function resetPlayer() { document.getElementById("video-url").value = ""; document.getElementById("video-container").style.display = "none"; if (player) { player.dispose(); player = null; } } function copyVideoLink() { const downloadLink = document.getElementById("download-btn").href; if (downloadLink && downloadLink !== "#") { navigator.clipboard.writeText(downloadLink) .then(() => { showNotification("Video link copied to clipboard!", "success"); }) .catch(err => { showNotification("Failed to copy link", "error"); console.error('Failed to copy: ', err); }); } else { showNotification("No video link available", "error"); } } function showNotification(message, type = "info") { // Create notification element if it doesn't exist let notification = document.getElementById("notification"); if (!notification) { notification = document.createElement("div"); notification.id = "notification"; notification.style.position = "fixed"; notification.style.bottom = "20px"; notification.style.right = "20px"; notification.style.padding = "15px 20px"; notification.style.borderRadius = "8px"; notification.style.boxShadow = "0 4px 12px rgba(0,0,0,0.15)"; notification.style.zIndex = "1000"; notification.style.transition = "all 0.3s ease"; notification.style.transform = "translateY(100px)"; document.body.appendChild(notification); } // Set notification type if (type === "error") { notification.style.backgroundColor = "#d32f2f"; } else if (type === "success") { notification.style.backgroundColor = "#43a047"; } else { notification.style.backgroundColor = "#2196f3"; } notification.style.color = "white"; notification.textContent = message; notification.style.transform = "translateY(0)"; // Hide notification after 3 seconds setTimeout(() => { notification.style.transform = "translateY(100px)"; }, 3000); } // Add ability to submit by pressing Enter key document.getElementById("video-url").addEventListener("keypress", function(event) { if (event.key === "Enter") { event.preventDefault(); loadVideo(); } });