Skip to main content

通过 RSS 订阅 Youtube 频道

项目描述

Aldemsubs

Aldemsubs 是一个命令行应用程序,用于订阅 Youtube 频道并自动下载视频。它提供了一种无需 Youtube 帐户即可跟踪频道的方法。它将频道和视频信息存储在数据库中,并根据 Youtube 为每个频道提供的 RSS 源自动更新它们。

Aldemsubs 适用于 GNU/Linux 和 MacOS(仅在 Mojave 上测试)。它也应该与 Windows 兼容,但是没有经过全面测试。

安装

pip install --user aldemsubs

对于用户安装,请确保~/.local/bin/在您的$PATH.

用法

订阅频道:

aldemsubs -s <channel id>

在大多数情况下,频道 ID 只是频道页面 URL 的一部分。如果不是这种情况,可以通过检查频道页面的源代码来找到它。查找频道 ID 的最可靠方法是在页面源中搜索“rss”。这会将您带到包含频道 ID 的频道的 RSS 链接。

退订频道:

aldemsubs -r <channel id>

从数据库中删除频道和视频数据。下载的视频不会被删除。

列出订阅:

aldemsubs -l

列出所有订阅频道的频道 ID 和标题。

更新所有订阅:

aldemsubs -u

这将为每个频道加载当前版本的 RSS-feed 并将新视频添加到数据库中。

下载新添加的视频:

aldemsubs -d

将所有新视频下载到配置文件中设置的目录。默认情况下,视频下载到~/Youtube.

删除旧视频:

aldemsubs -x

删除超过设定天数的所有视频文件(相对于下载日期而不是发布日期)。

配置

默认配置:

[aldemsubs]

# Videos will be downloaded to this folder (download_path/channel_title/video).
download_path = ~/Youtube/

# Where the database is stored
db_file_path = ~/Youtube/aldemsubs.sqlite

# A video marked as new will be downloaded by aldemsubs -d (see usage). This
# setting controls after how many days the new flag is removed by aldemsubs -u.
# This only matters if you frequently update the database without downloading
# videos
mark_videos_old_after = 5  # days

# Controls for how many days to keep a video file after download. Videos older
# than this will be removed by aldemsubs -x
delete_downloads_after = 5  # days

# How many videos should be marked as new / for download after you subscribe to
# a channel? Set this to a negative number to download all videos in the RSS
# feed (usually Youtube only lists the last 15 videos in the feed)
after_subscribe_download_n_videos = 3

对配置的更改可以存储在~/.config/aldemsubs.ini.

systemd 服务和计时器

要更新订阅和下载新视频,您可以安装 systemd 服务和计时器。在此 repo 中的 systemd/install_service.sh和下找到安装脚本systemd/install_timer.sh。请在执行之前阅读脚本并根据自己的喜好进行调整。

安装后不要忘记systemctl enable aldemsubs.timer

该服务和计时器与 MacOS 和 Windows 不兼容。

Windows 兼容性

Aldemsubs 应该可以在 Windows 上运行。但是,到目前为止,我的一些测试在 Windows 上无法正常运行(有关更多详细信息,请查看问题)。

尽管如此,如果你想尝试在 Windows 上运行 aldemsubs,命令是 python -m aldemsubs. 所有的选项都是一样的。用户配置应存储在%APPDATA%\aldemsubs\aldemsubs.ini,默认下载目录为%USERPROFILE%\Youtube\.

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

aldemsubs-0.1.3.tar.gz (21.5 kB 查看哈希

已上传 source

内置分布

aldemsubs-0.1.3-py3-none-any.whl (10.2 kB 查看哈希

已上传 py3