Monday, April 26, 2021

Quick, Easy "youtube-dl" app install on Ubuntu 21.04

NOTICE; this is not revelant any longer; replaced by a nifty utility  yt-dlp/yt-dlp: A youtube-dl fork with additional features ... - GitHub

 

 

 I just installed the latest Ubuntu 21.04 OS on my 3+ year old dell precision 7520;

When I tried to go to the original URL I had for youtube-dl app, it didn't work, page not found;

It appears that is is now hosted on github here: http://ytdl-org.github.io/youtube-dl/download.html

This download page is where I got 3 of these 4 cmdlines that install and configure youtube-dl to work properly on my new Ubuntu 21.04 OS install.

These 4 cmds worked for me:

$ sudo apt install curl

$ sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl

$ sudo chmod a+rx /usr/local/bin/youtube-dl

$ sudo ln -s /usr/bin/python3 /usr/local/bin/python    ;not specifically mentioned on this webpage; but without it, I only get an error for python.


$ sudo apt install curl    ;not installed by default;

... <output deleted> ...

$ sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl

... <output deleted> ...

$ sudo chmod a+rx /usr/local/bin/youtube-dl

$ sudo ln -s /usr/bin/python3 /usr/local/bin/python

Without this 4th cmdline, I get this error on running youtube-dl app:

$ youtube-dl -F https://www.youtube.com/watch?v=FnVnIKTWhNs

/usr/bin/env: ‘python’: No such file or directory


Browse to youtube.com and search for <artist/songOfYourChoice>".

Select the video of the song you want to download from the search results list.

Copy the URL for that video and use the "youtube-dl -F <someURL>" cmdline to see the various options for downloading the mp4 video desired:

$ youtube-dl -F https://www.youtube.com/watch?v=FnVnIKTWhNs

... <output deleted> ...

$ youtube-dl -F https://www.youtube.com/watch?v=FnVnIKTWhNs | grep \(best\)

18           mp4        640x360    360p  228k , avc1.42001E, 24fps, mp4a.40.2 (44100Hz), 6.70MiB (best)

I can see that number 18 is the mp4 video I want;


$ cd Videos    ;so the mp4 file will go where I want and expect to find it;

$ youtube-dl -f 18 https://www.youtube.com/watch?v=FnVnIKTWhNs

... <output deleted> ...

Use "Ubuntu Software" to search for and install VLC, my favorite media player; this is a snap install.

Or just use the default video player; VLC is not required.

Now cd to the folder that contains this mp4 file and play it; I right-click the mp4 file and select "play with VLC".

NOTE: I own the original CD that this song was originally released on and I also have purchased this song from Apple iTunes/music; cost about $1.29 as I recall.

I include this post to help others get this utility installed and working with the minimum amount of frustration, which I encountered years ago until I discovered this website with the "CORRECT" install/configure steps.


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Here is all of the screen output from this install, performed on 26 April 2021.

NOTE: I have removed the hostname from this output;

$ sudo apt install curl

[sudo] password for Gladys: 

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

The following NEW packages will be installed:   curl

0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.

Need to get 170 kB of archives.

After this operation, 430 kB of additional disk space will be used.

Get:1 http://us.archive.ubuntu.com/ubuntu hirsute/main amd64 curl amd64 7.74.0-1ubuntu2 [170 kB]

Fetched 170 kB in 1s (309 kB/s)

Selecting previously unselected package curl.

(Reading database ... 151576 files and directories currently installed.)

Preparing to unpack .../curl_7.74.0-1ubuntu2_amd64.deb ...

Unpacking curl (7.74.0-1ubuntu2) ...

Setting up curl (7.74.0-1ubuntu2) ...

Processing triggers for man-db (2.9.4-2) ...


$ sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100     3  100     3    0     0      3      0  0:00:01 --:--:--  0:00:01     3

100     3  100     3    0     0      2      0  0:00:01  0:00:01 --:--:--     2

100   614  100   614    0     0    393      0  0:00:01  0:00:01 --:--:--   393

100 1795k  100 1795k    0     0   986k      0  0:00:01  0:00:01 --:--:-- 8511k


$ sudo chmod a+rx /usr/local/bin/youtube-dl

$ sudo ln -s /usr/bin/python3 /usr/local/bin/python


$ youtube-dl -F https://www.youtube.com/watch?v=FnVnIKTWhNs

[youtube] FnVnIKTWhNs: Downloading webpage

[youtube] FnVnIKTWhNs: Downloading player fa244a41

[info] Available formats for FnVnIKTWhNs:

format code  extension  resolution note

249          webm       audio only tiny   51k , webm_dash container, opus @ 51k (48000Hz), 1.50MiB

250          webm       audio only tiny   68k , webm_dash container, opus @ 68k (48000Hz), 2.01MiB

140          m4a        audio only tiny  129k , m4a_dash container, mp4a.40.2@129k (44100Hz), 3.79MiB

251          webm       audio only tiny  134k , webm_dash container, opus @134k (48000Hz), 3.95MiB

160          mp4        256x144    144p    8k , mp4_dash container, avc1.4d400c@   8k, 24fps, video only, 247.02KiB

278          webm       256x144    144p   20k , webm_dash container, vp9@  20k, 24fps, video only, 628.23KiB

394          mp4        256x144    144p   22k , mp4_dash container, av01.0.00M.08@  22k, 24fps, video only, 676.89KiB

133          mp4        426x240    240p   12k , mp4_dash container, avc1.4d4015@  12k, 24fps, video only, 376.35KiB

395          mp4        426x240    240p   27k , mp4_dash container, av01.0.00M.08@  27k, 24fps, video only, 814.30KiB

242          webm       426x240    240p   36k , webm_dash container, vp9@  36k, 24fps, video only, 1.06MiB

134          mp4        640x360    360p   20k , mp4_dash container, avc1.4d401e@  20k, 24fps, video only, 604.38KiB

396          mp4        640x360    360p   63k , mp4_dash container, av01.0.01M.08@  63k, 24fps, video only, 1.86MiB

243          webm       640x360    360p   71k , webm_dash container, vp9@  71k, 24fps, video only, 2.10MiB

135          mp4        854x480    480p   28k , mp4_dash container, avc1.4d401e@  28k, 24fps, video only, 852.37KiB

244          webm       854x480    480p   76k , webm_dash container, vp9@  76k, 24fps, video only, 2.23MiB

397          mp4        854x480    480p   95k , mp4_dash container, av01.0.04M.08@  95k, 24fps, video only, 2.78MiB

136          mp4        1280x720   720p   43k , mp4_dash container, avc1.4d401f@  43k, 24fps, video only, 1.27MiB

398          mp4        1280x720   720p  129k , mp4_dash container, av01.0.05M.08@ 129k, 24fps, video only, 3.79MiB

247          webm       1280x720   720p  238k , webm_dash container, vp9@ 238k, 24fps, video only, 6.99MiB

137          mp4        1920x1080  1080p  152k , mp4_dash container, avc1.640028@ 152k, 24fps, video only, 4.47MiB

399          mp4        1920x1080  1080p  201k , mp4_dash container, av01.0.08M.08@ 201k, 24fps, video only, 5.89MiB

248          webm       1920x1080  1080p  442k , webm_dash container, vp9@ 442k, 24fps, video only, 12.94MiB

18           mp4        640x360    360p  228k , avc1.42001E, 24fps, mp4a.40.2 (44100Hz), 6.70MiB (best)


Here's an alternate output showing only the "best" video in this output list

$ youtube-dl -F https://www.youtube.com/watch?v=FnVnIKTWhNs |grep \(best\)


$ cd Videos


$ youtube-dl -f 18 https://www.youtube.com/watch?v=FnVnIKTWhNs[youtube] FnVnIKTWhNs: Downloading webpage

[download] Destination: Van Morrison - Someone Like You (Audio)-FnVnIKTWhNs.mp4

[download] 100% of 6.70MiB in 00:00

~/Videos/Apr2012a$ cd ..

~/Videos$




No comments:

Post a Comment