PHP powered alternative for youtube-dl

v2.1.1 2020-10-17 13:37 UTC

This package is auto-updated.

Last update: 2020-11-25 16:30:42 UTC



This project was inspired by a very popular youtube-dl python package: (which has been very recently removed from github)

Yes, there are multiple other PHP-based youtube downloaders on the Internet, but most of them haven't been updated in years, or they depend on youtube-dl itself.

Pure PHP-based youtube downloaders that work, and are kept-up-to date just do not exist.

This script does not depend on anything other than cURL. No Javascript interpreters, no calls to shell... nothing but pure PHP with no heavy dependencies either.

That's all there is to it!

⚠️ Legal Disclaimer

This program is for personal use only. Downloading copyrighted material without permission is against YouTube's terms of services. By using this program, you are solely responsible for any copyright violations. We are not responsible for people who attempt to use this program in any way that breaks YouTube's terms of services.

Demo App

This may not work at all times, because YouTube puts a short ban on the server if it receives too many requests from it.

Deploy your own App

on Heroku:


Create a FREE account first if you do not yet have one:


Recommended way of installing this is via Composer:

composer require athlon1600/youtube-downloader

Run locally:

php -S localhost:8000 -t vendor/athlon1600/youtube-downloader/public


use YouTube\YouTubeDownloader;

$yt = new YouTubeDownloader();

$links = $yt->getDownloadLinks("");


Typical output:

array(34) {
  array(3) {
    string(818) "
    string(23) "mp4, video, 360p, audio"
  array(3) {
    string(783) "
    string(23) "mp4, video, 720p, audio"
  array(3) {
    string(977) "
    string(18) "webm, video, 2160p"

If you are looking for links that include both video and audio in a single file, then filter down that list to look for links that contain both video and audio inside its format property.

Other Features

  • Stream YouTube videos directly from your server:
$youtube = new \YouTube\YouTubeStreamer();

How does it work

A more detailed explanation on how to download videos from YouTube will be written soon. For now, there is this:

Other Links

To-do list

  • Add ability to solve YouTube Captcha and avoid HTTP 429 Too Many Requests errors.
  • Add ability to download video and audio streams separately, and merge the two together using ffmpeg. Just like youtube-dl does!
  • Optional command that finds ALL video formats.
  • Fetch additional metadata about the video without using YouTube API.