Skip to content

Commit 012f72e

Browse files
authored
Merge branch '2.x' into 2.x-englishTelegram
2 parents 3aa1fc6 + 8375a1a commit 012f72e

2 files changed

Lines changed: 129 additions & 9 deletions

File tree

‎Cargo.lock‎

Lines changed: 6 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎README.en.md‎

Lines changed: 123 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,126 @@
1+
# rssbot [![Build Status](https://github.com/iovxw/rssbot/workflows/Rust/badge.svg)](https://github.com/iovxw/rssbot/actions?query=workflow%3ARust) [![Github All Releases](https://img.shields.io/github/downloads/iovxw/rssbot/total.svg)](https://github.com/iovxw/rssbot/releases)
2+
3+
**Other Languages:** [Chinese](README.md)
4+
5+
Chinese Telegram RSS bot [@RustRssBot](http://t.me/RustRssBot)
6+
7+
**Supports:**
8+
- [x] RSS 0.9
9+
- [x] RSS 0.91
10+
- [x] RSS 0.92
11+
- [x] RSS 0.93
12+
- [x] RSS 0.94
13+
- [x] RSS 1.0
14+
- [x] RSS 2.0
15+
- [x] Atom 0.3
16+
- [x] Atom 1.0
17+
- [x] JSON Feed 1
18+
19+
## WIP
20+
121
English version is still work in progress.
222

3-
Unresolved problems:
23+
**Unresolved problems:**
24+
* The command description in Telegram can't be internationalized
25+
26+
## Usage
27+
28+
/rss - Display a list of currently subscribed RSS feeds
29+
/sub - Subscribe to an RSS: /sub http://example.com/feed.xml
30+
/unsub - Unsubscribe from an RSS: /unsub http://example.com/feed.xml
31+
/export - Export to OPML
32+
33+
## Download
34+
35+
The pre-compiled binaries can be downloaded directly from [Releases](https://github.com/iovxw/rssbot/releases). The Linux version is statically linked to *musl*, no other dependencies required.
36+
37+
## Compile
38+
39+
**Please try to download from the Link above, if that's not feasible or you have other requirements you should compile manually**
40+
41+
Install *Rust Nightly* and *Cargo* ([`rustup` recommended](https://www.rustup.rs/)) first, then:
42+
43+
```
44+
cargo build --release
45+
```
46+
47+
The compiled files are available at: `./target/release/rssbot`
48+
49+
## Run
50+
51+
```
52+
USAGE:
53+
rssbot [FLAGS] [OPTIONS] <token>
54+
55+
FLAGS:
56+
-h, --help Prints help information
57+
--insecure DANGER: Insecure mode, accept invalid TLS certificates
58+
-V, --version Prints version information
59+
60+
OPTIONS:
61+
-d, --database <database> Path to database [default: ./rssbot.json]
62+
--max-interval <max-interval> Maximum fetch interval, seconds [default: 43200]
63+
--min-interval <min-interval> Minimum fetch interval, seconds [default: 300]
64+
65+
ARGS:
66+
<token> Telegram bot token
67+
```
68+
69+
Please read the [official docs](https://core.telegram.org/bots#3-how-do-i-create-a-bot) to create a token.
70+
71+
## Environment variables
72+
73+
- `HTTP_PROXY`: Proxy for HTTP
74+
- `HTTPS_PROXY`: Proxy for HTTPS
75+
- `RSSBOT_DONT_PROXY_FEEDS`: Set to `1` to limit the proxy to Telegram requests
76+
- `NO_PROXY`: Not supported yet, wait for [reqwest#877](https://github.com/seanmonstar/reqwest/pull/877)
77+
78+
## Migrating from the old RSSBot
79+
80+
For the [original version of Clojure Bot ](https://github.com/iovxw/tg-rss-bot), you can use the following script to convert the database:
81+
82+
```bash
83+
#!/bin/bash
84+
85+
DATABASE=$1
86+
TARGET=$2
87+
88+
DATA=$(echo "SELECT url, title FROM rss;" | sqlite3 $DATABASE)
89+
IFS=$'\n'
90+
91+
echo -e "[\c" > $TARGET
92+
for line in ${DATA[@]}
93+
do
94+
IFS='|'
95+
r=($line)
96+
link=${r[0]}
97+
title=${r[1]}
98+
99+
echo -e "{\"link\":\"$link\"," \
100+
"\"title\":\"$title\"," \
101+
"\"error_count\":0," \
102+
"\"hash_list\":[]," \
103+
"\"subscribers\":[\c" >> $TARGET
104+
105+
subscribers=$(echo "SELECT subscriber FROM subscribers WHERE rss='$link';" | sqlite3 $DATABASE)
106+
IFS=$'\n'
107+
for subscriber in ${subscribers[@]}
108+
do
109+
echo -e "$subscriber,\c" >> $TARGET
110+
done
111+
112+
echo -e "]},\c" >> $TARGET
113+
done
114+
echo "]" >> $TARGET
115+
sed -i "s/,]/]/g" $TARGET
116+
```
117+
118+
Parameter 1 is the old database path, parameter 2 is the resulting output JSON path.
119+
120+
It should be noted that the RSS records that have been pushed will not be marked. If the converted database is used directly, the old RSS will be pushed repeatedly when the script is called again.
121+
122+
## License
123+
124+
This is free and unencumbered software released into the public domain.
4125

5-
- The command description in Telegram can't be internationalized
126+
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

0 commit comments

Comments
 (0)