PHP script for downloading videos from youtube; also parsing youtube feed into RSS enclosures for podcatchers
Switch branches/tags
Clone or download
jeckman Merge pull request #338 from Cerdic/fix/decipher-dictionnary
Fix Decipher dictionary was not found error when javascipt use bracke…
Latest commit 61a1719 Aug 28, 2018
Permalink
Failed to load latest commit information.
.github Move the app version in the web interface footer Jul 19, 2017
cache Merge branch 'master' into Bootstrap337 Jul 28, 2017
config Add more files for php-cs-fixer Jan 2, 2018
css improve Web UI Sep 13, 2017
fonts template upgraded to bootstrap 3.3.7 Jul 26, 2017
js template upgraded to bootstrap 3.3.7 Jul 26, 2017
logs Create new logs folder, App and Controller startup are logged for debug Aug 22, 2017
src Merge pull request #338 from Cerdic/fix/decipher-dictionnary Aug 28, 2018
templates Search also in adaptive format for a specific itag Oct 14, 2017
tests added test for the getDuration method May 24, 2018
.gitattributes add composer.lock to .gitattributes Jan 19, 2018
.gitignore add composer.lock Jan 19, 2018
.htaccess * Added support for caching of files Nov 19, 2017
.php_cs.dist Add more files for php-cs-fixer Jan 2, 2018
.travis.yml Clean up .travis.yml Jan 19, 2018
CHANGELOG.md Update CHANGELOG.md Feb 9, 2018
CONTRIBUTING.md Update CHANGELOG.md and CONTRIBUTING.md Jan 2, 2018
LICENSE Add LICENSE May 29, 2017
README.md Merge pull request #286 from Adrixan/master Jan 2, 2018
bootstrap.php bump year Jan 2, 2018
composer.json Update CHANGELOG and fix code styling Feb 8, 2018
composer.lock add composer.lock Jan 19, 2018
download.php bump year Jan 2, 2018
feed.php bump year Jan 2, 2018
getimage.php bump year Jan 2, 2018
getvideo.php bump year Jan 2, 2018
index.php bump year Jan 2, 2018
phpunit.xml.dist Create unittest with PHPUnit May 24, 2017
ytdl.user.js bump year Jan 2, 2018

README.md

YouTube Downloader

Author Source Code Software License Build Status Gitter

PHP Library with Web UI to download videos from YouTube.

Support for Cipher signature

YouTube Downloader finally supports YouTube videos with a cipher signature too. 🎉 Please note that this functionallity is hidden behind a config flag because it downloads javascript code from a 3rd party (YouTube) server and interprets it. This MAY harm your server, if the 3rd party server delivers malicious code.

You can activate this by the the enable_youtube_decipher_signature to true in /config/custom.php. If the file don't exists you can simple create it or copy from /config/default.php.

<?php
// in config/custom.php
return [
    'enable_youtube_decipher_signature' => true,
];

Goals

  • Create a library that delivers data and download links for youtube videos.
  • Create a UI for downloading the videos.
  • Have no external dependencies to other services.
  • Have no external dependencies to other libraries in production.
  • Installation should be foolproof (unzip on server and go)

Requirements

You must fit at least this requirements to use YouTube-Downloader:

  • PHP >= 5.6
  • Web server (Apache/Nginx/PHP built-in)

Installation

There are multiple ways to set up YouTube-Downloader

ZIP Download

Git

  • Clone the code on your server with $ git clone https://github.com/jeckman/YouTube-Downloader.git
  • Open the folder with your browser

Composer

The library code can be used in other projects via Composer.

The code isn't available on packagist.org at the moment, so you must add the repository in your composer.json. Your composer.json should look like this

{
	"require": {
		"jeckman/YouTube-Downloader": "dev-master"
	},
	"repositories": [
		{"type": "vcs", "url": "https://github.com/jeckman/YouTube-Downloader"}
	]
}

Now install the dependencies with $ composer update

Usage

You can manually visit a web form (the index.php file), enter a YouTube video id, and get in return a list of links showing the various formats in which that video can be downloaded. You can simply choose "save link as" or the equivalent to download the file.

Second, you can directly target the getvideo.php script, passing in a videoID and preferred format, and you will get redirected to the file itself.

http://example.com/yt/getvideo.mp4?videoid=GkvvH8pBoTg&format=ipad

Potential formats:

  • best = just give me the largest file / best quality
  • free = give the largest version including WebM, lower priority to FLV
  • ipad = ignore WebM and FLV, look for best MP4 file

You can also pass in a specific format number, if you know it.

Note this approach, because it redirects you to the file itself, currently bypasses the proxy option, so if your browser/server setup requires the proxy to work these will fail.

Feed subscription

You can subscribe both to YouTube channels and users via RSS. Feeds can be generated in the formats listed above.

Generating a feed for a YouTube channel works as follows:

http://example.com/yt/feed.php?channelid=UChELZ_JMGNYuxObfrXoER6A&format=best

To generate a feed for a YouTube user:

http://example.com/yt/feed.php?user=heisenewsticker&format=free

The generated feed is a standard RSS feed and can be subscribed to in any feed reader.

Upgrading

ZIP Download

Git

$ git remote update
$ git pull origin master

Composer

$ composer update

Contributing

You can help making this project better by reporting bugs or submitting pull requests. Please see our contributing guideline for more information.