Skip to content

Migration from youtube-dl

This guide helps you migrate from youtube-dl command-line tool to Pocat’s API-based approach.

  • Better reliability: 95%+ success rate with yt-dlp engine
  • API-first: RESTful endpoints for easy integration
  • Multiple engines: Fallback system ensures downloads work
  • Quality options: Granular control over video quality
  • Scalable: Handle multiple downloads efficiently

Before (youtube-dl):

Terminal window
youtube-dl "https://www.youtube.com/watch?v=VIDEO_ID"

After (Pocat API):

Terminal window
curl -X POST http://localhost:3333/v2/projects \
-H "Content-Type: application/json" \
-d '{
"title": "My Video",
"youtubeUrl": "https://www.youtube.com/watch?v=VIDEO_ID",
"userId": 1
}'

Before:

Terminal window
youtube-dl -f "best[height<=720]" URL

After:

Terminal window
curl -X POST http://localhost:3333/v2/projects \
-H "Content-Type: application/json" \
-d '{
"title": "720p Video",
"youtubeUrl": "URL",
"userId": 1,
"quality": "720p"
}'

Before:

Terminal window
youtube-dl -a urls.txt

After:

const urls = ['url1', 'url2', 'url3'];
const promises = urls.map(url =>
fetch('http://localhost:3333/v2/projects', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
title: `Video from ${url}`,
youtubeUrl: url,
userId: 1
})
})
);
await Promise.all(promises);
try {
const response = await fetch('/v2/projects', {
method: 'POST',
body: JSON.stringify(data)
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const result = await response.json();
} catch (error) {
console.error('Download failed:', error);
}
// Poll for download status
const checkStatus = async (projectId) => {
const response = await fetch(`/v2/projects/${projectId}`);
const project = await response.json();
return project.status;
};
  • Programmatic control: Full API access
  • Better error handling: Detailed error responses
  • Multiple download engines: Automatic fallback
  • Web integration: Easy to integrate in web apps
  • Monitoring: Track download progress and status