Have you ever found interesting videos on YouTube, and wanted to download and save them on your hard drive (for offline access or archiving purpose)? There is a handy open-source Linux tool that does exactly that: download YouTube videos.
A tool called youtube-dl is a command-line program written in Python that downloads videos from various online video sharing sites, including YouTube, DailyMotion, Vimeo, etc. Since the tool is written in Python, it can run on any platform that has Python interpreter (in particular, Python version 2.6, 2.7, or 3.3+). A binary for Windows platform is also available.
Here is a guide on how to download and save YouTube videos by using youtube-dl.
First install youtube-dl on your Linux system.
To install youtube-dl on Debian:
$ sudo apt-get install python-dev python-pip gcc $ sudo pip install --upgrade youtube_dl
To install youtube-dl on Ubuntu or Linux Mint:
$ sudo apt-get install youtube-dl
To install youtube-dl on CentOS or RHEL, first set up EPEL repository on your system, and then run:
$ sudo yum install youtube-dl
To install youtube-dl on Fedora, simply run:
$ sudo yum install youtube-dl
Instead of using a package manager, you can also download youtube-dl Python code directly from its website, and use it.
Once you have installed youtube-dl, it is straightforward to download a YouTube video. You just need to pass a YouTube video link to youtube-dl. It will go ahead and fetch the video and store it as mp4/flv format.
$ youtube-dl http://www.youtube.com/watch?v=ykp8fxHWcVo [youtube] Setting language [youtube] ykp8fxHWcVo: Downloading video webpage [youtube] ykp8fxHWcVo: Downloading video info webpage [youtube] ykp8fxHWcVo: Extracting video information [download] Destination: ykp8fxHWcVo.mp4 [download] 3.5% of 56.72M at 367.13k/s ETA 02:32^C
Resume Interrupted Downloads of YouTube Videos
The youtube-dl tool supports resuming interrupted downloads. If youtube-dl is killed (for example by Ctrl-C or due to loss of Internet connectivity) in the middle of download, you can simply re-run it with the same YouTube video url. It will automatically resume the unfinished download, as long as a partial download is present in the current directory.
Download YouTube Videos in Multiple Formats
Most of YouTube videos nowadays are available in multiple resolutions and formats in order to support various devices and Internet connections. The youtube-dl tool actually allows you to choose a specific resolution and format when downloading YouTube videos.
Since different YouTube videos may have different resolutions ready, you first need to check available video formats of a given YouTube video. For that, run youtube-dl with "-F" option. It will show you a list of available formats.
$ youtube-dl -F http://www.youtube.com/watch?v=BlXaGWbFVKY [youtube] Setting language [youtube] BlXaGWbFVKY: Downloading video webpage [youtube] BlXaGWbFVKY: Downloading video info webpage [youtube] BlXaGWbFVKY: Extracting video information Available formats: 37 : mp4 [1080x1920] 46 : webm [1080x1920] 22 : mp4 [720x1280] 45 : webm [720x1280] 35 : flv [480x854] 44 : webm [480x854] 34 : flv [360x640] 18 : mp4 [360x640] 43 : webm [360x640] 5 : flv [240x400] 17 : mp4 [144x176]
Now among the available video formats, choose one that you like:
$ youtube-dl -f 17 http://www.youtube.com/watch?v=BlXaGWbFVKY
Download YouTube Videos in a Batch
If you want to download multiple YouTube videos in one shot, all you have to do is to prepare a text file that contains urls of all the videos. Then run youtube-dl with "-a" option.
$ cat video.list
. . . .
$ youtube-dl -a video.list
Extract Audio (MP3) From YouTube Videos
If you would like to extract audio from YouTube video and save it as a MP3 file, you can do the following.
First, install FFmpeg on your system.
Then use the following command to save the audio of YouTube video as a separate MP3 file. youtube-dl will use FFmpeg to perform audio extraction.
$ youtube-dl http://www.youtube.com/watch?v=BlXaGWbFVKY --extract-audio --audio-format mp3
Define Default Options of Youtube-dl
You can put commonly used options (e.g., --extract-audio --audio-format mp3) in youtube-dl's configuration file, which is located at either /etc/youtube-dl.conf (system-wide) or ~/.config/youtube-dl.conf (per-user), in which case those options become "default" arguments that you do not have to specify explicitly from the command line.
来源:http://xmodulo.com/how-to-save-youtube-videos-on-linux.html
原文/转自:Linux 下载youtube视频 How to save YouTube videos on Linux
相关推荐
Youtube Video Player+Youtube API Unity播放YouTube视频插件包unitypackage 支持Unity版本2019.4.40或更高 在您的游戏或项目中播放 YouTube 视频。适用于台式机、控制台和移动设备。您可以在任意位置播放 YouTube ...
在本项目中,我们将深入探讨“YouTube视频趋势分析”,这是一个基于Python数据分析的实践课题。这个话题对于理解在线视频平台的用户行为、热门内容以及市场趋势至关重要。通过分析YouTube数据集,我们可以获取到丰富...
这个数据集是最热门的Youtube视频的每日记录, 该数据集包含有关Youtube每日热门视频的数月(且在不断增加)的数据。包括US,GB,DE,CA和FR地区(分别为美国,英国,德国,加拿大和法国)的数据,每天最多列出200个...
YouTube视频数据集.zip
"一个使用youtube的android sdk在recyclerview中内联播放youtube视频的黑例子" 表明这个项目是基于YouTube的Android SDK来实现RecyclerView中的内联播放功能,而“黑例子”可能意味着它并不是官方推荐或最优的解决...
1=====播放YouTube视频呢?这个也有滴就,支持横竖屏切换,支持列表播放,可以只定义扩展,可以放到项目中直接运行。。。。。 2=====当然播放HLS格式的视频有时候确实是比较麻烦,ijkplayer还得编译so库进行支持...
免费的YouTube上传器是第一个也是最好的工具,无需在批处理模式下使用原始YouTube网络界面即可将视频上传到YouTube。 充分利用DVDVideoSoft YouTube上传器: - 高速上传单个视频和一串视频; - 保存帐户信息以便...
【标题解析】:“youtube-duration-sort:按时长排序YouTube订阅视频-源码”表明这是一个与YouTube订阅视频相关的项目,它的核心功能是实现视频时长的排序。"源码"提示我们这里包含的是编程代码,可能是用JavaScript...
仿YouTube视频分享平台程序.zip
SMPlayer 是一款适用于 Windows 和 Linux 的免费媒体播放器,内置编解码器,也可以播放 YouTube 视频。 SMPlayer 最有趣的功能之一:它会记住您播放的所有文件的设置。所以你开始看电影,但你必须离开......别担心...
【标题】:“YouTube 3D视频播放器源代码”是一个基于ActionScript 3.0(AS3.0)开发的程序,专为在YouTube平台上播放3D视频而设计。3D视频技术允许观众体验立体视觉,增加了观看视频的沉浸感。AS3.0是Adobe Flash ...
以下是可能导致YouTube屏幕停电的一些问题:广告拦截插件:有时,您的广告拦截器会阻止您观看视频,而不仅仅是过滤掉广告。如果您遇到YouTube视频播放的问题
Atom-youtube-tv.zip,How about watching youtube videos while doing other things?,atom是一个用web技术构建的开源文本编辑器。
软件介绍: 安装说明:解压后先运行save2pc_ult.exe安装软件。...Save2pc能够轻松下载YouTube上的视频,并保存为flv/avi/mpeg格式,其使用非常简单,在link处输入要下载视频的URL地址,再点击Get video即可。
对于YouTube视频,开发者往往不直接处理视频文件,而是通过调用YouTube的API来实现播放控制。这样可以避免跨域问题,同时也让开发者能够利用YouTube已经优化好的视频流服务。 `react-youtube-master`这个压缩包...
这个压缩包文件“IOS应用源码——播放youtube视频的demo.zip”显然包含了iOS应用开发相关的资源,特别是关于在iOS应用中播放YouTube视频的示例代码。让我们深入探讨一下这个话题。 首先,我们要知道iOS平台上播放...
标题中的“使用MIL-NCE在HowTo100M上训练的S3D文本-视频模型_Pyth.zip”指的是一个使用多实例学习(MIL-NCE)算法在大规模视频理解数据集HowTo100M上训练的S3D模型。这个模型是将视觉特征与文本信息结合的,用于实现...
html5-youtube.js, 像HTML5视频API一样的YouTube播放器API包装器 注:" youtube.js"已经被重命名为"html5-youtube 。js"。 html5-youtube.js像HTML5视频API一样的YouTube播放器API包装器。的播放器API参考嵌入- ...
按照视图的数量对YouTube网页右栏中的相关视频进行排序 在YouTube上的视频页面上时,您可能需要查看观看次数最多的视频,以决定接下来要看什么。 通过此扩展程序,您可以按观看次数对页面右栏中列出的相关视频进行...
在"ExtJS编写的youtube视频播放组件 示例"这个主题中,我们将深入探讨如何使用ExtJS来开发一个YouTube视频播放器组件。 首先,让我们理解组件(Component)在ExtJS中的概念。组件是ExtJS应用程序的基本构建块,可以...