RSS-to-Telegram-Bot

Rongronggg9AGPL-3.0活跃维护

把 RSS/Atom 订阅源自动推送到 Telegram 的机器人,支持多用户、富文本和多媒体内容,还能导入 OPML,适合用 Telegram 追更博客和新闻。

A Telegram RSS bot that cares about your reading experience (calling for new maintainers: https://github.com/Rongronggg9/RSS-to-Telegram-Bot/issues/747)

v2.10.0发布于 2025-03-22 16:23 UTC2,176star +2 / 7 天370fork同步于 2026-11-11 05:42 UTC

怎么上手

由 README 提炼,执行前请确认
docker compose up -d
硬件要求按 README 说明

README 未说明

有 Docker 镜像
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

把 RSS 订阅内容推送到 Telegram 的多用户机器人,保留富文本与媒体,改善阅读体验

把 RSS/Atom 订阅源自动推送到 Telegram 的机器人,支持多用户、富文本和多媒体内容,还能导入 OPML,适合用 Telegram 追更博客和新闻。

核心能力

  • 保留富文本格式与图文音视频媒体
  • 长图以文件发送避免 Telegram 压缩
  • 自动替换 emoji 短代码与 emoji 图片
  • 超长消息自动拆分,可转 Telegraph 发送
  • 支持 OPML 导入导出并保留自定义标题

容易踩的坑

推荐用 Docker Compose 部署,需自行准备 Telegram 与 RSS 的代理配置;公共 bot 不保证可用,自建需按部署指南配置;AGPLv3+ 禁止闭源分发或托管

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v2.10.0
  1. v2.10.0v2.10.0: Container health check, chat-specific #hashtags, and more最新正式版2025-03-22 · 2025-03-22 16:23 UTC

    Highlights

    • Container health check: The official Docker image includes an automatic health check to determine if the container is running properly. The health check status can be checked in docker ps. This feature, combined with autoheal or some other monitoring tool, can restart the container automatically when it is unhealthy.
    • Support for chat-specific #hashtags: Telegram recently added a feature called "chat-specific hashtags," formatting as #hashtag@username. However, escaping '@' broke these hashtags. Properly supports such hashtags by allowing '@' in hashtags.

    Enhancements

    • No longer proxies images from *.wp.com when generating Telegraph posts: *.wp.com is in the blocklist of wsrv.nl (environment variable IMAGES_WESERV_NL). Thus, these images are no longer proxied when generating Telegraph posts. All images from *.wp.com can be accessed with any referer header, so they are now kept as is.
    • Link to repo in UA: The default User-Agent now contains a link to the repository, which can help webmasters identify the source of traffic and add RSStT into their allowlists.
    • Minor enhancements: Some internal functions have been refined to enhance compatibility with various feeds.
    • Minor refactor: Some internal functions have been refactored to improve performance, readability and maintainability.

    Bug fixes

    • Canonical DATABASE_URL not recognized: Since v2.9.0, DATABASE_URL is canonicalized before connecting to the corresponding database. However, a canonical URL pointing to a local path cannot be recognized when checking the validity of the scheme (database type). Both canonical (scheme:/path/to/file.db) and traditional (scheme:///path/to/file.db) forms of such URLs are recognized correctly now.
    • Monitoring not deferred as per server-side cache when subscribing: Since v2.7.0, monitoring tasks will be deferred when aggressive server-side caches (e.g., Cloudflare and RSSHub, which make it futile to check for updates before cache expiration) are detected. However, the first monitoring task for a newly subscribed feed was not being deferred. This has been fixed and the first monitoring task now waits for the server-side cache to expire.
    • Minor bug fixes

    v2.10.0: 容器健康检查、特定于聊天的 #hashtag 和更多

    亮点

    • 容器健康检查: 官方 Docker 镜像现在包含自动健康检查,用于确定容器是否正常运行。健康检查状态可以在 docker ps 中查看。结合 autoheal 或其他监控工具,当容器不健康时可以自动重启容器。
    • 支持特定于聊天的 #hashtag: Telegram 最近添加了一个名为“特定于聊天的 hashtag”的功能,格式为 #hashtag@username。然而,转义 @ 会破坏这些 hashtag。通过在 hashtag 中允许 @ 来正确地支持这类 hashtag。

    增强

    • 生成 Telegraph 文章时,不再代理来自 *.wp.com 的图像: *.wp.com 位于 wsrv.nl (环境变量 IMAGES_WESERV_NL) 的阻断列表中。因此,在生成 Telegraph 文章时,这些图像不再被代理。来自 *.wp.com 的所有图片都可以用任何 refer 头访问,因此它们现在保持原样。
    • UA 中的仓库链接: 默认的 User-Agent 现在包含一个指向仓库的链接,这可以帮助网站管理员识别流量来源并将 RSStT 添加到白名单中。
    • 次要的增强: 改进了一些内部函数以增强与各种 feed 的兼容性。
    • 次要的重构: 重构了一些内部函数以提高性能、可读性和可维护性。

    Bug 修复

    • 无法识别规范的 DATABASE_URL: 自 v2.9.0 起, 在连接到相应的数据库之前,DATABASE_URL 被规范化。然而,在检查 scheme (数据库类型) 的合法性时,无法识别指向本地路径的规范 URL。现在,此类 URL 的规范 (scheme:/path/to/file.db) 和传统 (scheme:///path/to/file.db) 形式都被正确识别。
    • 订阅时不会根据服务端缓存延迟监控:自 v2.7.0 起,当检测到激进的服务器端缓存时,监控任务将被延迟(例如 Cloudflare 和 RSSHub,它们使得在缓存过期之前检查更新变得徒劳无功)。但是,当新订阅 feed 时,第一个监视任务不会被推迟。该问题已修复,第一个监控任务会等待服务端缓存过期。
    • 次要的 bug 修复
  2. v2.9.0v2.9.0: Telegraph-related revert, skip cert verification, and more2024-09-11 · 2024-09-11 14:12 UTC
    查看更新说明

    BREAKING CHANGES

    Media (image and video) are no longer uploaded when generating Telegraph posts due to Telegraph disabling media upload. (first introduced in v2.6.0)

    Addition

    • Disable TLS certificate verification: The environment variable VERIFY_TLS has been added to disable (when set to 0) or enable (when set to 1, default) TLS certificate verification. This is useful when subscribing to feeds with their TLS misconfigured. Note: Disabling TLS certificate verification is not recommended and should only be used as a last resort.

    Enhancements

    • Sanitize post title and author: The title and author of a post (RSS item or Atom entry) are now sanitized to prevent unexpected formatting issues. In particular, unexpected whitespaces and linebreaks are removed, and any HTML elements are stripped. This helps display them correctly in Telegram messages as well as Telegraph posts.
    • Improve robustness on Railway.app: Some Railway-specific environment variables are recognized to improve robustness on Railway.app. In particular, DATABASE_PRIVATE_URL and DATABASE_PUBLIC_URL will be used when DATABASE_URL is unavailable or invalid. This should solve most database connection issues on Railway.app.
    • Minor refactor: Some internal functions have been refactored to improve readability and maintainability.

    Bug fixes

    • /version not working: When installed from PyPI (e.g. pip install rsstt), the /version command might cause an error. This was a regression introduced in v2.7.0.
    • Bot managers can set monitoring intervals shorter than limit: Due to the breaking change introduced in v2.8.0, the privilege of bot managers to set intervals shorter than the minimal monitoring interval became useless. While v2.8.0 only applied this limitation when monitoring the updates of feeds, this release also applies it to the attempts by bot managers to change the monitoring interval for a subscription. Note: bot managers can always lower the minimal monitoring interval by adjusting minimal_interval in /set_option (see also Advanced Settings), but doing so will also permit anyone who is able to use the bot to set shorter intervals.
    • Minor bug fixes

    v2.9.0: 与 Telegraph 相关的 revert、跳过证书校验和更多

    重大变更

    由于 Telegraph 禁用了媒体上传,生成 Telegraph 文章时不再上传媒体 (图片与视频) 。(在 v2.6.0 中首次引入)

    新增功能

    • 关闭 TLS 证书验证: 环境变量 VERIFY_TLS 已被添加以禁用 (设置为 0 时) 或启用 (设置为 1 时,默认) TLS 证书验证。当订阅 TLS 被错误配置的 feed 时,这很有用。注意:不建议禁用 TLS 证书验证,只应用作最后手段。

    增强

    • 净化文章标题和作者: 文章 (RSS item 或 Atom entry) 的标题和作者现在被净化以防止意外的格式问题。特别是,预期外的空格和换行符被移除,任何 HTML 元素都被剥离。这有助于在 Telegram 消息以及 Telegraph 文章中正确显示它们。
    • 改善在 Railway.app 上的稳健性: 一些特定于 Railway 的环境变量被识别以提高在 Railway.app 上的稳健性。特别是,当 DATABASE_URL 不可用或无效时,将使用 DATABASE_PRIVATE_URL 和 DATABASE_PUBLIC_URL。这应该解决在 Railway.app 上的大多数数据库连接问题。
    • 次要的重构: 重构了一些内部函数以提高可读性和可维护性。

    Bug 修复

    • /version 不工作: 当从 PyPI 安装时 (例如 pip install rsstt), /version 命令可能会导致错误。这是在 v2.7.0 中引入的一个回归 (regression)。
    • Bot 管理员可以设置比限制更短的监控间隔: 由于 v2.8.0 中引入的一个重大变更,bot 管理员可以设置比最小监控间隔更短的间隔的特权变得毫无意义。虽然 v2.8.0 只在监控 feed 的更新时应用了这个限制,但这个版本也将它应用于 bot 管理员的更改订阅监控间隔的尝试。注意: bot 管理员总是可以通过调整 /set_option 中的 minimal_interval 来降低最小监控间隔 (另请参阅 高级设置),但这样做也会允许任何能够使用 bot 的人设置更短的间隔。
    • 次要的 bug 修复
  3. v2.8.0v2.8.0: Retain post order, rewritten monitor, and more2024-06-26 · 2024-06-26 18:08 UTC
    查看更新说明

    Highlights

    • Retain post order: Retain the order of posts in a feed when sending them. Previously, all new posts were sent simultaneously, losing their order within the feed. Note: Posts from different feeds are still sent simultaneously, so it is expected to see them interlaced.
    • Rewritten monitor: The feed monitor has been rewritten for flexibility and robustness. It is now more memory-efficient and can smooth out spikes in CPU usage.

    Enhancements

    • Print Telegram user info of bot: Print the bot's Telegram user info when the bot is started. This is to help bot managers to find the bot's username and user ID when deploying the bot.
    • Minor refactor: Some internal functions have been refactored to improve performance and maintainability.

    Bug fixes

    • Exit with 0 when disconnected: If the bot was logged out due to a network error or Telegram DC degradation, it would exit with exit-code 0. This led to confusion when the bot was running in a container or as a service. Now the bot will exit with exit-code 100 when disconnected.
    • Unable to handle completely empty posts: Fix AttributeError caused by completely empty posts. They are ignored now.
    • Minor bug fixes

    v2.8.0: 保留文章顺序,重写的监视器和更多

    亮点

    • 保留文章顺序: 在发送文章时保留文章在 feed 中的顺序。先前,所有新文章都被同时发送,失去了它们在 feed 中的顺序。注意:来自不同 feed 的文章仍然同时发送,因此预计会看到它们交错。
    • 重写的监视器: Feed 监视器已被重写,以提高灵活性和稳健性。它现在更节省内存,并且可以平滑 CPU 使用率的波动。

    增强

    • 打印 bot 的 Telegram 用户信息: 在 bot 启动时打印 bot 的 Telegram 用户信息。这是为了帮助 bot 管理员在部署 bot 时找到 bot 的用户名和用户 ID。
    • 次要的重构: 重构了一些内部函数以提高性能和可维护性。

    Bug 修复

    • 断开连接后以 0 退出: 过去,如果 bot 由于网络错误或 Telegram DC 降级而被登出,它将以退出码 0 退出。当 bot 在容器中或作为服务运行时,这会导致混乱。现在,当断开连接时,机器人将以退出码 100 退出。
    • 无法处理完全空白的文章: 修复由完全空白的文章引起的 AttributeError。它们现在会被忽略。
    • 次要的 bug 修复
  4. v2.7.0v2.7.0: #Hashtags from post, Python 3.12 support, and more2024-05-09 · 2024-05-09 17:16 UTC
    查看更新说明

    BREAKING CHANGES

    • Migrate to aerich 0.7.2: A breaking change introduced in aerich (a dependency of RSStT) 0.7.x has prevented RSStT from upgrading it for a long time. A lot of effort has been made, so the migration is expected to be seamless and shouldn't break anything. However, it is encouraged to make a database backup before upgrading RSStT. If you encounter any issues due to the migration, please file a bug report.

    Highlights

    • #Hashtags from post (feed entry): If enabled in /set or /set_default, hashtags from posts (feed entries), merged with the custom hashtags of the feed, will be added to the message. The term "hashtags from post" refers to <category> elements in RSS <item> or Atom <entry>. This feature is disabled by default. Thanks @maooyer for their first contribution in #449.
    • Support Python 3.12: Minor fixes have been made to support Python 3.12. The official Docker image is now based on Python 3.12 as well.
    • Helper scripts to make contributions easier: When performing contributions that update database models, creating database migration files is not an easy job. scripts/aerich_helper.py is a helper script that can simplify the process. Passing --help to the script to see a detailed usage guide.

    Enhancements

    • Defer monitoring as per RSSHub TTL: Defer monitoring as per the TTL (Time To Live) of feeds generated by RSSHub. RSSHub caches feed until the TTL expires, so aggressively monitoring RSSHub feeds with a long TTL is unnecessary. This aims to reduce the load of RSStT instances, as well as RSSHub instances. No delay will be applied if TTL is unavailable or less than 5 minutes. Feeds not generated by RSSHub are unaffected, considering the widespread misuse of RSS TTL.
    • Defer monitoring as per Cloudflare cache: Ditto, but for feeds proxied by Cloudflare. If Cloudflare proxies a feed without caching it, no delay will be applied to the feed.
    • Better handling custom #hashtags: Invalid characters and punctuations that break hashtags are now replaced with _ (underscore) when setting custom hashtags.
    • Refine monitoring logging: The monitoring log has been refined to be more informative and easier to read.
    • Minor refactor: Some internal functions have been refactored to improve readability and maintainability.

    v2.7.0: 来自文章的 #hashtag、Python 3.12 支持和更多

    重大变更

    • 迁移到 aerich 0.7.2:aerich (RSStT 的一个依赖项) 0.7.x 中引入的一个重大变更使 RSStT 长期以来无法升级它。已经作出了很多努力,所以迁移预期为无缝的,且不应该造成任何破坏。但是,建议在升级 RSStT 之前进行数据库备份。如果您因迁移而遇到任何问题,请提交错误报告。

    亮点

    • 来自文章 (源条目) 的 #hashtag: 如果在 /set 或 /set_default 中启用,来自文章 (源条目) 的 hashtag,在与源的自定义 hashtag 合并后,将被添加到消息中。术语“来自文章的 hashtag”指的是 RSS <item> 或 Atom <entry> 中的 <category> 元素。此功能默认禁用。感谢 @maooyer 在 #449 中作出的初次贡献。
    • 支持 Python 3.12: 进行了一些小的修复以支持 Python 3.12。官方 Docker 镜像现在也基于 Python 3.12。
    • 使贡献更容易的辅助脚本: 在进行更新数据库模型的贡献时,创建数据库迁移文件并不是一件容易的事。scripts/aerich_helper.py 是一个可以简化这个流程的辅助脚本。将 --help 传递给脚本以查看详细的使用指南。

    增强

    • 根据 RSSHub TTL 推迟监控: 根据 RSSHub 生成的 feed 的 TTL (生存时间) 推迟监控。RSSHub 会缓存 feed 直到 TTL 过期,因此对 TTL 较长的 RSSHub feed 进行激进的监控是不必要的。这旨在减少 RSStT 实例以及 RSSHub 实例的负载。如果 TTL 不可用或小于 5 分钟,则不会应用延迟。考虑到 RSS TTL 被广泛误用的情况,并非由 RSSHub 生成的 feed 不受影响。
    • 根据 Cloudflare 缓存推迟监控: 同上,但适用于由 Cloudflare 代理的 feed。如果 Cloudflare 代理一个 feed 但不缓存它,将不会对这样的 feed 应用延迟。
    • 更好地处理自定义 #hashtag: 当设置自定义 hashtag 时,会将破坏 hashtag 的无效字符和标点符号替换为 _ (下划线)。
    • 改进了监控日志: 监控日志已经被改进,使其更加信息丰富和易于阅读。
    • 次要的重构: 重构了一些内部函数以提高可读性和可维护性。
  5. v2.6.0v2.6.0: Upload media to Telegraph, management enhancements2024-03-29 · 2024-03-29 15:07 UTC
    查看更新说明

    Highlights

    • Upload media to Telegraph: When generating Telegraph posts, images as well as videos will be uploaded to Telegraph. This is to solve anti-hotlinking issues and improve the load performance of posts. This feature depends on the latest version of the media relay server (Rongronggg9/rsstt-img-relay). Those images and videos that are too large to be uploaded will still be proxied by wsrv.nl (environment variable IMAGES_WESERV_NL) or media relay server (environment variable IMG_RELAY_SERVER). Thanks #431 for inspiration.

    Addition

    • Multiple managers: The environment variable MANAGER now accepts a single user ID as well as a list separated by ;, ,, (space), (linebreak), or (tab). Each user in the list will be able to manage the bot equally.
    • Customizable error logging chat: Previously, some error logs were always sent to the bot manager. To make it more flexible, a new environment variable ERROR_LOGGING_CHAT, accepting a single user/channel/group ID, has been added. If set, these error logs will be sent to the specified chat. Otherwise, the first user ID in MANAGER will be selected as default.

    Enhancements

    • Strip whitespaces in <li>: Strip whitespaces (including linebreaks) in <li> (list item) to improve readability. Only the leading and trailing whitespaces (including linebreaks) are stripped.
    • Only set "force reply" in groups: Only set ReplyKeyboardForceReply to True in groups. Previously, it was also set in private chats. See also "Bug fixes" below.
    • Minor refactor: Some internal functions have been refactored to improve readability and maintainability.

    Bug fixes

    • (/sub) "force reply" not cleared: Both /sub and /import set ReplyKeyboardForceReply to True to force the user to reply to the bot. However, due to a bug of Telegram, it keeps effective even if the user has made a reply, making the reply bar always reappear. Previously, a workaround has been applied to /import by deleting the prompt message containing ReplyKeyboardForceReply after the user has made a reply (see also #170). But /sub was forgotten at that time. Now the workaround has been applied to /sub too.
    • "Remote" /lang unavailable: Fix a bug preventing users from using the /lang command "remotely".

    v2.6.0: 上传媒体到 Telegraph、管理增强

    亮点

    • 上传媒体到 Telegraph: 在生成 Telegraph 文章时,图片和视频都将被上传到 Telegraph。这是为了解决防盗链问题和提高文章的加载性能。此功能依赖媒体反代服务器 (Rongronggg9/rsstt-img-relay) 的最新版本。由于太大而无法上传的图片和视频仍将由 wsrv.nl (环境变量 IMAGES_WESERV_NL) 或媒体反代服务器 (环境变量 IMG_RELAY_SERVER) 进行代理。感谢 #431 的启发。

    新增功能

    • 多个管理员: 环境变量 MANAGER 现在既接受单个用户 ID,也接受由 ;, ,, (空格), (换行) 或 (制表符) 分隔的列表。列表中的每个用户都可以平等地管理机器人。
    • 可自定义的错误日志会话: 先前,一些错误日志总是发送到 bot 管理员。为了使其更加灵活,添加了一个新的环境变量 ERROR_LOGGING_CHAT,其接受单个用户/频道/群组 ID。如果被设置,这些错误日志将被发送到指定的会话。否则,将选择 MANAGER 中的第一个用户 ID 作为默认值。

    增强

    • 除去 <li> 中的表层空格: 除去 <li> (列表项) 中的表层空格 (包括换行符) 以提高可读性。只有前导和尾随空格 (包括换行符) 被除去。
    • 只在群组中设置“强制回复”: 只在群组中设置 ReplyKeyboardForceReply 为 True。先前,它也在私聊中被设置。另请参阅下面的“Bug 修复”。
    • 次要的重构: 重构了一些内部函数以提高可读性和可维护性。

    Bug 修复

    • (/sub) “强制回复”未被清除: /sub 和 /import 都将 ReplyKeyboardForceReply 设置为 True 以强制用户回复 bot。然而,由于 Telegram 的一个 bug,即使用户已经回复过了,它仍然有效,导致回复栏总是重新出现。先前,通过在用户回复后删除包含 ReplyKeyboardForceReply 的提示消息,为 /import 应用了变通解决方案 (另请参阅 #170)。但是 /sub 在那时被遗忘了。现在,这个变通解决方案也被应用到了 /sub 上。
    • “远程” /lang 不可用:修复阻止用户“远程”使用 /lang 命令的错误。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    GitHub commit activity Translating status Code quality GitHub stars GitHub forks

    Telegram bot Telegram group Telegram channel

    简体中文 READMECHANGELOGFAQDocumentationChannels Using RSStT

    Highlights

    • Multi-user
    • I18n
      • English, Chinese, Cantonese, Italian, and more!
    • The content of the posts of an RSS feed will be sent to Telegram
      • Keep rich-text format
      • Keep media (customizable)
        • Images, Videos, and Audio both in the post content and enclosure; Documents in the post enclosure
        • Long images will be sent as files to prevent Telegram from compressing the image and making it unreadable
        • Drop annoying icons, they break the reading experience
      • Automatically replace emoji shortcodes with emoji
      • Automatically replace emoji images with emoji or its description text
      • Automatically determine whether the title of the RSS feed is auto-filled, if so, omit the title (customizable)
      • Automatically show the author-name (customizable)
      • Automatically split too-long messages
      • Messages can be sent as Telegraph posts (customizable)
    • Various customizable formatting settings
      • Hashtags, custom title, etc.
    • Individual proxy settings for Telegram and RSS feeds
    • OPML importing and exporting (keep custom title)
    • Optimized performance (see also the FAQ)
    • User-friendly
    • HTTP Caching

    Deployment

    dockeri.co
    Build status (master) Build status (dev)

    PyPI TestPyPI PyPI - Python Version
    PyPI publish status TestPyPI publish status PyPI - Downloads

    It is quite easy to deploy your RSStT instance. The most recommended way to deploy RSStT is Docker Compose: it is suitable for virtually all VPS. Railway.app (a PaaS platform) is also officially supported. You may also install RSStT from PyPI (tracking master branch) or TestPyPI (tracking dev branch, which is always up-to-date) using pip. For developers or experienced users, dirty run from source is also an option.

    For more details, refer to the deployment guide.

    Translation

    Read the translation guide here.

    You can help to translate the bot using Hosted Weblate. Special thanks to their free hosting service for libre projects!

    Using the public bot

    The public bot comes with absolutely no warranty. I will try my best to maintain it, but I cannot guarantee that it will always work perfectly. Meanwhile, you should "fair use" the bot, avoid subscribing to too many RSS feeds.
    If you use the public bot in your Channel, consider mentioning the bot (or this project) in your channel description (or pinned message) to let more people know about it. That's not a compulsion.

    Known channels using RSStT

    Want to preview what the messages sent by RSStT look like? Here is a list of channels using RSStT.

    Licensing

    This project is licensed under AGPLv3+. Closed-source distribution or bot-hosting are strictly prohibited. If you distribute or host it with code modifications, make sure the source code is available to anyone who can use the bot (by editing the repo URL in src/i18n/__init__.py).

    RSS to Telegram Bot
    Copyright (C) 2020-2024  Rongrong <[email protected]>
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation, either version 3 of the
    License, or (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.
    
    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
    

    The repository was forked from BoKKeR/RSS-to-Telegram-Bot in 2020. Since some time in 2021, they share no common codebase and should be considered as completely different projects.