youtubeDl(videoUrl, format: `best[$resolution]`, out: `sybil-stallone-video-%(id)s-%(resolution)s.%(ext)s`, , (err, info) => if (err) console.error(err); res.status(500).send('Error downloading video'); else const videoPath = `sybil-stallone-video-$info.id-$resolution.$info.ext`; res.download(videoPath, (err) => if (err) console.error(err); else fs.unlinkSync(videoPath);
fetch('/api/videos') .then((response) => response.json()) .then((videos) => videos.forEach((video) => const videoElement = document.createElement('LI'); videoElement.innerHTML = ` <a href="$video.url">$video.title</a> <button class="download-button" data-url="$video.url">Download</button> `; videoList.appendChild(videoElement); ); );