0
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2024-12-30 14:48:00 +00:00
Go to file
2024-12-30 00:19:18 +01:00
.devcontainer Docker from Debian base image (#3500) 2023-09-13 18:08:22 +02:00
.github [prtester] Update python dependency (#4311) 2024-10-20 19:16:29 +02:00
actions refactor: extract exception and cache middleware (#4248) 2024-09-01 21:48:14 +02:00
bin fix: bug in prior fix (#4243) 2024-08-30 02:44:50 +02:00
bridges [WirecutterDealsBridge] Add bridge (#4359) 2024-12-12 17:52:41 +01:00
cache [TwitterBridge] Fix the bridge using a brand new API 2020-06-05 10:17:53 +02:00
caches fix(file_cache): if write failure, produce log record instead of exception (#4352) 2024-11-28 03:50:56 +01:00
config fix: escape token for html context (#3966) 2024-02-09 07:27:16 +01:00
contrib chore: prepare 2023-09-24 release (#3703) 2023-09-24 20:53:07 +02:00
docs Formatting fix "For Hosts" documentation (#4317) 2024-11-03 18:33:05 +01:00
formats refactor: format rendering (#4229) 2024-08-23 17:34:06 +02:00
lib fix: broken if_not_modified_since (#4377) 2024-12-30 00:19:18 +01:00
middlewares fix(spotify): detect rate limiting (#4253) 2024-09-03 07:02:37 +02:00
static fix: dont remove www from anchors in DOM, fix #4114 (#4135) 2024-06-18 20:55:05 +02:00
templates refactor: extract exception and cache middleware (#4248) 2024-09-01 21:48:14 +02:00
tests refactor: format rendering (#4229) 2024-08-23 17:34:06 +02:00
.dockerignore [Docker file] Fix wrong version string in docker images (#2497) 2022-03-14 05:48:40 +05:00
.git-blame-ignore-revs Add .git-blame-ignore-revs file (#2903) 2022-07-08 17:00:34 +02:00
.gitattributes Include all bridges in tarballs 2024-10-09 18:10:52 +02:00
.gitignore fix: add cache clearing tools (#3896) 2024-01-17 20:10:32 +01:00
app.json Update app.json 2022-04-26 22:43:13 +02:00
composer.json chore: increase linter speed (#4211) 2024-08-11 02:31:50 +02:00
composer.lock chore: upgrade composer root deps (#3974) 2024-02-09 22:39:45 +01:00
config.default.ini.php refactor: frontpage and proxy setting (#4214) 2024-08-18 19:11:11 +02:00
CONTRIBUTORS.md [EBayBridge] Repair & Augment the eBay Feed (#4157) 2024-07-29 17:53:39 +02:00
docker-bake.hcl New docker build mechanism (#2268) 2021-10-03 16:06:30 +02:00
docker-compose.yml docs: improve docker docs (#4183) 2024-08-01 23:36:14 +02:00
docker-entrypoint.sh Fix Docker exec (#3941) 2024-02-01 16:57:14 +01:00
Dockerfile docker: Use pre-built curl-impersonate library from github releases (#3984) 2024-02-20 08:03:04 +01:00
index.php refactor: extract exception and cache middleware (#4248) 2024-09-01 21:48:14 +02:00
phpcompatibility.xml refactor: general code base refactor (#2950) 2022-08-06 22:46:28 +02:00
phpcs.xml ci: disallow the sizeof function in linter (#4134) 2024-06-18 20:22:46 +02:00
phpunit.xml refactor: rename rssbridge.php to bootstrap.php (#2987) 2022-08-27 23:01:06 +02:00
README.md docs: improve docker docs (#4183) 2024-08-01 23:36:14 +02:00
scalingo.json Typo 2016-08-02 23:37:01 +02:00
UNLICENSE let's unlicense ! 2014-05-21 20:11:01 +02:00

RSS-Bridge

RSS-Bridge

RSS-Bridge is a PHP web application.

It generates web feeds for websites that don't have one.

Officially hosted instance: https://rss-bridge.org/bridge01/

IRC channel #rssbridge at https://libera.chat/

Full documentation

Alternatively find another public instance.

Requires minimum PHP 7.4.

LICENSE GitHub release irc.libera.chat Actions Status

Screenshot #1 Screenshot #2
Screenshot #3 Screenshot #4
Screenshot #5 Screenshot #6

A subset of bridges (16/447)

Tutorial

How to install on traditional shared web hosting

RSS-Bridge can basically be unzipped into a web folder. Should be working instantly.

Latest zip: https://github.com/RSS-Bridge/rss-bridge/archive/refs/heads/master.zip (2MB)

How to install on Debian 12 (nginx + php-fpm)

These instructions have been tested on a fresh Debian 12 VM from Digital Ocean (1vcpu-512mb-10gb, 5 USD/month).

timedatectl set-timezone Europe/Oslo

apt install git nginx php8.2-fpm php-mbstring php-simplexml php-curl php-intl

# Create a user account
useradd --shell /bin/bash --create-home rss-bridge

cd /var/www

# Create folder and change ownership
mkdir rss-bridge && chown rss-bridge:rss-bridge rss-bridge/

# Become user
su rss-bridge

# Fetch latest master
git clone https://github.com/RSS-Bridge/rss-bridge.git rss-bridge/
cd rss-bridge

# Copy over the default config
cp -v config.default.ini.php config.ini.php

# Give full permissions only to owner (rss-bridge)
chmod 700 -R ./

# Give read and execute to others (nginx and php-fpm)
chmod o+rx ./ ./static

# Give read to others (nginx)
chmod o+r -R ./static

Nginx config:

# /etc/nginx/sites-enabled/rss-bridge.conf

server {
    listen 80;

    # TODO: change to your own server name
    server_name example.com;

    access_log /var/log/nginx/rss-bridge.access.log;
    error_log /var/log/nginx/rss-bridge.error.log;
    log_not_found off;

    # Intentionally not setting a root folder here

    # autoindex is off by default but feels good to explicitly turn off
    autoindex off;

    # Static content only served here
    location /static/ {
        alias /var/www/rss-bridge/static/;
    }

    # Pass off to php-fpm when location is exactly /
    location = / {
        root /var/www/rss-bridge/;
        include snippets/fastcgi-php.conf;
        fastcgi_read_timeout 45s;
        fastcgi_pass unix:/run/php/rss-bridge.sock;
    }

    # Reduce spam
    location = /favicon.ico {
        access_log off;
    }

    # Reduce spam
    location = /robots.txt {
        access_log off;
    }
}

PHP FPM pool config:

; /etc/php/8.2/fpm/pool.d/rss-bridge.conf

[rss-bridge]

user = rss-bridge
group = rss-bridge

listen = /run/php/rss-bridge.sock

listen.owner = www-data
listen.group = www-data

# Create 10 workers standing by to serve requests
pm = static
pm.max_children = 10

# Respawn worker after 500 requests (workaround for memory leaks etc.) 
pm.max_requests = 500

PHP ini config:

; /etc/php/8.2/fpm/conf.d/30-rss-bridge.ini

max_execution_time = 15
memory_limit = 64M

Restart fpm and nginx:

# Lint and restart php-fpm
php-fpm8.2 -t && systemctl restart php8.2-fpm

# Lint and restart nginx
nginx -t && systemctl restart nginx

How to install from Composer

Install the latest release.

cd /var/www
composer create-project -v --no-dev --no-scripts rss-bridge/rss-bridge

How to install with Caddy

TODO. See https://github.com/RSS-Bridge/rss-bridge/issues/3785

Install from Docker Hub:

Install by downloading the docker image from Docker Hub:

# Create container
docker create --name=rss-bridge --publish 3000:80 --volume $(pwd)/config:/config rssbridge/rss-bridge

You can put custom config.ini.php and bridges into ./config.

You must restart container for custom changes to take effect.

See docker-entrypoint.sh for details.

# Start container
docker start rss-bridge

Browse http://localhost:3000/

Install by locally building from Dockerfile

# Build image from Dockerfile
docker build -t rss-bridge .

# Create container
docker create --name rss-bridge --publish 3000:80 --volume $(pwd)/config:/config rss-bridge

You can put custom config.ini.php and bridges into ./config.

You must restart container for custom changes to take effect.

See docker-entrypoint.sh for details.

# Start container
docker start rss-bridge

Browse http://localhost:3000/

Install with docker-compose (using Docker Hub)

You can put custom config.ini.php and bridges into ./config.

You must restart container for custom changes to take effect.

See docker-entrypoint.sh for details.

docker-compose up

Browse http://localhost:3000/

Other installation methods

Deploy on Scalingo Deploy to Heroku Deploy to Cloudron Run on PikaPods

The Heroku quick deploy currently does not work. It might work if you fork this repo and modify the repository in scalingo.json. See https://github.com/RSS-Bridge/rss-bridge/issues/2688

Learn more in Installation.

How-to

How to fix "Access denied."

Output is from php-fpm. It is unable to read index.php.

chown rss-bridge:rss-bridge /var/www/rss-bridge/index.php

How to password-protect the instance (token)

Modify config.ini.php:

[authentication]

token = "hunter2"

How to remove all cache items

As current user:

bin/cache-clear

As user rss-bridge:

sudo -u rss-bridge bin/cache-clear

As root:

sudo bin/cache-clear

How to remove all expired cache items

bin/cache-prune

How to fix "PHP Fatal error: Uncaught Exception: The FileCache path is not writable"

# Give rss-bridge ownership
chown rss-bridge:rss-bridge -R /var/www/rss-bridge/cache

# Or, give www-data ownership
chown www-data:www-data -R /var/www/rss-bridge/cache

# Or, give everyone write permission
chmod 777 -R /var/www/rss-bridge/cache

# Or last ditch effort (CAREFUL)
rm -rf /var/www/rss-bridge/cache/ && mkdir /var/www/rss-bridge/cache/

How to fix "attempt to write a readonly database"

The sqlite files (db, wal and shm) are not writeable.

chown -v rss-bridge:rss-bridge cache/*

How to fix "Unable to prepare statement: 1, no such table: storage"

rm cache/*

How to create a new bridge from scratch

Create the new bridge in e.g. bridges/BearBlogBridge.php:

<?php

class BearBlogBridge extends BridgeAbstract
{
    const NAME = 'BearBlog (bearblog.dev)';

    public function collectData()
    {
        $dom = getSimpleHTMLDOM('https://herman.bearblog.dev/blog/');
        foreach ($dom->find('.blog-posts li') as $li) {
            $a = $li->find('a', 0);
            $this->items[] = [
                'title' => $a->plaintext,
                'uri' => 'https://herman.bearblog.dev' . $a->href,
            ];
        }
    }
}

Learn more in bridge api.

How to enable all bridges

enabled_bridges[] = *

How to enable some bridges

enabled_bridges[] = TwitchBridge
enabled_bridges[] = GettrBridge

How to enable debug mode

The debug mode disables the majority of caching operations.

enable_debug_mode = true

How to switch to memcached as cache backend

[cache]

; Cache backend: file (default), sqlite, memcached, null
type = "memcached"

How to switch to sqlite3 as cache backend

type = "sqlite"

How to disable bridge errors (as feed items)

When a bridge fails, RSS-Bridge will produce a feed with a single item describing the error.

This way, feed readers pick it up and you are notified.

If you don't want this behaviour, switch the error output to http:

[error]

; Defines how error messages are returned by RSS-Bridge
;
; "feed" = As part of the feed (default)
; "http" = As HTTP error message
; "none" = No errors are reported
output = "http"

How to accumulate errors before finally reporting it

Modify report_limit so that an error must occur 3 times before it is reported.

; Defines how often an error must occur before it is reported to the user
report_limit = 3

The report count is reset to 0 each day.

How to password-protect the instance (HTTP Basic Auth)

[authentication]

enable = true
username = "alice"
password = "cat"

Will typically require feed readers to be configured with the credentials.

It may also be possible to manually include the credentials in the URL:

https://alice:cat@rss-bridge.org/bridge01/?action=display&bridge=FabriceBellardBridge&format=Html

How to create a new output format

See formats/PlaintextFormat.php for an example.

How to run unit tests and linter

These commands require that you have installed the dev dependencies in composer.json.

Run all tests:

./vendor/bin/phpunit

Run a single test class:

./vendor/bin/phpunit --filter UrlTest

Run linter:

./vendor/bin/phpcs --standard=phpcs.xml --warning-severity=0 --extensions=php -p ./

https://github.com/squizlabs/PHP_CodeSniffer/wiki

How to spawn a minimal development environment

php -S 127.0.0.1:9001

http://127.0.0.1:9001/

Explanation

We are RSS-Bridge community, a group of developers continuing the project initiated by sebsauvage, webmaster of sebsauvage.net, author of Shaarli and ZeroBin.

See CONTRIBUTORS.md

RSS-Bridge uses caching to prevent services from banning your server for repeatedly updating feeds. The specific cache duration can be different between bridges. Cached files are deleted automatically after 24 hours.

RSS-Bridge allows you to take full control over which bridges are displayed to the user. That way you can host your own RSS-Bridge service with your favorite collection of bridges!

Current maintainers (as of 2024): @dvikan and @Mynacol #2519

Reference

Feed item structure

This is the feed item structure that bridges are expected to produce.

    $item = [
        'uri' => 'https://example.com/blog/hello',
        'title' => 'Hello world',
        // Publication date in unix timestamp
        'timestamp' => 1668706254,
        'author' => 'Alice',
        'content' => 'Here be item content',
        'enclosures' => [
            'https://example.com/foo.png',
            'https://example.com/bar.png'
        ],
        'categories' => [
            'news',
            'tech',
        ],
        // Globally unique id
        'uid' => 'e7147580c8747aad',
    ]

Output formats

  • Atom: Atom feed, for use in feed readers
  • Html: Simple HTML page
  • Json: JSON, for consumption by other applications
  • Mrss: MRSS feed, for use in feed readers
  • Plaintext: Raw text, for consumption by other applications
  • Sfeed: Text, TAB separated

Cache backends

  • File
  • SQLite
  • Memcached
  • Array
  • Null

Licenses

The source code for RSS-Bridge is Public Domain.

RSS-Bridge uses third party libraries with their own license:

Rant

Dear so-called "social" websites.

Your catchword is "share", but you don't want us to share. You want to keep us within your walled gardens. That's why you've been removing RSS links from webpages, hiding them deep on your website, or removed feeds entirely, replacing it with crippled or demented proprietary API. FUCK YOU.

You're not social when you hamper sharing by removing feeds. You're happy to have customers creating content for your ecosystem, but you don't want this content out - a content you do not even own. Google Takeout is just a gimmick. We want our data to flow, we want RSS or Atom feeds.

We want to share with friends, using open protocols: RSS, Atom, XMPP, whatever. Because no one wants to have your service with your applications using your API force-feeding them. Friends must be free to choose whatever software and service they want.

We are rebuilding bridges you have willfully destroyed.

Get your shit together: Put RSS/Atom back in.