Tiny Tiny RSS#
Upgrade#
Updating to a major TT-RSS version requires a database migration. This happens for example when you upgrade from Debian 10 (TT-RSS 18) to Debian 11 (TT-RSS 21)
Vedi anche
Tiny Tiny RSS - ArchWiki [1]
make a backup of the database
update TT-RSS
sudo -u www-data -- /usr/bin/php /usr/share/tt-rss/www/update.php --update-schema=force-yes
Torification#
TT-RSS can download all feeds through TOR.
Some websites actively block TOR exit node addresses. In this case you will need to configure an RSS bridge/proxy which can be simply a script that downloads the RSS XML file through clearnet. This file must then be served on a system that is accessible to your TT-RSS instance.
Vedi anche
Tiny Tiny RSS over TOR [2]
install TOR and Privoxy
apt-get install tor privoxy
Check that TOR is running
systemctl status tor@default.service
configure Privoxy. Add this content to the
configuration file
1forward-socks5t / 127.0.0.1:9050 . 2listen-address 127.0.0.1:8123 3 4# [ ... ]
Nota
You can add more forwarding rules to ignore routing the traffic through TOR for specific domains. Have a look at the
/etc/privoxy/config
file provided by the package which is well documented.append the following at the end of
TT-RSS's configuration file
1 // [ ... ] 2 3 define('HTTP_PROXY', '127.0.0.1:8123'); 4 define('_HTTP_PROXY', '127.0.0.1:8123'); 5 define('_CURL_HTTP_PROXY', '127.0.0.1:8123'); 6 define('SELF_USER_AGENT', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0');
These variables should cover recent TT-RSS versions.
restart the services
systemctl restart tt-rss privoxy ${webserver}
Feed proxy#
Sometimes TT-RSS is unable to fetch feeds. You can use this script to act as a bridge to download the XML files directly. You need a running webserver, in this example Apache HTTPD, and then point TT-RSS to the new RSS feed URLs.
install the dependencies
apt-get install python3-yaml
install fpyutils. See reference
create a new user
useradd -m -s /bin/bash -U rss passwd rss usermod -aG jobs rss
create the jobs directories. See reference
mkdir -p /home/jobs/{scripts,services}/by-user/rss
create the
script
1#!/usr/bin/env python3 2# 3# feed_proxy.py 4# 5# Copyright (C) 2021-2022 Franco Masotti (franco \D\o\T masotti {-A-T-} tutanota \D\o\T com) 6# 7# This program is free software: you can redistribute it and/or modify 8# it under the terms of the GNU General Public License as published by 9# the Free Software Foundation, either version 3 of the License, or 10# (at your option) any later version. 11# 12# This program is distributed in the hope that it will be useful, 13# but WITHOUT ANY WARRANTY; without even the implied warranty of 14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15# GNU General Public License for more details. 16# 17# You should have received a copy of the GNU General Public License 18# along with this program. If not, see <https://www.gnu.org/licenses/>. 19r"""Save RSS feeds.""" 20 21import pathlib 22import shlex 23import sys 24import time 25 26import requests 27import yaml 28 29if __name__ == '__main__': 30 configuration_file = shlex.quote(sys.argv[1]) 31 config = yaml.load(open(configuration_file), Loader=yaml.SafeLoader) 32 33 for f in config['feeds']: 34 for feed in f: 35 try: 36 if f[feed]['user_agent'] == '': 37 headers = dict() 38 else: 39 headers = {'User-Agent': f[feed]['user_agent']} 40 r = requests.get(f[feed]['url'], headers=headers, timeout=60) 41 full_path_file = str( 42 pathlib.Path(config['files']['base_path'], 43 f[feed]['relative_path'])) 44 # Write the new file as binary. 45 with open(full_path_file, 'wb') as f: 46 f.write(r.content) 47 48 except requests.exceptions.RequestException as e: 49 print(e) 50 51 time.sleep(config['network']['sleep_seconds_between_feeds'])
create a
configuration file
1# 2# feed_proxy.mypurpose.yaml 3# 4# Copyright (C) 2021-2022 Franco Masotti (franco \D\o\T masotti {-A-T-} tutanota \D\o\T com) 5# 6# This program is free software: you can redistribute it and/or modify 7# it under the terms of the GNU General Public License as published by 8# the Free Software Foundation, either version 3 of the License, or 9# (at your option) any later version. 10# 11# This program is distributed in the hope that it will be useful, 12# but WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14# GNU General Public License for more details. 15# 16# You should have received a copy of the GNU General Public License 17# along with this program. If not, see <https://www.gnu.org/licenses/>. 18 19feeds: 20 - Feed one: 21 url: 'https://some.domain/atom.xml' 22 relative_path: 'some_domain.xml' 23 # Leave empty for default. 24 user_agent: '' 25 - Feed two: 26 url: 'https://another.domain/rss.xml' 27 relative_path: 'another.xml' 28 user_agent: '' 29 30files: 31 base_path: '/var/www/feeds' 32 33network: 34 sleep_seconds_between_feeds: 10
Importante
files.base_path
must point to a readable directory of the webserver, for example/var/www
create the
Systemd service unit file
1[Unit] 2Description=Feed proxy mypurpose 3Requires=network-online.target 4After=network-online.target 5 6[Service] 7Type=simple 8ExecStart=/home/jobs/scripts/by-user/rss/feed_proxy.py /home/jobs/scripts/by-user/rss/feed_proxy.mypurpose.yaml 9User=rss 10Group=rss
Nota
You can use
torsocks
to retrieve feeds via TOR.create the
Systemd service timer unit file
1[Unit] 2Description=Once every 60 minutes feed proxy mypurpose 3 4[Timer] 5OnCalendar=hourly 6Persistent=true 7 8[Install] 9WantedBy=timers.target
add the
rss
user to the group of the user running the webserver,www-data
usermod -aG www-data rss
run the deploy script
Footnotes