[youtube-dl] Download files from youtube.com or other video platforms

Eg:
Code:
$ ./youtube-dl-20230925 -v -F 'https://www.bbc.co.uk/sounds/play/m001r1s4'
[debug] System config: [u'--prefer-ffmpeg']
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'-F', u'https://www.bbc.co.uk/sounds/play/m001r1s4']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2023.09.25 [00ef748cc] (single file build)
[debug] ** This version was built from the latest master code at https://github.com/ytdl-org/youtube-dl.
[debug] ** For support, visit the main site.
[debug] Python 2.7.18 (CPython i686 32bit) - Linux-4.4.0-210-generic-i686-with-Ubuntu-16.04-xenial - OpenSSL 1.1.1w  11 Sep 2023 - glibc 2.15
[debug] exe versions: avconv 4.3, avprobe 4.3, ffmpeg 4.3, ffprobe 4.3
[debug] Proxy map: {}
[bbc.co.uk] m001r1s4: Downloading video page
[bbc.co.uk] m001r1s4: Downloading playlist JSON
[bbc.co.uk] p0ghl676: Downloading media selection JSON
[bbc.co.uk] p0ghl676: Downloading MPD manifest
[bbc.co.uk] p0ghl676: Downloading MPD manifest
[bbc.co.uk] p0ghl676: Downloading m3u8 information
[bbc.co.uk] p0ghl676: Downloading m3u8 information
[bbc.co.uk] p0ghl676: Downloading MPD manifest
[bbc.co.uk] p0ghl676: Downloading MPD manifest
[bbc.co.uk] p0ghl676: Downloading m3u8 information
[bbc.co.uk] p0ghl676: Downloading m3u8 information
[info] Available formats for p0ghl676:
format code                                extension  resolution note
mf_akamai_nonbidi-audio_eng_1=48000-0      m4a        audio only [en] DASH audio   48k , m4a_dash container, mp4a.40.5 (48000Hz)
mf_akamai_nonbidi-audio_eng_1=48000-1      m4a        audio only [en] DASH audio   48k , m4a_dash container, mp4a.40.5 (48000Hz)
mf_cloudfront_nonbidi-audio_eng_1=48000-0  m4a        audio only [en] DASH audio   48k , m4a_dash container, mp4a.40.5 (48000Hz)
mf_cloudfront_nonbidi-audio_eng_1=48000-1  m4a        audio only [en] DASH audio   48k , m4a_dash container, mp4a.40.5 (48000Hz)
mf_akamai_nonbidi-audio_eng_1=96000-0      m4a        audio only [en] DASH audio   96k , m4a_dash container, mp4a.40.5 (48000Hz)
mf_akamai_nonbidi-audio_eng_1=96000-1      m4a        audio only [en] DASH audio   96k , m4a_dash container, mp4a.40.5 (48000Hz)
mf_cloudfront_nonbidi-audio_eng_1=96000-0  m4a        audio only [en] DASH audio   96k , m4a_dash container, mp4a.40.5 (48000Hz)
mf_cloudfront_nonbidi-audio_eng_1=96000-1  m4a        audio only [en] DASH audio   96k , m4a_dash container, mp4a.40.5 (48000Hz)
mf_akamai_nonbidi-audio_eng=128000-0       m4a        audio only [en] DASH audio  128k , m4a_dash container, mp4a.40.2 (48000Hz)
mf_akamai_nonbidi-audio_eng=128000-1       m4a        audio only [en] DASH audio  128k , m4a_dash container, mp4a.40.2 (48000Hz)
mf_cloudfront_nonbidi-audio_eng=128000-0   m4a        audio only [en] DASH audio  128k , m4a_dash container, mp4a.40.2 (48000Hz)
mf_cloudfront_nonbidi-audio_eng=128000-1   m4a        audio only [en] DASH audio  128k , m4a_dash container, mp4a.40.2 (48000Hz)
mf_akamai_nonbidi-136-0                    mp4        audio only  136k , mp4a.40.2@128k
mf_akamai_nonbidi-136-1                    mp4        audio only  136k , mp4a.40.2@128k
mf_cloudfront_nonbidi-136-0                mp4        audio only  136k , mp4a.40.2@128k
mf_cloudfront_nonbidi-136-1                mp4        audio only  136k , mp4a.40.2@128k
mf_akamai_nonbidi-audio_eng=320000-0       m4a        audio only [en] DASH audio  320k , m4a_dash container, mp4a.40.2 (48000Hz)
mf_akamai_nonbidi-audio_eng=320000-1       m4a        audio only [en] DASH audio  320k , m4a_dash container, mp4a.40.2 (48000Hz)
mf_cloudfront_nonbidi-audio_eng=320000-0   m4a        audio only [en] DASH audio  320k , m4a_dash container, mp4a.40.2 (48000Hz)
mf_cloudfront_nonbidi-audio_eng=320000-1   m4a        audio only [en] DASH audio  320k , m4a_dash container, mp4a.40.2 (48000Hz) (best)
$
 
It's downloaded the first one so far, but they're coming in backwards. That's a pain if they don't all make it by the time I head off tomorrow for the weekend! (It's the MP3 conversion that's taking the time)
 
It failed:
Code:
04/10/2023 23:38:33 - [download] Downloading video 5 of 10
04/10/2023 23:38:33 - [bbc.co.uk] m001r2wr: Downloading video page
04/10/2023 23:38:37 - [bbc.co.uk] m001r2wr: Downloading playlist JSON
04/10/2023 23:38:41 - [bbc.co.uk] p0ghl3wp: Downloading media selection JSON
04/10/2023 23:38:56 - Caught error: ERROR: Unable to download JSON metadata: <urlopen error [Errno 8] _ssl.c:499: EOF occurred in violation of protocol> (caused by URLError(SSLError(8, '_ssl.c:499: EOF occurred in violation of protocol'),))
04/10/2023 23:38:56 - -code 1 -level 0 -errorinfo {{} /mod/webif/plugin/qtube/queue.hook 29} -errorcode {CHILDSTATUS 26666 1}

Use a real computer...
I guess I'll have to, just for expediency.
 
For Uncharted, use either https://www.bbc.co.uk/programmes/m001qw8x/episodes/player for all available episodes or (eg) https://www.bbc.co.uk/sounds/play/m001r1s4 for episode 10. https://www.bbc.co.uk/programmes/m001qw8x should probably be treated like one of these two depending on the --no-playlist option. And that still isn't in the new version.
I've been wondering how to download complete series for a while so thanks for the pointer. How does it work when there a multiple pages for a series? Do I have to submit the link for each page?
 
What does this mean?:

Code:
~$ youtube-dl https://www.bbc.co.uk/programmes/m001qw8x/episodes/player --verbose
/usr/local/bin/youtube-dl: line 1: syntax error near unexpected token `newline'
/usr/local/bin/youtube-dl: line 1: `<h1>Access denied</h1>'
 
I've been wondering how to download complete series for a while so thanks for the pointer. How does it work when there a multiple pages for a series? Do I have to submit the link for each page?
Answered my own question with some testing. I submitted the link for each BBC Sounds 'Available Now' page for a series with multiple pages and download was successful.

Just now testing for BBC iPlayer and the initial log shows it is working as required.

Edit: Series 1 of The Young Ones downloaded successfully from iPlayer.
 
Last edited:
What does this mean?
Possibly something's corrupt and needs reinstalling. What does ls -l /usr/local/bin/youtube-dl report, and if it's about 1000 bytes what about cat /usr/local/bin/youtube-dl ? What version is it and how did you install it? It's normally in /usr/bin rather than /usr/local/bin .
 
That's been on my to-do list for ages. So, I finally had to get round to actually doing it.
This is for use on an Ubuntu/Mint PC (making sure you have the zip, unzip, and wget packages installed first), not on the Humax.
There may or may not be a better way, and it generates the zipped version rather than the "100s of files" version, but it works for me and seems reasonably robust:
Code:
#!/bin/bash
dir=$(mktemp -d)
(
 cd "$dir" || exit
 wget https://github.com/ytdl-org/youtube-dl/archive/refs/heads/master.zip
 unzip master.zip
 (
  cd youtube-dl-master || exit
  mv youtube_dl/__main__.py .
  cmd="sed -i s/2021.12.17/$(date +%Y.%m.%d)/ youtube_dl/version.py"
  $cmd
  zip ../youtube-dl -r __main__.py youtube_dl
 )
 echo "#!/usr/bin/env python" >youtube-dl
 cat youtube-dl.zip >>youtube-dl
 chmod +x youtube-dl
 rm -r youtube-dl-master youtube-dl.zip master.zip
 sudo mv youtube-dl /usr/local/bin/
)
rmdir "$dir"
If you need to add in any file replacements (patches etc.), then do those before the zip command.
Copy this to something like /usr/local/bin/ytdlupdate and don't forget to chmod +x it. Then just run ytdlupdate. It's probably advisable to clear any old junk relating to your previous YT-DL setup first, but as the instructions are apparently unavailable, I don't know where stuff has been put.
 
So far as I know the "YT-DL setup" is simply that file downloaded to /usr/local/bin.

I guess I was rather naive about the installation, but I was in a hurry and simply did what I thought the Github page told me (ie curl & chmod). There were no other instructions so far as I could see, so if that wasn't enough then the Github needs revising!
 
Oh, if you didn't have a previous installation then it will just be overwritten by the version my script creates.
 
What does this mean?:
...

There is a glitch at the moment because the German hoster of the YT files referenced from the GH pages has been made to withdraw the site. As a result it is more difficult to download the 2021.12 version that no longer works on many sites (the version distributed to CF users is derived from newer code).

Someone who wanted to raise an issue about this in the GH tracker is first directed to the 'THIS MEANS YOU!' issue, from where the nightly release page, from which the latest working version can be downloaded, is linked, and should then find issue 32495 where the above situation is explained.

... they're coming in backwards

From the manual/help:
Code:
       --playlist-reverse
              Download playlist videos in reverse order
 
August 9, 2023
Hosting provider Uberspace has taken down the website of YouTube-ripping software, youtube-dl. The removal is the result of a German court order in a copyright infringement lawsuit, filed by Sony, Warner and Universal. While Uberspace didn't host the open source software, it was held responsible for the website linking to the software hosted on developer platform GitHub.

censortube
In 2020, the RIAA infuriated many players in the open source community by targeting YouTube-ripping tool, youtube-dl.
The RIAA sent a takedown notice to GitHub, claiming that the software bypassed technological protection measures, in violation of the DMCA.
GitHub initially complied but later changed course. After consulting legal experts, including those at the EFF, it restored the youtube-dl repository and launched a million-dollar defense fund to assist developers in similar disputes.

Targeting youtube-dl’s Host​

This episode was a massive setback for the music industry, which had been fighting stream-ripping tools for years. However, instead of laying down their arms, Sony, Warner and Universal went after Uberspace, youtube-dl’s website hosting company in Germany.
A German court previously ruled that stream-ripping software bypasses YouTube’s ‘rolling cipher’ download protection. This is seen as a circumvention of technical protection measures, a violation of intellectual property law in Europe.
Earlier this year this line of reasoning was also adopted by the district court of Hamburg. While the open source youtube-dl software is hosted on GitHub, Uberspace was held liable as the host of the youtube-dl.org website because it linked to the developer platform.
In its defense, Uberspace argued that the protection can be circumvented using any regular web browser and in any case, the youtube-dl software has plenty of legal uses. These arguments failed to sway the court.
The court recognized that YouTube’s rolling cipher protection is far from perfect but concluded that it’s good enough to signal to average users that downloading content from YouTube is not permitted.
“[T]he average user must recognize that YouTube content, unlike media content on other websites, cannot be downloaded with a simple right-click and must be aware that this is achieved using technology on YouTube and that youtube-dl ‘overrides’ this protection. It is therefore to be assumed that the average user acts in bad faith,” the Hamburg Court wrote.

Ban Enforced​

The ruling was published in March but Uberspace wasn’t required to take action right away. The hosting company decided to appeal, which meant that the youtube-dl.org site remained online, unless the music companies posted a €20,000 bond.
Initially, it didn’t appear that the labels would enforce the order, but that changed a few days ago. The plaintiffs informed Uberspace that they had posted the security, leaving the company no other choice than to take the site offline.
Speaking with TorrentFreak, Uberspace owner Jonas Pasche says that his hands are tied. Failure to comply with the order would either result in a massive fine, or worse, a prison sentence.
“I received that information from the plaintiff’s side on July 27, with proof that they did the security deposit at a bank. So I no longer have a choice but to follow the judgment. Otherwise, I would face a fine of €250,000 or jail time,” Pasche notes.


For several days, people who visited youtube-dl’s website saw a blocking notice instead, which is shown above. At the time of writing, the website doesn’t load at all.

Appeal ‘Censorship’ Order​

Uberspace will continue the legal battle and is prepared to fight the order up to the highest court possible. If the appeal is successful, Pasche will gladly unblock the site.
“We are confident that a higher court will overturn the judgment of the Hamburg Regional Court, so we will be able to unblock the site as soon as this happens,” he says.
Uberspace is not the website’s domain registrar, so youtube-dl may yet decide to point its domain elsewhere. For now, that hasn’t happened. The software remains available on GitHub where it also has a dedicated website.
The hosting company previously told us that the Hamburg court’s ‘devastating’ order opens the door to privatized censorship, citing this threat as one of the main reasons to fight back.
“The consequences of this will be that hosting providers receiving complaints will most likely kick out their customers without a court ruling, for things that might be perfectly legal,” Pasche said at the time.
“This is a shameful day for the freedom of speech. It’s paving the way for privatized censorship. Do we as a society really want this? We strongly believe we’re on the right side of history here.”
 
the German hoster of the YT files referenced from the GH pages has been made to withdraw the site.
I noticed that when I tried to go to the youtube-dl home page, but when I found it on Github I thought that would be OK!
 
That's been on my to-do list for ages. So, I finally had to get round to actually doing it.
This is for use on an Ubuntu/Mint PC...
That seemed to work, but now:
Code:
~$ youtube-dl https://www.bbc.co.uk/programmes/m001qw8x/episodes/player --verbose
/usr/bin/env: ‘python’: No such file or directory
~$
 
Back
Top