YTDL
简单的命令行YouTube下载器
此工具的目的是允许您仅使用视频标题直接从命令行下载YouTube视频的音频。
它通过使用您提供的标题执行搜索,然后下载找到的第一个结果。它还允许您显示搜索到的视频,然后让您选择要下载的视频。
用法
下载
使用 ytdl 加上视频标题即可直接下载,就是这么简单。音频将下载到打开命令行的位置(当前目录)
$ ytdl <args> [title of the video]
例如,这将把Lynyrd Skynyrd乐队的歌曲Free Bird下载为mp3文件
$ ytdl free bird
参数
- -ogg :将文件以ogg格式下载,而不是默认的mp3格式
- -mp3 :将文件以mp3格式下载,通常这是没有用的,因为文件默认已经是mp3格式了
- –ls :启用
列表模式 - -list :启用
列表模式
用法示例(在/home/username/Music中执行的命令)
$ ytdl mario theme
Downloading "Super Mario Bros. Theme Song"...
Successfully downloaded "Super Mario Bros. Theme Song" !
File located at /home/username/Music/Super Mario Bros. Theme Song.mp3
Channel : ultragamemusic
Duration : 01:23
列表模式
列表模式允许您在视频列表中选择要下载的视频,以防默认的 ytdl 找到错误的视频。通常可以通过使用更精确的搜索来避免此模式,例如发送 $ ytdl thriller michael jackson 而不是 $ ytdl thriller。
$ ytdl -ls thriller
Searching for "thriller"...
Videos found while searching for "thriller" :
[1] "Michael Jackson - Thriller (Official 4K Video)" - 13:42
[2] "Michael Jackson - Thriller (Official Video - Shortened Version)" - 03:22
[3] "Thriller (2003 Edit)" - 05:12
[4] "Michael Jackson - Thriller (Lyrics)" - 05:58
[5] "Michael Jackson - Thriller - Thriller" - 05:58
[page 1] -n->
Enter "N", "n" or "next" to go to the next page,
Enter "P", "p" or "previous" to go to the previous page,
Enter "x", "e" or "exit" to exit
Or enter the number of the video you want to download
Action : |
如何安装
此工具下载后即可使用,无需安装(便携式)。但是,如果您想从命令行直接使用 ytdl 而不考虑目录,则需要执行一些额外的步骤。目前,您必须手动执行安装,将来会提供安装程序。
Windows
- 在Windows上,将ytdl.exe放在适当的目录中,例如
C:\Program Files\Simple Youtube Downloader\。 - 之后,转到您的环境变量并编辑
Path以添加安装ytdl.exe的目录。 如何编辑Windows上的环境变量 - 通常,您需要重新启动计算机才能使此更改生效