commit 2f5fbe9e5ce8daf6ab452296df482bacf8c0dfb2 Author: Sneed Group Holder Date: Mon Oct 28 10:36:29 2024 -0500 first commit diff --git a/index.html b/index.html new file mode 100644 index 0000000..e0a326d --- /dev/null +++ b/index.html @@ -0,0 +1,22 @@ + + + + + + UberTuber + + + +
+

UberTuber

+ + + +

Results

+ +
+ + + + + diff --git a/script.js b/script.js new file mode 100644 index 0000000..50c7291 --- /dev/null +++ b/script.js @@ -0,0 +1,49 @@ +document.getElementById('search-button').addEventListener('click', async () => { + const query = document.getElementById('search-input').value; + const resultsList = document.getElementById('video-results'); + resultsList.innerHTML = ''; // Clear previous results + + if (!query) { + alert('Please enter a search query.'); + return; + } + + try { + const response = await fetch(`https://ubertuberbe.nodemixaholic.com/search?q=${encodeURIComponent(query)}`); + const videos = await response.json(); + + videos.forEach(video => { + const listItem = document.createElement('li'); + listItem.innerHTML = ` + ${video.title} (${video.views} views) by ${video.author} +
+ Download + `; + resultsList.appendChild(listItem); + }); + + // Add event listeners to download links + document.querySelectorAll('.download-link').forEach(link => { + link.addEventListener('click', async (e) => { + e.preventDefault(); + const videoUrl = e.target.dataset.url; + const downloadResponse = await fetch(`https://ubertuberbe.nodemixaholic.com/download?url=${encodeURIComponent(videoUrl)}`); + const blob = await downloadResponse.blob(); + + const url = window.URL.createObjectURL(blob); + const a = document.createElement('a'); + a.style.display = 'none'; + a.href = url; + a.download = 'video.mp4'; // You might want to set this dynamically + document.body.appendChild(a); + a.click(); + window.URL.revokeObjectURL(url); + }); + }); + + } catch (error) { + console.error('Error fetching videos:', error); + alert('An error occurred while searching for videos.'); + } +}); + diff --git a/styles.css b/styles.css new file mode 100644 index 0000000..b66996a --- /dev/null +++ b/styles.css @@ -0,0 +1,53 @@ +body { + font-family: Arial, sans-serif; + background-color: #f4f4f4; + margin: 0; + padding: 20px; +} + +.container { + max-width: 600px; + margin: auto; + background: white; + padding: 20px; + border-radius: 5px; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); +} + +h1, h2 { + text-align: center; +} + +input[type="text"] { + width: calc(100% - 22px); + padding: 10px; + margin-bottom: 10px; +} + +button { + width: 100%; + padding: 10px; + background-color: #28a745; + color: white; + border: none; + border-radius: 5px; +} + +ul { + list-style-type: none; + padding: 0; +} + +li { + padding: 10px; + margin-bottom: 10px; + background: #f9f9f9; + border: 1px solid #ddd; + border-radius: 5px; +} + +a { + color: #007bff; + text-decoration: none; +} +