静看光阴荏苒
不管不顾不问不说也不念

PeerTube4.0配置使用YT-DLP

只有4.0版本才可以使用yt-dlp,如果不是4.0版本需要先升级,升级步骤可以参考官方的发布记录:

https://github.com/Chocobozzz/PeerTube/releases/tag/v4.0.0

我并不是升级上来的,我是直接搭建的新版本,之前那个实例因为某些原因不打算维护了。。

以前我就发现一个问题,从油管导入视频非常慢,几分钟的视频需要导入很长时间才能成功,如果导入的视频时长久一点就根本不能导入成功了。与这个问题一致:

https://github.com/Chocobozzz/PeerTube/issues/4515

大概原因就是youtube-dl没人维护了,油管对这个工具做了限制吧。。解决办法也很简单,换成yt-dlp就好了。这里记录一下docker安装的peertube替换youtube-dl转而使用yt-dlp的步骤。

我直接新装的4.0版本没在config目录发现有production.yaml,只有一个local-production.json。。

local-production.json是用来保存管理员通过后台配置的一些选项的,按道理来说应该还有一个production.yaml才对。。我也不知道这什么情况。。如果你有production.yaml,那就直接照着官方给的配置来即可:

https://github.com/Chocobozzz/PeerTube/blob/develop/config/production.yaml.example#L445

如果没有production.yaml就把配置直接写进local-production.json吧,反正我现在是这样做的,不知道在管理员后台保存新的配置后会不会被覆写。

编辑配置文件:

nano /opt/peertube/docker-volume/config/local-production.json

默认的配置是:

...
  "import": {
    "videos": {
      "concurrency": 5,
      "http": {
        "enabled": true
      },
      "torrent": {
        "enabled": true
      }
    }
  },
...

改为:

...
  "import": {
    "videos": {
      "concurrency": 5,
      "http": {
        "enabled": true,
        "youtube_dl_release": {
          "url": "https://api.github.com/repos/yt-dlp/yt-dlp/releases",
          "name": "yt-dlp"
        }
      },
      "torrent": {
        "enabled": true
      }
    }
  },
...

之后还需要在容器内安装python3,因为现在官方这个基于debian11的镜像内没有yt-dlp需要的python3,只有2.7。。

进入容器:

docker exec -it peertube_peertube_1 /bin/bash

安装python3:

apt -y update
apt -y install python3

从debian11开始需要安装python-is-python3来做一个符号链接,让python这个命令直接调用python3,否则yt-dlp还是是会用python2.7来运行,这样yt-dlp会报错还是运行不了的:

apt -y install python-is-python3

需要注意的是这种直接进到容器里面安装软件包的方法不是最优解,如果镜像更新了你安装的这些包又得重装一遍。

这只能算是临时解决问题,要彻底解决的话,要么等官方把python3这些环境打包好,要么就只能自己去build镜像了。

如果要自己build镜像的话可以看这个文档,你需要修改dockerfile来安装python3的环境:

https://docs.joinpeertube.org/install-docker?id=build

最后测试一下,原来导入不了的视频现在可以正常导入了:

赞(6)
未经允许不得转载:荒岛 » PeerTube4.0配置使用YT-DLP
分享到: 更多 (0)

评论 13

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #1

    来捧个人场 :oops:

    Foliage2年前 (2022-01-04) Opera 82.0.4227.43 Opera 82.0.4227.43 Windows 10 x64 Edition Windows 10 x64 Edition回复
  2. #2

    :razz: 全网只有你这儿Peertube介绍的最多..

    CaiBao2年前 (2022-01-13) Firefox 95.0 Firefox 95.0 Windows 10 x64 Edition Windows 10 x64 Edition回复
  3. #3

    python_path: ‘/usr/bin/python3`

    按照官方的 config 直接加个 python3 的 path 不就行了

    Showfom2年前 (2022-01-16) Firefox 96.0 Firefox 96.0 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 建议你先试试再来说行不行。

      LALA2年前 (2022-01-17) Google Chrome 86.0.4240.198 Google Chrome 86.0.4240.198 Windows 10 x64 Edition Windows 10 x64 Edition回复
      • 我直接源码安装的没问题,这官方打包的 docker 镜像缺 python3

        Showfom2年前 (2022-01-28) Firefox 96.0 Firefox 96.0 Windows 10 x64 Edition Windows 10 x64 Edition回复
  4. #4

    大佬,求翻牌。咨询个 mediacms 的问题。付费,付费,付费。当然你能够协助开发就更好了
    1.资源能否接到腾讯云的对象存储?本地服务器资源实在不够用啊。
    2.我整个版面都已经汉化好了。就差tags,这个它只支持英文,不支持中文标签。这个问题能解决吗?

    火云鞋绳2年前 (2022-01-16) Google Chrome 96.0.4664.45 Google Chrome 96.0.4664.45 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 抱歉我没那个技术,帮不了你。另外这程序开源的,你有需求直接联系作者不是更好吗。。。

      LALA2年前 (2022-01-17) Google Chrome 86.0.4240.198 Google Chrome 86.0.4240.198 Windows 10 x64 Edition Windows 10 x64 Edition回复
  5. #5
  6. #6

    大佬,能用ks开出来的ipv6小鸡,出个搭建peertube v4的教程吗,按官方教程up时一直报错

    lala2年前 (2022-03-11) Google Chrome 99.0.4844.51 Google Chrome 99.0.4844.51 Windows 10 x64 Edition Windows 10 x64 Edition回复
  7. #7

    5是不是已经出来了

    mutiko1年前 (2022-12-18) Microsoft Edge 108.0.1462.46 Microsoft Edge 108.0.1462.46 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 是的,看了下更新的发布记录,感觉新功能不是特别多。。

      LALA1年前 (2022-12-22) Google Chrome 86.0.4240.198 Google Chrome 86.0.4240.198 Windows 10 x64 Edition Windows 10 x64 Edition回复

分享创造快乐

广告合作资源投稿