"patches, and patches for the patches"
This commit is contained in:
parent
04f656c2c0
commit
b8c9fca4b6
1 changed files with 1 additions and 19 deletions
20
script.js
20
script.js
|
@ -21,29 +21,11 @@ document.getElementById('search-button').addEventListener('click', async () => {
|
||||||
listItem.innerHTML = `
|
listItem.innerHTML = `
|
||||||
<strong>${video.title}</strong> (${video.views} views) by ${video.author}
|
<strong>${video.title}</strong> (${video.views} views) by ${video.author}
|
||||||
<br>
|
<br>
|
||||||
<a href="#" class="download-link" data-url="${video.url}">Download</a>
|
<a href="https://ubertuberbe.nodemixaholic.com/download?url=${encodeURIComponent(video.url)}" download="${video.title}" class="download-link" data-url="${video.url}">Download</a>
|
||||||
`;
|
`;
|
||||||
resultsList.appendChild(listItem);
|
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 = `${getRandomHex}.webm`; // You might want to set this dynamically
|
|
||||||
document.body.appendChild(a);
|
|
||||||
window.URL.revokeObjectURL(url);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching videos:', error);
|
console.error('Error fetching videos:', error);
|
||||||
alert('An error occurred while searching for videos.');
|
alert('An error occurred while searching for videos.');
|
||||||
|
|
Loading…
Reference in a new issue