How to donwload from a website to a USB ...?  [Solved]

Forum for discussion and implementation of project work to enhance mxlinux.org and other MX Websites
Message
Author
User avatar
keos
Posts: 1394
Joined: Sat Mar 04, 2017 12:00 pm

How to donwload from a website to a USB ...?

#1 Post by keos »

Hello,

Yesterday I had to do a very large download from youtube to the operating system because I didn't know how to directly download all the material/data to a USB, the system filled up, 100% ... -- yes, after that I moved it to the usb, but I don't think I could complete it all.

What command (yt-dlp) should I use to make the download go directly to the USB and not to the system?.

Thanks for any information.
Acer Aspire A315-58
Intel Core i7-1165G7
Iris Xe Graphics
MX-23.2-Xfce4 - 4.18.2

*Matthew 5:11

User avatar
baldyeti
Posts: 717
Joined: Sat Dec 05, 2009 3:37 pm

Re: How to donwload from a website to a USB ...?

#2 Post by baldyeti »

'yt-dlp --help' reveals one can use the '-P' flag (uppercase "P"), e.g:

Code: Select all

yt-dlp -f bestaudio -P /destination/path/ http://some-url/some-id

Stuart_M
Posts: 695
Joined: Wed Aug 07, 2019 7:10 pm

Re: How to donwload from a website to a USB ...?

#3 Post by Stuart_M »

keos wrote: Sat Jun 18, 2022 5:30 am ... What command (yt-dlp) should I use to make the download go directly to the USB and not to the system?.
I know you asked for a yt-dlp command to use but you may like this way that does NOT use a yt-dlp command to save in a specific directory, and will produce the same results (and is easier, in my opinion). All you need to do is change the working directory of the terminal you are using to run the yt-dlp command.

There are a couple ways of changing the working directory of the terminal.
  • Use cd dir1/dir2/dir3... (cd = Change Directory) to change the working directory and then run your normal yt-dlp command.
OR
  • In Thunar,
    Go to the directory you want the yt-dlp file to be saved.
    Right-click on that directory (in this case it would be your USB drive).
    Select "Open Terminal Here".

    The terminal will then open in the working directory that you want to download/save the file in. All you then have to do is just run your normal yt-dlp command.

User avatar
keos
Posts: 1394
Joined: Sat Mar 04, 2017 12:00 pm

Re: How to donwload from a website to a USB ...?

#4 Post by keos »

I'm doing something wrong.

I don't understand the command, by 'some-id' I understand it to be the destination, so I type 'usb-data' (the name of the usb I have) but I get an error.

Code: Select all

keos@kaos:~
$ yt-dlp -f bestaudio -P /destination/path/ https://www.youtube.com/watch?v=TNf2Ye_mduY/USB-DATA
[youtube] TNf2Ye_mduY: Downloading webpage
[youtube] TNf2Ye_mduY: Downloading android player API JSON
[info] TNf2Ye_mduY: Downloading 1 format(s): 251
ERROR: unable to create directory [Errno 13] Permission denied: '/destination'
keos@kaos:~
$ 
Last edited by keos on Sat Jun 18, 2022 9:33 am, edited 2 times in total.
Acer Aspire A315-58
Intel Core i7-1165G7
Iris Xe Graphics
MX-23.2-Xfce4 - 4.18.2

*Matthew 5:11

User avatar
baldyeti
Posts: 717
Joined: Sat Dec 05, 2009 3:37 pm

Re: How to donwload from a website to a USB ...?

#5 Post by baldyeti »

You need to provide the path to your target folder. For a removable USB stick, typically someting that starts with /media/$USER/...

User avatar
keos
Posts: 1394
Joined: Sat Mar 04, 2017 12:00 pm

Re: How to donwload from a website to a USB ...?

#6 Post by keos »

I'm sorry but I still don't understand.

I think you indicate that I should do it this way:

Code: Select all

keos@kaos:~
$ yt-dlp -f bestaudio -P /destination/path/ https://www.youtube.com/watch?v=TNf2Ye_mduY/media/$keos/
[youtube] TNf2Ye_mduY: Downloading webpage
[youtube] TNf2Ye_mduY: Downloading android player API JSON
[info] TNf2Ye_mduY: Downloading 1 format(s): 251
ERROR: unable to create directory [Errno 13] Permission denied: '/destination'
keos@kaos:~
$ 
Acer Aspire A315-58
Intel Core i7-1165G7
Iris Xe Graphics
MX-23.2-Xfce4 - 4.18.2

*Matthew 5:11

Neil
Posts: 28
Joined: Sat Sep 01, 2018 3:52 pm

Re: How to donwload from a website to a USB ...?

#7 Post by Neil »

That is correct, except you must change the /destination/path/ to the actual path to your USB device.
The method Stuart_M suggests may be easier to understand.
Last edited by Neil on Sat Jun 18, 2022 9:32 am, edited 1 time in total.

User avatar
keos
Posts: 1394
Joined: Sat Mar 04, 2017 12:00 pm

Re: How to donwload from a website to a USB ...?

#8 Post by keos »

Code: Select all

keos@kaos:~
$ yt-dlp -f bestaudio -P /media/keos/ https://www.youtube.com/watch?v=TNf2Ye_mduY/USB-DATA
[youtube] TNf2Ye_mduY: Downloading webpage
[youtube] TNf2Ye_mduY: Downloading android player API JSON
[info] TNf2Ye_mduY: Downloading 1 format(s): 251
[download] Got file access error. Retrying (attempt 1 of 10) ...
[download] Got file access error. Retrying (attempt 2 of 10) ...
[download] Got file access error. Retrying (attempt 3 of 10) ...
[download] Got file access error. Retrying (attempt 4 of 10) ...
[download] Got file access error. Retrying (attempt 5 of 10) ...
[download] Got file access error. Retrying (attempt 6 of 10) ...
[download] Got file access error. Retrying (attempt 7 of 10) ...
[download] Got file access error. Retrying (attempt 8 of 10) ...
[download] Got file access error. Retrying (attempt 9 of 10) ...
[download] Got file access error. Retrying (attempt 10 of 10) ...
ERROR: unable to open for writing: [Errno 13] Permission denied: '/media/keos/Kim Walker-Smith – Make Room (Official Live Video) [TNf2Ye_mduY].webm.part'

keos@kaos:~
$ 
Acer Aspire A315-58
Intel Core i7-1165G7
Iris Xe Graphics
MX-23.2-Xfce4 - 4.18.2

*Matthew 5:11

User avatar
keos
Posts: 1394
Joined: Sat Mar 04, 2017 12:00 pm

Re: How to donwload from a website to a USB ...?

#9 Post by keos »

If someone could please give me an example perhaps ...

EDIT:

I tried now in this way, it works, but i got just the audio, it is a video:

Code: Select all

keos@kaos:~
$ yt-dlp -f bestaudio -P /media/keos/USB-DATA/ https://www.youtube.com/watch?v=TNf2Ye_mduY/media/keos/USB-DATA/
[youtube] TNf2Ye_mduY: Downloading webpage
[youtube] TNf2Ye_mduY: Downloading android player API JSON
[info] TNf2Ye_mduY: Downloading 1 format(s): 251
[download] Destination: /media/keos/USB-DATA/Kim Walker-Smith – Make Room (Official Live Video) [TNf2Ye_mduY].webm
[download] 100% of 12.70MiB in 00:05
keos@kaos:~
$ 

EDIT:

I tried now 'this' ... and i got video and audio but with a warning saying that "it is often not the best option":

Code: Select all

keos@kaos:~
$ yt-dlp -f best -P /media/keos/USB-DATA/ https://www.youtube.com/watch?v=TNf2Ye_mduY/media/keos/USB-DATA/
WARNING: "-f best" selects the best pre-merged format which is often not the best option.
         To let yt-dlp download and merge the best available formats, simply do not pass any format selection.
         If you know what you are doing and want only the best pre-merged format, use "-f b" instead to suppress this warning
[youtube] TNf2Ye_mduY: Downloading webpage
[youtube] TNf2Ye_mduY: Downloading android player API JSON
[info] TNf2Ye_mduY: Downloading 1 format(s): 22
[download] Destination: /media/keos/USB-DATA/Kim Walker-Smith – Make Room (Official Live Video) [TNf2Ye_mduY].mp4
[download] 100% of 79.98MiB in 00:16
keos@kaos:~
$ 
Acer Aspire A315-58
Intel Core i7-1165G7
Iris Xe Graphics
MX-23.2-Xfce4 - 4.18.2

*Matthew 5:11

Stuart_M
Posts: 695
Joined: Wed Aug 07, 2019 7:10 pm

Re: How to donwload from a website to a USB ...?

#10 Post by Stuart_M »

The reason you only get the audio is because you have downloaded only the audio portion by using the -f bestaudio option. Omit that portion and it should be fine.

The command would then look like this:

Code: Select all

yt-dlp -P /media/keos/USB-DATA/ https://www.youtube.com/watch?v=TNf2Ye_mduY/media/keos/USB-DATA/

P.S. I still think running the command with the terminal's working directory where you want the file saved is the easiest and fastest way (my post #3).

Post Reply

Return to “Website”