How to use youtube-dl to download videos in Linux

Source: Internet
Author: User

How to use youtube-dl to download videos in Linux

I know you have seen how to download the YouTube video. However, most of those tools use graphical user interfaces. I will show you how to use youtube-dl to download YouTube videos through a terminal.

 

Youtube-dl

Youtube-dl is a Python-based command line tool that allows you to download videos from YouTube.com, Dailymotion, Google Video, Photobucket, Facebook, Yahoo, Metacafe, Depositfiles, and other similar websites. It is written in pygtk and runs with a Python parser. It does not have strict platform requirements. It can run on Unix, Windows, or Mac OS X.

Youtube-dl supports resumable upload. If youtube-dl is killed during the download process (for example, Ctrl-C or the network connection is lost), you only need to use the same YouTube video URL to run it again. As long as there are some downloaded files in the current directory, it will automatically restore incomplete downloads, that is, you do not need to download the manager to resume the download.

 

Install youtube-dl

If you are running the Ubuntu-based Linux release, you can use the following command to install it:

  1. sudoapt-get install youtube-dl

For any Linux release, you can use the following command line to quickly install youtube-dl on your system:

  1. sudowget https://yt-dl.org/downloads/latest/youtube-dl -O/usr/local/bin/youtube-dl

After obtaining the file, you need to set the executable permission for the script to run properly.

  1. sudochmod a+rx /usr/local/bin/youtube-dl

 

Use youtube-dl to download the video:

To download a video file, run the following command. "VIDEO_URL" is the url of the video you want to download.

  1. youtube-dl VIDEO_URL

 

Download YouTube videos in multiple formats:

Currently, YouTube videos have different resolutions. First, you need to check the available video formats of the specified YouTube video. You can use the "-F" option to run youtube-dl. It will show you available formats.

  1. youtube-dl -F http://www.youtube.com/watch?v=BlXaGWbFVKY

Its output is similar:

  1. Setting language
  2. BlXaGWbFVKY:Downloading video webpage
  3. BlXaGWbFVKY:Downloading video info webpage
  4. BlXaGWbFVKY:Extracting video information
  5. Available formats:
  6. 37: mp4 [1080×1920]
  7. 46: webm [1080×1920]
  8. 22: mp4 [720×1280]
  9. 45: webm [720×1280]
  10. 35: flv [480×854]
  11. 44: webm [480×854]
  12. 34: flv [360×640]
  13. 18: mp4 [360×640]
  14. 43: webm [360×640]
  15. 5: flv [240×400]
  16. 17: mp4 [144×176]

Select one of the available video formats. For example, if you want to download the MP4 format, you can:

  1. youtube-dl -f 17 http://www.youtube.com/watch?v=BlXaGWbFVKY

 

Use youtube-dl to download Video Subtitles

First, check whether there are available video subtitles. Use the following command to list all available subtitles of a video:

  1. youtube-dl --list-subs https://www.youtube.com/watch?v=Ye8mB6VsUHw

Download all subtitles, but not videos:

  1. youtube-dl --all-subs --skip-download https://www.youtube.com/watch?v=Ye8mB6VsUHw

 

Download the entire playlist

Run the following command to download the entire playlist. "Playlist_url" is the url of the playlist you want to download.

  1. youtube-dl -cit playlist_url

Youtube-dl is a multi-functional command line tool that provides many features. No wonder this command line tool is so popular.

Via: http://itsfoss.com/download-youtube-linux/

Author: alimiracle Translator: ictlyh Proofreader: wxy

This article was originally translated by LCTT and launched with the Linux honor in China

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.