如何使用终端卸载/安装 youtube-dl

如何使用终端卸载/安装 youtube-dl

我安装了YouTube-dl通过 Ubuntu 软件中心,但现在我的无法使用。所以我无法更新和安装 youtube-dl。我试过这个:

$ sudo add-apt-repository ppa:nilarimogard/webupd8
$ sudo apt-get update
$ sudo apt-get install youtube-dl

然后出现以下错误......

$ youtube-dl --version
2014.02.17
$ sudo add-apt-repository ppa:nilarimogard/webupd8
[sudo] password for madhavnikam: 
 The main Web Upd8 PPA maintained by: http://www.webupd8.org/

To add this PPA, simply paste this in a terminal:
sudo add-apt-repository ppa:nilarimogard/webupd8

Packages in this PPA: audacious, ap-hotspot, awn-applet-radio, awn-applet-wm, calise, cmus, dockbarx, dockbarx-themes-extra, dropbox-share, emerald, exaile, fbmessenger, gnome-subtitles, gnome-window-applets, grsync, grive, gthumb, launchpad-getkeys, mc, mdm (Mint Display Manager), minitunes, minitube, musique, notifyosdconfig, nautilus-columns, powertop, ppa-purge, rosa-media-player, fixed pulseaudio-equalizer, subtitleeditor, syncwall, umplayer, unity-reboot, wimlib, youtube-dl, xfce4-dockbarx-plugin, xournal, yad and others. Almost all packages are updated to their latest version.

For other (specialized) PPAs we maintain, see: https://launchpad.net/~webupd8team
 More info: https://launchpad.net/~nilarimogard/+archive/ubuntu/webupd8
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keyring `/tmp/tmpl8q4d9le/secring.gpg' created
gpg: keyring `/tmp/tmpl8q4d9le/pubring.gpg' created
gpg: requesting key 4C9D234C from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpl8q4d9le/trustdb.gpg: trustdb created
gpg: key 4C9D234C: public key "Launchpad webupd8" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK
$ sudo apt-get update
Ign http://in.archive.ubuntu.com trusty InRelease                              
[...]
Ign http://in.archive.ubuntu.com trusty/universe Translation-en_IN
Fetched 1,784 kB in 1min 29s (20.0 kB/s)
Reading package lists... Error!
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_trusty_main_i18n_Translation-en
E: The package lists or status file could not be parsed or opened.
$ sudo apt-get install youtube-dl
Reading package lists... Error!
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_trusty_main_i18n_Translation-en
E: The package lists or status file could not be parsed or opened.

$ youtube-dl -U
It looks like you installed youtube-dl with a package manager, pip, setup.py or a tarball. Please use that to update.

如何仅使用终端卸载和安装 Youtube-dl?

答案1

尝试pip命令升级youtube-dl

sudo pip install --upgrade youtube-dl

如果您收到此消息:

sudo: pip: command not found

然后首先安装pip

sudo apt-get install python-setuptools
sudo easy_install pip
sudo pip install --upgrade youtube-dl

答案2

我使用以下命令解决了该问题:

  1. sudo apt-get remove youtube-dl

    删除 youtube-dl

    在那之后:

  2. sudo apt-get install youtube-dl

    安装 youtube-dl

  3. 正在下载播放列表...

    youtube-dl -cit --extract-audio --audio-format mp3 https://www.youtube.com/playlist?list=PLttJ4RON7sleuL8wDpxbKHbSJ7BH4vvCk
    

    通过 Youtube-dl 下载播放列表

完毕。

答案3

使用 --reinstall 会更容易

sudo apt-get install --reinstall youtube-dl

然后使用它:

 youtube-dl -cit --extract-audio --audio-format mp3 https://www.youtube.com/playlist?list=PLttJ4RON7sleuL8wDpxbKHbSJ7BH4vvCk

答案4

为什么你不使用官方推荐的安装 youtube-dl 的方法? 非常有用,因为常常您需要将其更新(sudo youtube-dl -U)至最新稳定版本才能保持其正常运行:

sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl

sudo chmod a+rx /usr/local/bin/youtube-dl

这里您将找到我编写的用于批量下载的 bash 脚本,该脚本从文本文件中获取曲目名称。

相关内容