Downloading YouTube videos

A DDG search sent me to ‘3 Easy Ways to Download YouTube Videos in Ubuntu and Other Linux Distributions’ in It’s Foss, last edited in May, 2023. In my Ubuntu 20.04 Firefox, I already had the Video DownloadHelper extension. I made sure it and its companion app had the latest updates. I very rarely want to download videos but I have successfully used that app in the past. This time, the toolbar icon remained uncoloured and clicking on it showed ‘No media to process in the current tab’. On my U22.04 laptop the results (or, rather, lack of results) were the same. I then tried the CLI method. I ran ‘sudo apt install yt-dlp’ and it is supposedly installed. However, if it is installed, I can’t find where it is so I can execute and run it. Running the command to download a video doesn’t seem to do anything as things are now. In a terminal, typing ‘find yt-dlp’ brings ‘No such file or directory’. Any suggestions?
When first typing this post, I enclosed the command in angle brackets (less than and greater than), as I have seen commands shown that way. I should have more closely checked that the post field was the same as the compose field; it was not. Sorry for any confusion.

I ran the CLI install and then issued the command yt-dlp and it ran.

pdecker@dpd-pop-os:~$ yt-dlp
Usage: yt-dlp [OPTIONS] URL [URL…]

yt-dlp: error: You must provide at least one URL.
Type yt-dlp --help to see a list of all options.
pdecker@dpd-pop-os:~$ which yt-dlp
/usr/bin/yt-dlp

The second command is the which command. It shows where it was installed: /usr/bin/yt-dlp.

Maybe you need to exit and start a new terminal session? I didn’t but maybe under Ubuntu 20.04 it installs slightly differently.

@pdecker
The command is “sudo yt-dlp --format mp4 https://www.youtube.com/watch?v=wu4VV54ZcFo” I belive that downloaded Bon Jovi Living On A Prayer.

1 Like

I can’t think of a single good reason to use sudo to run what is essentially a python script…

I usually run it from my ~/bin/ folder - and install it using pip or pip3…

sudo apt install python3-pip
pip install yt-dlp
╭─x@fenrix ~  
╰─➤  pip install yt-dlp       
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: yt-dlp in /usr/lib/python3/dist-packages (2022.4.8)
╭─x@fenrix ~  
╰─➤  yt-dlp
Usage: yt-dlp [OPTIONS] URL [URL...]

yt-dlp: error: You must provide at least one URL.
Type yt-dlp --help to see a list of all options.
╭─x@fenrix ~  
╰─➤  which yt-dlp                                                                                       2 ↵
/usr/bin/yt-dlp

I don’t know how it can create /usr/bin/yt-dlp - but somehow it does without sudo…

The above works on Pop!_OS - but - not Raspbian 12 (i.e. Debian Bookworm for ARM64). **

That’s the ONLY method I use for downloading videos - but - I most only use it to rip music that I can’t find anywhere else (it’s usually my last port of call where I can’t get a “local copy for archive purposes” from other avenues (e.g. bandcamp, pir8bay):

yt-dlp --extract-audio --audio-quality 0 --audio-format mp3 $URL

and then only - if the sound quality is reasonable - sometimes it’s pretty shonky quality. Exceptions are when professional radio stations like KEXP in Seattle, and RRR-FM in Melbourne - record live sessions - the sound quality is excellent (I highly recommend KEXP).

@pdecker @Daniel_Phillips I tried installing yt-dlp again and couldn’t find it in /usr/bin. I went back to the terminal and was prompted to install it as a snap. When I went to /usr/bin/snap it wouldn’t open. Before spending any more time checking that it was installed, I thought I’d see if the video would open now. I couldn’t immediately find the video I’d viewed in YouTube, but opened one from the distrotube channel as a test. That’s when I noticed that the Video DownloadHelper extension button was now coloured. Sure enough, that extension was working and I downloaded the video. (I don’t know why it works now but not before, when I’d only been doing anything using the other method in the meantime. Maybe it depends on the particular video?) I had a little trouble opening and playing it, before I found that the app creates its own folder in the Home directory. I don’t remember navigating to it that way before, but it seems it’s always worked that way. I was also surprised that it automatically opened in the native Gnome Totem video player, which I’d never even looked at before. When I went to put it in VLC, I saw that my playlist was empty. I guess when I upgraded the OS, I should have seen if I could bring my VLC settings and playlist over to the new system. Anyway, after all that, I don’t have time now to continue with trying a CLI installation. I’ll get back to that later, and also look again for the video I wanted to save and see if that one is different than the test download. I’m a little confused by the terminal commands that were shown. I’m not sure what should be modified to match my particular case. But I appreciate the help, even if it’s a struggle to follow the directions. Thank you.

1 Like

Doesn’t surprise me at all. I use Clip-Grab. It is now a deb file and available in Arch too. I always add this PPA when I setup my Linux Mint computers.
sudo add-apt-repository ppa:xtradeb/apps
sudo apt update
sudo apt install clipgrab

A lot of people would say, that they don’t trust PPA installs, well unfortunately if you want a certain app and like me hate Snap packages and Flatpaks? You’re using a Ubuntu based system? Then the only way is via a PPA. Clipgrab has yt-dlp at it’s front end, so it’s good at bringing down high quality video from the likes of YouTube, BBC i player, Daily-motion and other sites too, which I cannot mention. Not that I do not know how to mention them, or lost the way to communicate. Let’s just say they are shady.

1 Like

Yup. I was testing the install to see if it worked immediately after install. Some apps install to a directory not in your path and you need a new shell before they become available, or for some other reason.

Just wanted to test it for myself and it worked. I didn’t really attempt to download anything, I located where it was installed for the OP.

I emerge yt-dlp with Gentoo packages, when I am in my user account, Gentoo will only run yt-dlp with sudo, unless I switch to the root account.

2 Likes

@nevj @daniel.m.tripp
Not feeling well today, fellow Fossers, I think I may have a touch of the old flu bug, it is running rampant in our part of the World!!!

1 Like

Just stay over your side of the big paddock mate :smiley: - which reminds me - I must be just about due for my annual flu shot…

1 Like

Make sure it is not covid or rsv.
Try to stay overheated, it helps stop viruses multiplying.
Get well soon

1 Like

@pdecker, @Daniel_Phillips, @clatterfordslim I returned to the video downloading problem on my Ubuntu 22.04 laptop. I started with Method 1 in Abhishek’s article, the Video DownloadHelper browser extension, since that one worked before. It’s called a Firefox extension, but it works just the same in Vivaldi after downloading it from the Chrome store. I found that YouTube videos opened by clicking links to them wouldn’t download, but if I first went to YouTube and found the same video there, then it would. This was with another video from the distrotube channel and a couple from It’s Foss. The film I originally wanted to save for watching again later won’t download for me no matter what I do. It’s marked as ‘Sponsored’. I wonder if that means that only copies that have been purchased can be downloaded? So maybe nothing that was suggested for using a terminal, the article’s Method 3, would have worked anyway. Somewhat encouraged, I tried installing yt-dlp on the laptop and seeing if I could download the vids the extension had worked for. I’m still confused by the CLI. No matter how I tried following the various suggestions, I couldn’t get it to work. But @clatterfordslim’s mention of ClipGrab reminded me that was the article’s Method 2. I followed Abhishek’s directions to download the app from the webpage. It’s installled in the Downloads folder of my Home directory, but I haven’t found how to access it anywhere else. Furthermore,
when I do open it within the file manager, it doesn’t work. So I tried installing it with a terminal, as suggested here. Works like a charm. As soon as I ran the commands it showed up in the Applications Menu. I put the icon on my desktop. If I thought I’d be using it more than rarely, I could have it in the dock, always in sight. So thanks for all the suggestions. @Daniel_Phillips, I hope you’re feeling better.

2 Likes

Going to the Doctor today!!! Thanks1!!

@pdecker, @Daniel_Phillips, @clatterfordslim, Update: After taking a break, I thought I’d try one more time to save the film I wanted. I’d been wondering if perhaps the size of the files made a difference; the one I wanted is >1.5 hr. and the successful test vids were all <.5 hr. This time, when I opened YouTube from its shortcut on Vivaldi on the Ubuntu 22.04 laptop, the same as I had done before, a pop-up warned me that it looked like I was using an ad-blocker (true), and I had to remove it before I could view videos. Since I’d viewed many YouTube videos with the same browser setup, I ignored the warning and proceeded to the film I’d watched before. While it was playing I opened the context menu and clicked on copy URL. Then I opened the ClipGrab shortcut on the desktop and pasted the URL. Now, it seemed to be working. When asked where to put it, I chose a Dropbox Videos folder. It indicated that it had been done. So I opened that DB folder and saw it there. When asked how I wanted to open it, I chose VLC. VLC opened with that file selected. I clicked Play and the film began. So even though I don’t understand what’s going on and why sometimes things work and sometimes they don’t, I’m happy now. Maybe at some time I’ll explore running commands but for now I’m satisfied with what’s working. Thanks again for all the help.

1 Like