28

I have downloaded youtube-dl and the video download is complete, but when I search for the video, I can't seem to find it.

Can anyone help?

2
  • Have you tried downloading the videos in the "/home/user/Videos" folder, I think dash can be configured to check it out. Maybe it won't appear in Dash until you actually play it once.
    – userDepth
    May 4, 2016 at 1:15
  • I don't have enough rep to give the correct answer but anyway if you do ls -ltr in . and don't see it, it is because the file is created with the date it was uploaded to youtube, not the current date. So the file will be in the middle of all the other junk in this dir. So do ls -l *mp4 or whatever and maybe then you will see it. Jan 3, 2022 at 7:22

6 Answers 6

49

There are really two questions here:

1. Why does youtube-dl not feature in Dash?

This is because youtube-dl is run from a Terminal window only and does not come with icons, desktop files and the like. It is simply run from any Terminal window as follows:

youtube-dl [options] url [url...]

Details of the command line options can be easily seen by running the following command:

youtube-dl -h

Experiment a little to make youtube-dl work as you wish.

2. Where does Youtube-dl download YouTube files?

By default youtube-dl will download the files in the current working directory of the Terminal that you have opened. Usually this is your $HOME environment, but not always. This behavior can be modified in either of two ways:

  1. Use the -o option with youtube-dl to manually give a location for the downloaded files:

    youtube-dl -o "~/Desktop/%(title)s.%(ext)s" 'youtube file url'
    

    and of course substitute your actual url for 'youtube file url'. This example sends the completed download to your Desktop.

  2. Create a configuration file for youtube-dl as follows:

    touch ~/.config/youtube-dl.conf
    

    Then set a default download location in this file:

    --output "~/Desktop/%(title)s.%(ext)s"
    

    With this in place all downloaded files will automatically go to your Desktop.

References:

1
  • 1
    This worked for me, except in the first example, you need quotes around the path. The shell threw me this error without them: sh: 1: Syntax error: "(" unexpected
    – felwithe
    May 1, 2017 at 15:55
11

By default youtube-dl downloads files in the same directory from where you run the command. Mostly it's your home directory. If your name is Tom, then it is /home/Tom. To force it to download elsewhere you should use -o option; and to select quality of video, there is -f option. But how would you know the variety of quality of files. That is achieved by -F option. So combine all these in one shell script, make it executable and put it in a bin directory. And life becomes easy going.

I have written one script for my own use. It works fine. You don't have to worry where all those downloaded files are going. I've chosen ~/Videos directory for downloading YT videos; you can choose any other. Also replace 'Tom' by your name. Here is the script:

#!/bin/sh
answer=""
tput clear
tput cup 05 10
echo "Give the YouTube URL: \c"
# Here you paste the YT-video-URL by ctrl+shift+V
read answer
# The follwing command will display a list of video quality options to choose from
youtube-dl -F $answer
echo
# Here you give the number shown in first column as per your choice
echo "Select Quality (Choose a number): \c"
read qual
# If you don't want to download and quit the shell, give 99
if [ $qual -ne 99 ]
then
youtube-dl -f $qual -o "/home/Tom/Videos/%(title)s.%(ext)s" $answer
else
exit 0
fi
3

If you run youtube-dl like this:

youtube-dl -o "/home/vasa1/Downloads/%(title)s" http://www.youtube.com/watch?v=rnvK2TIhYns

The video should be in /home/vasa1/Downloads. Of course you need to put your username in place of vasa1.

2

by default youtube-dl downloads it's files on your home directory to access your downloaded filed please open the terminal change the directory to your home directory user:~$ cd /home/user Notice: user is your user name

1

Ubuntu 14 fix of official installation procedure

Create directory here:

sudo mkdir /opt/youtube-dl

Move youtube-dl from installation place:

sudo mv /usr/local/bin/youtube-dl /opt/youtube-dl

Make symlink:

pushd /usr/local/bin/ && sudo ln -s /opt/youtube-dl/youtube-dl

Test symlink:

ls -la youtube-dl 
lrwxrwxrwx 1 root root 26 Oct 16 20:41 youtube-dl -> /opt/youtube-dl/youtube-dl

popd

Test file:

ls -la /opt/youtube-dl/youtube-dl

-rwxrwxrwx 1 root root 639567 Oct 15 12:42 /opt/youtube-dl/youtube-dl

Fix permissions:

sudo chmod 755 /opt/youtube-dl/youtube-dl

Remove old cache:

sudo rm -r /home/<user>/.cache/youtube-dl/

e'voila! youtube-dl without having a need for a sudo in front of it

1

In case you want to run youtube-dl in python script, simply use -o will no effect.

Instead you need to use outtmpl keyword, e.g.:

youtube_dl.YoutubeDL( params={'-c': '', '--no-mtime': '', 'outtmpl': './%(uploader)s/%(title)s-%(upload_date)s-%(id)s.%(ext)s'} ).download([url])

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .