Skip to content

Instantly share code, notes, and snippets.

@SH20RAJ
Created July 14, 2024 16:57
Show Gist options
  • Save SH20RAJ/31e28eaecae6fb73a9f7d1094de40196 to your computer and use it in GitHub Desktop.
Save SH20RAJ/31e28eaecae6fb73a9f7d1094de40196 to your computer and use it in GitHub Desktop.
Terabox Video Downloader + watch live
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Video Fetcher</title>
<style>
iframe::-webkit-scrollbar {
width: 0em;
height: 0em;
}
body {
font-family: Arial, sans-serif;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
background-color: #f0f0f0;
}
#video-container {
display: none;
flex-direction: column;
align-items: center;
margin-top: 20px;
}
video {
width: 80%;
max-width: 600px;
height: auto;
border: 1px solid #ccc;
}
input {
padding: 10px;
width: 80%;
max-width: 400px;
margin-top: 20px;
}
button {
padding: 10px 20px;
margin-top: 10px;
cursor: pointer;
}
.link-container {
margin-top: 20px;
text-align: center;
}
.link-container a {
display: block;
margin: 10px 0;
color: #007BFF;
text-decoration: none;
}
#share-link {
margin-top: 20px;
}
#source-buttons {
display: flex;
gap: 10px;
margin-top: 20px;
}
</style>
</head>
<body>
<h1>Video Fetcher</h1>
<input id="input-url" placeholder="Enter Terabox URL" type="text">
<button onclick="fetchVideoDetails()">Fetch Video</button>
<button onclick="goBack()">Go Back</button>
<div id="video-container">
<h2 id="video-title"></h2>
<iframe id="iframe" style="width: 100%; height: 800px; border: 0;" allowfullscreen></iframe>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1828915420581549" crossorigin="anonymous"></script>
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-1828915420581549" data-ad-slot="6813796412" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<video controls id="video"></video>
<div id="source-buttons">
<button onclick="switchVideoSource('fast')">Fast Download</button>
<button onclick="switchVideoSource('hd')">HD Video</button>
<button onclick="switchVideoSource('watch')">Watch Link</button>
</div>
<div class="link-container">
<h3>Download Links</h3>
<a href="#" id="fast-download" rel="noopener noreferrer" target="_blank">Fast Download</a>
<a href="#" id="hd-video" rel="noopener noreferrer" target="_blank">HD Video</a>
<h3>Watch Link</h3>
<a href="#" id="watch-link" rel="noopener noreferrer" target="_blank">Watch Here</a>
<h3>Thumbnail</h3>
<a href="#" id="thumbnail-link" target="_blank">Thumbnail</a>
</div>
<button id="share-link" onclick="copyShareLink()">Copy Share Link</button>
</div>
<script>
document.addEventListener('DOMContentLoaded', () => {
const urlParams = new URLSearchParams(window.location.search);
const url = urlParams.get('url');
if (url) {
document.getElementById('input-url').value = url;
fetchVideoDetails();
}
});
let videoDetails;
async function fetchVideoDetails() {
const inputUrl = document.getElementById('input-url').value;
const id = inputUrl.split('/s/')[1];
const apiUrl = `https://wholly-api.skinnyrunner.com/get/website-data.php?get_html=https://teraboxdl-3xv9.onrender.com/api/yttera?id=${id}`;
try {
const response = await fetch(apiUrl);
const data = await response.json();
videoDetails = data.response[0];
const videoElement = document.getElementById('video');
videoElement.src = `https://teradl.shraj.workers.dev/?url=${encodeURIComponent(videoDetails.resolutions['Fast Download'])}`;
videoElement.poster = videoDetails.thumbnail;
const videoTitle = document.getElementById('video-title');
videoTitle.textContent = videoDetails.title;
document.title = videoDetails.title;
const fastDownloadLink = document.getElementById('fast-download');
fastDownloadLink.href = videoDetails.resolutions['Fast Download'];
const hdVideoLink = document.getElementById('hd-video');
hdVideoLink.href = videoDetails.resolutions['HD Video'];
const watchLink = document.getElementById('watch-link');
watchLink.href = `https://teradl.shraj.workers.dev/?url=${(videoDetails.resolutions['Fast Download'])}`;
const thumbnailLink = document.getElementById('thumbnail-link');
thumbnailLink.href = videoDetails.thumbnail;
const videoContainer = document.getElementById('video-container');
videoContainer.style.display = 'flex';
window.history.pushState(null, null, `?url=${encodeURIComponent(inputUrl)}`);
document.getElementById('iframe').src = `https://teraboxdownloader.top/c/botview/?q=${encodeURIComponent(inputUrl)}`;
} catch (error) {
console.error('Error fetching video details:', error);
}
}
function switchVideoSource(source) {
const videoElement = document.getElementById('video');
let url;
switch (source) {
case 'fast':
url = `https://teradl.shraj.workers.dev/?url=${(videoDetails.resolutions['Fast Download'])}`;
break;
case 'hd':
url = `https://teradl.shraj.workers.dev/?url=${(videoDetails.resolutions['HD Video'])}`;
break;
case 'watch':
url = `https://teradl.shraj.workers.dev/?url=${encodeURIComponent(videoDetails.resolutions['HD Video'])}`;
break;
}
videoElement.src = url;
}
function copyShareLink() {
const inputUrl = document.getElementById('input-url').value;
const shareUrl = `${window.location.origin}${window.location.pathname}?url=${encodeURIComponent(inputUrl)}`;
navigator.clipboard.writeText(shareUrl).then(() => {
alert('Share link copied to clipboard');
}).catch(err => {
console.error('Error copying share link:', err);
});
}
function goBack() {
document.getElementById('input-url').value = '';
document.getElementById('video-container').style.display = 'none';
document.getElementById('video').src = '';
document.getElementById('iframe').src = '';
document.title = 'Video Fetcher';
window.history.pushState(null, null, window.location.pathname);
}
</script>
</body>
</html>
@kingopk63
Copy link

can you share this https://teradl.shraj.workers.dev code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment