✨ Ready! Paste a YouTube URL and click “Inspect media” to preview AnyDownload actions.
YouTube prototype
Inspect a YouTube URL, then choose the download type you want.
This page now matches your AnyDownload direction. Instead of only fetching auto captions, the UI demonstrates a local-first workflow for MP4, MP3, subtitles, captions, transcripts, and thumbnails powered by yt-dlp metadata.
import youtubedl from 'yt-dlp-exec';
export default async function handler(req, res) {
const { url, mode, format } = JSON.parse(req.body || '{}');
try {
if (mode === 'inspect') {
const info = await youtubedl(url, {
dumpSingleJson: true,
skipDownload: true,
});
return res.status(200).json({
title: info.title,
thumbnail: info.thumbnail,
formats: info.formats,
subtitles: info.subtitles,
automaticCaptions: info.automatic_captions,
});
}
// Example follow-up branch:
// choose a format or subtitle mode and stream the output directly.
return res.status(200).json({ ok: true });
} catch (error) {
return res.status(500).json({ error: 'Failed to process download request.' });
}
}
Deployment notes
Important constraints captured on the page.
- Serverless time and memory limits can break large downloads.
- Streaming is better than save-then-send for most media responses.
- A bundled yt-dlp binary strategy is safer than assuming Python exists in deployment.
- The product direction is local-first, so files stay with the user instead of living in a database.