Skip to content

Commit

Permalink
release 1.6.0
Browse files Browse the repository at this point in the history
Signed-off-by: Rongrong <[email protected]>
  • Loading branch information
Rongronggg9 committed Oct 8, 2021
1 parent 2d57f37 commit ede274c
Show file tree
Hide file tree
Showing 7 changed files with 188 additions and 108 deletions.
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: Rongronggg9
patreon: rongbot
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: 'https://afdian.net/@RongrongQAQ'
38 changes: 0 additions & 38 deletions .github/workflows/publish-docker-image-master.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: Publish Docker image (dev)
name: Publish Docker image
on:
push:
branches: [ dev ]
branches:
- master
- dev
tags:
- '**'
jobs:
push_to_docker_hub:
name: Push Docker image to Docker Hub
Expand All @@ -10,8 +14,20 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v2
with:
ref: dev
fetch-depth: 0
- name: Set Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ secrets.DOCKER_USERNAME }}/rss-to-telegram
flavor: |
latest=false
tags: |
type=ref,event=branch
type=pep440,pattern={{version}}
type=pep440,pattern={{major}}.{{minor}}
type=pep440,pattern={{major}}
type=raw,value=latest,enable=${{ endsWith(github.ref, 'master') }}
- name: Docker Hub README sync
uses: meeDamian/[email protected]
with:
Expand All @@ -35,4 +51,5 @@ jobs:
push: true
context: .
platforms: linux/amd64,linux/arm64
tags: ${{ secrets.DOCKER_USERNAME }}/rss-to-telegram:dev
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
132 changes: 132 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Changelog

## v1.6.0

### en

#### BREAKING CHANGE

- Telegram bot library has been migrated from `python-telegram-bot` (which uses HTTP Bot API and is synchronous)
to `telethon` (which uses MTProto Bot API and is asynchronous)
- However, to use MTProto Bot API, an API key is needed. The bot has 7 built-in API keys (collected on the Internet)
and in most cases it will not be unable to log in. But if so, please obtain your own API key (
see [docker-compose.yml.sample](https://github.com/Rongronggg9/RSS-to-Telegram-Bot/blob/53f11a473933e620d707c9d15f6d48737bd7a982/docker-compose.yml.sample#L43)
for details)

#### New features

- Thanks to the migration of Telegram bot library, bot can now connect to its DC directly, need not detour through the
HTTP Bot API and keep polling to get new messages. Which makes the bot receive and reply messages more rapidly and
lightweightedly. Even if the HTTP Bot API is down, the bot can still run unaffectedly. (more
details: [Advantages of MTProto over Bot API](https://docs.telethon.dev/en/latest/concepts/botapi-vs-mtproto.html#advantages-of-mtproto-over-bot-api)
, [MTProto vs HTTP Bot API](https://github.com/LonamiWebs/Telethon/wiki/MTProto-vs-HTTP-Bot-API))
- Support parsing more HTML elements
- `<iframe>`
- `<video><source><source>...</video>`
- `<code>`
- `<pre>`
- Support OPML importing and exporting
- Support sending too-long post via Telegraph (env var `TELEGRAPH_TOKEN` must be set)
- Support redis as db
- Note: This is a workaround for deploying the bot on [railway.app](), will be dropped in the future
- Support arm64 (docker build)
- Support resending a message using a media relay server if Telegram cannot send a message with media due to Telegram
server instability or network instability between media server and Telegram server
- Support colored logging
- `docker-compose.yml.sample`
- `/version` command to check bot version
- Automatically use proxy if global proxy (env var `SOCKS_PROXY`/`HTTP_PROXY`) set

#### Changes

- Assign feed monitoring tasks to every minute, instead of executing all at once each `DELAY`
- Thus, env var `DELAY` can only be 60~3600
- Note: env var `DELAY` will be deprecated in the future
- Recognize a post by its `guid`/`id` instead of `link`
- Simplify the output of `/list`
- Bump Python to 3.9 (docker build)
- Minor fixes

### zh-Hans

#### 重大变更

- 与 Telegram 交互的库由使用 HTTP Bot API 的同步库 `python-telegram-bot` 改为使用 MTProto Bot API 的异步库 `telethon`
- 这引入了 API key 的需求,程序已经内置了 7 个公开的 API key,通常情况下不应无法登入。如果无法登入,可以自己申请 API key (
详见 [docker-compose.yml.sample](https://github.com/Rongronggg9/RSS-to-Telegram-Bot/blob/53f11a473933e620d707c9d15f6d48737bd7a982/docker-compose.yml.sample#L43)
中的说明)

#### 新功能

- 由于 Telegram bot 库的替换,bot 可以直接连接到 bot 所属的 DC,不需绕经 HTTP Bot API;也不需轮询获得消息更新,它在接收及发送消息方面都更为迅速,资源占用也更低; 即使 HTTP Bot API
宕机,bot 也可以正常工作 (
详见 [Advantages of MTProto over Bot API](https://docs.telethon.dev/en/latest/concepts/botapi-vs-mtproto.html#advantages-of-mtproto-over-bot-api)
[MTProto vs HTTP Bot API](https://github.com/LonamiWebs/Telethon/wiki/MTProto-vs-HTTP-Bot-API))
- 支持更多元素的解析
- `<iframe>`
- `<video><source><source>...</video>`
- `<code>`
- `<pre>`
- 支持 OPML 导入导出
- 支持超长文章通过 Telegraph 发送 (必须先设置 `TELEGRAPH_TOKEN` 环境变量)
- 支持使用 redis 作为数据库
- 注意:这是为了在 [railway.app]() 上部署而设计的变通解决方案,未来很可能丢弃
- 支持 arm64 (docker 构建)
- 支持在由于 Telegram 服务器不稳定或 Telegram 服务器与媒体服务器之间的网络连接不稳定而导致 Telegram 无法发出带有媒体的消息时,使用媒体反代服务器重新发送。
- Support colored logging
- `docker-compose.yml.sample`
- 用于检查 bot 版本的 `/version` 命令
- 如果设置了全局代理 (环境变量 `SOCKS_PROXY`/`HTTP_PROXY`),会使用它们

#### 变更

- 将 feed 监视任务分配到每分钟,而不是每次 `DELAY` 一次性全部执行
- 因此,环境变量 `DELAY` 将只能被设置为 60~3600
- 注意:环境变量 `DELAY` 未来将被弃用
- 使用 `guid`/`id` 来辨识一个 post,而不是 `link`
- 简化了 `/list` 的输出
- 升级为 Python 3.9 (docker 构建)
- 次要的修复

## v1.5.0

### en

- Post parser is completely rewritten, more stable and can keep text formatting as much as possible
- GIF Support
- When the message is more than 10 pieces of media, send it in pieces
- Support video and pictures to be mixed in the same message arbitrarily
- Invalid media are no longer directly discarded, but attached to the end of the message as a link
- Automatically determine whether the title of the RSS feed is auto-filled, if so, omit the title
- Automatically show the author name
- Automatically replace emoji shortcodes with emoji
- Automatically replace emoji images with emoji or its description text
- When an image cannot be sent due to the instability of telegram api, the image server will be automatically replaced
and resent
- Only for Weibo images, non-Weibo images will be attached to the end of the message as a link
- Improve the text length counting method, no longer cause the message to be divided wrongly due to a long link URL
- Change the user-agent, because some websites have banned the UA of Requests
- Logging improvement

### zh-Hans

- **文章解码完全重写,更加稳定及更加忠实还原原有格式**
- **针对大量短动态类 RSS 源进行了测试**
- **即使是长文 RSS 源,也可以正确处理**
- **支持 GIF**
- **消息多于 10 张媒体时支持分条发送**
- **支持视频与图片任意混合于同一条消息**
- 超限媒体不再直接丢弃,而是作为链接附加到消息末尾
- 自动判断 RSS 源的标题是否为自动填充,并自动选择是否略去标题
- 自动显示作者名
- 自动替换 emoji shortcodes 为 emoji
- 自动替换满足某些特征的表情图片为 emoji 或其描述文本
- 因 telegram api 不稳定而无法发出图片时,自动更换图床服务器重发
- 仅限微博图源,非微博图源自动将所有媒体转为链接附加到消息末尾
- 改进文本长度计数方式,不再因为链接 url 过长而导致消息被提前分割
- 更改 user-agent,规避某些网站屏蔽 requests UA 的问题
- 改进的日志记录

## v1.0.0

initial public release
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ COPY . /app
RUN \
echo "$(git describe --tags --always)@$(git branch --show-current)" > .version ; \
if test $(expr length "$(cat .version)") -le 3; then echo "dirty-build@$(date -Iseconds)" | tee .version; else echo "build@$(date -Iseconds)" | tee -a .version; fi ; \
rm -rf .git resources && \
mkdir config
rm -rf .git .github resources && \
mkdir -p config

#----------------------------------------

Expand Down
83 changes: 20 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

<a href="https://github.com/Rongronggg9/RSS-to-Telegram-Bot"><img src="https://rongronggg9.github.io/external-resources/RSS-to-Telegram-Bot/RSStT_icon.svg" width = "256" height = "256" alt="RSStT_icon"/><a/>

[更新日志 CHANGELOG](CHANGELOG.md)

本项目现改以 AGPLv3 许可证分发,这是为了将来的多用户功能准备的。

加入频道 [@RSStT_Channel](https://t.me/RSStT_Channel) 以获取更新资讯;加入群组 [@RSStT_Group](https://t.me/RSStT_Group) 以参与讨论或反馈问题。
Expand All @@ -16,39 +18,22 @@

[Railway 部署教程](https://telegra.ph/%E9%80%9A%E8%BF%87-Railway-%E9%83%A8%E7%BD%B2-RSS-to-Telegram-Bot-09-13)

## 新功能 in v1.5
> 注意:由于未来可能加入多用户功能而导致数据库及配置文件变更,请时常备份订阅列表(目前仅可通过 `/test` 备份)
- **文章解码完全重写,更加稳定及更加忠实还原原有格式**
- **针对大量短动态类 RSS 源进行了测试**
- **即使是长文 RSS 源,也可以正确处理**
- **支持 GIF**
- **消息多于 10 张媒体时支持分条发送**
- **支持视频与图片任意混合于同一条消息**
- 超限媒体不再直接丢弃,而是作为链接附加到消息末尾
- 自动判断 RSS 源的标题是否为自动填充,并自动选择是否略去标题
- 自动显示作者名
- 自动替换 emoji shortcodes 为 emoji
- 自动替换满足某些特征的表情图片为 emoji 或其描述文本
- 因 telegram api 不稳定而无法发出图片时,自动更换图床服务器重发
- 仅限微博图源,非微博图源自动将所有媒体转为链接附加到消息末尾
- 改进文本长度计数方式,不再因为链接 url 过长而导致消息被提前分割
- 更改 user-agent,规避某些网站屏蔽 requests UA 的问题
- 改进的日志记录

## 功能

- 将 RSS 全文转发到 Telegram
- 转发时尽量还原原有格式
- 转发时自动将微博表情转化为同义 emoji
- 将 RSS 全文发送到 Telegram
- 还原原有格式
- 自动判断 RSS 源的标题是否为自动填充,并自动选择是否略去标题
- 自动显示作者名
- 将微博表情或 emoji shortcodes 转化为 emoji
- 仅限有同义 emoji 的微博表情
- 超长消息自动分割
- 多媒体消息编码后大于 1024 字,无图消息编码后大于 4096 字
- 如果配置了 Telegraph,则会自动通过 Telegraph 发送
- 支持对 Telegram Bot API 和 RSS 订阅分别配置代理
- 支持含图消息转发
- 至多 10 张图片
- 支持含媒体消息转发
- 至多 10 个媒体,可以是图片或视频
- 自动缩小大于 5MB 或尺寸过大 (宽度 + 高度 <= 10000) 的图片
- 仅限微博图源,~~其他图源的过大图片将被直接丢弃~~
- ~~(alpha)~~ 支持视频转发
- 仅限微博图源,其他图源的图片将被转为链接附加至消息末尾
- 支持 OPML 导入导出
- 转发失败时向 `MANAGER` 发送含错误信息的提示 **(未设定则直接发送至 `CHATID` )**
- **设定 `MANAGER` 时只会响应对应用户的命令 (未设定则只响应 `CHATID` 对应用户的命令)**

Expand All @@ -57,10 +42,6 @@

## 已知的问题

- ~~针对 RSSHub 生成的微博 RSS 源编写,对于其他 RSS 源可能出现不可预料的问题~~
- ~~非微博图源的过大图片/视频将被直接丢弃~~
- ~~图片至多 10 张 (考虑到微博已推出超九图功能,将在未来修复)~~
- 微博视频转发清晰度较低,~~若视频过大也将被直接丢弃~~
- 用于频道时,无法接受频道内的命令,需直接对 bot 在私人对话中发送命令
- **必须设定 `MANAGER` 并使用其对应的用户操作,否则不会响应**
- 没有多用户功能,仅可向一个用户/频道 ( `CHATID` ) 推送 RSS
Expand Down Expand Up @@ -99,32 +80,13 @@
For the docker image go to: https://hub.docker.com/r/rongronggg9/rss-to-telegram

```sh
docker create \
--name <container name> \
--restart unless-stopped \
-v </path/to/config>:/app/config \
-e DELAY=<delay> \
-e TOKEN=<bot_token> \
-e CHATID=<target_user_userid / @channel_username> \
-e MANAGER=<bot_manager_userid> \
-e T_PROXY=<scheme://host:port/> \
-e R_PROXY=<scheme://host:port/> \
rongronggg9/rss-to-telegram
mkdir rsstt
cd rsstt
wget https://raw.githubusercontent.com/Rongronggg9/RSS-to-Telegram-Bot/master/docker-compose.yml.sample -O docker-compose.yml
vi docker-compose.yml # 自行按文件中的注释修改 docker-compose.yml
docker-compose up -d
```

```sh
docker start <container name>
```

#### Note

- 如果想测试最新的功能,请将最后的 `rongronggg9/rss-to-telegram` 替换为 `rongronggg9/rss-to-telegram:dev`
- 尖括号`<>`表示需要用户填入自己的配置,尖括号`<>`本身不是命令的一部分
- 请务必设置`-v </path/to/config>:/app/config`,否则重新配置容器后订阅数据将丢失
- `T_PROXY` 对 Telegram Bot API 生效,`R_PROXY` 对 RSS 订阅生效,不使用代理可直接略去。考虑到 DNS 污染问题,请尽量使用 socks5 代理,并在填入的代理 URL 里使用`socks5h`
而不是`socks5`,示例: `socks5h://127.0.0.1:1080/`
- 版本号没有特别意义,目前没有针对各版本号特别构建 docker 镜像

### Installation

Python 3.8+
Expand All @@ -134,17 +96,12 @@ Remember to replace `<arg>`, `<` and `>` should be deleted.
```sh
git clone https://github.com/Rongronggg9/RSS-to-Telegram-Bot.git
cd RSS-to-Telegram-Bot
pip install -r requirements.txt
pip3 install -r requirements.txt
export PYTHONUNBUFFERED=1
export DELAY=<delay>
export TOKEN=<bot token>
export CHATID=<target user userid / @channel_username>
export MANAGER=<bot manager userid>
export T_PROXY=<scheme://host:port/>
export R_PROXY=<scheme://host:port/>
# 参照 docker-compose.yml export 环境变量
python3 -u telegramRSSbot.py
```

## 备注

本项目原是 [BoKKeR/RSS-to-Telegram-Bot](https://github.com/BoKKeR/RSS-to-Telegram-Bot) 的 fork ,考虑到改动较大, 因此复制成独立的 repository
本项目原是 [BoKKeR/RSS-to-Telegram-Bot](https://github.com/BoKKeR/RSS-to-Telegram-Bot) 的 fork ,目前除了数据库和命令名已经没有任何相像的地方了
2 changes: 1 addition & 1 deletion docker-compose.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
#- API_ID=1025907 # 若要使用自己的 API key,在 https://core.telegram.org/api/obtaining_api_id 创建,并替换前面的值
#- API_HASH=452b0359b988148995f22ff0f4229750 # 同上
#- IMG_RELAY_SERVER=https://rsstt-img-relay.rongrong.workers.dev/ # 自定义 Telegram 获取图片错误的时候换用的反代服务器,参见 https://github.com/rongronggg9/rsstt-img-relay
#- USER_AGENT=rsstt # 自定义网络请求使用的 User-Agent
#- USER_AGENT=RSStT # 自定义网络请求使用的 User-Agent
#- T_PROXY=socks5h://host.docker.internal:1080 # 连接 Telegram API 使用的代理,用 host.docker.internal 代替 localhost
#- R_PROXY=socks5h://host.docker.internal:1080 # 获取 RSS 订阅使用的代理, 用 host.docker.internal 代替 localhost
#- DEBUG=1 # 若要开启 debug 日志输出,请取消注释该行
Expand Down

0 comments on commit ede274c

Please sign in to comment.