Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
floviolleau committed Jul 31, 2023
2 parents 7296672 + f957eea commit b02b970
Show file tree
Hide file tree
Showing 114 changed files with 3,943 additions and 1,994 deletions.
10 changes: 7 additions & 3 deletions .github/prtester.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ def testBridges(bridges,status):
for listing in lists:
selectionvalue = ''
listname = listing.get('name')
if 'optgroup' in listing.contents[0].name:
listing = list(itertools.chain.from_iterable(listing))
cleanlist = []
for option in listing.contents:
if 'optgroup' in option.name:
cleanlist.extend(option)
else:
cleanlist.append(option)
firstselectionentry = 1
for selectionentry in listing:
for selectionentry in cleanlist:
if firstselectionentry:
selectionvalue = selectionentry.get('value')
firstselectionentry = 0
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/prhtmlgenerator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
- name: Check out rss-bridge
run: |
PR=${{github.event.number}};
wget -O requirements.txt https://raw.githubusercontent.com/RSS-Bridge/rss-bridge/master/.github/prtester-requirements.txt;
wget https://raw.githubusercontent.com/RSS-Bridge/rss-bridge/master/.github/prtester.py;
wget -O requirements.txt https://raw.githubusercontent.com/$GITHUB_REPOSITORY/${{ github.event.pull_request.base.ref }}/.github/prtester-requirements.txt;
wget https://raw.githubusercontent.com/$GITHUB_REPOSITORY/${{ github.event.pull_request.base.ref }}/.github/prtester.py;
wget https://patch-diff.githubusercontent.com/raw/$GITHUB_REPOSITORY/pull/$PR.patch;
touch DEBUG;
cat $PR.patch | grep " bridges/.*\.php" | sed "s= bridges/\(.*\)Bridge.php.*=\1=g" | sort | uniq > whitelist.txt
cat $PR.patch | grep "\bbridges/.*Bridge\.php\b" | sed "s=.*\bbridges/\(.*\)Bridge\.php\b.*=\1=g" | sort | uniq > whitelist.txt
- name: Start Docker - Current
run: |
docker run -d -v $GITHUB_WORKSPACE/whitelist.txt:/app/whitelist.txt -v $GITHUB_WORKSPACE/DEBUG:/app/DEBUG -p 3000:80 ghcr.io/rss-bridge/rss-bridge:latest
Expand Down
186 changes: 141 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

![RSS-Bridge](static/logo_600px.png)

RSS-Bridge is a PHP project capable of generating RSS and Atom feeds for websites that don't have one.
RSS-Bridge is a web application.

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

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

[![LICENSE](https://img.shields.io/badge/license-UNLICENSE-blue.svg)](UNLICENSE)
[![GitHub release](https://img.shields.io/github/release/rss-bridge/rss-bridge.svg?logo=github)](https://github.com/rss-bridge/rss-bridge/releases/latest)
Expand All @@ -17,43 +21,58 @@ RSS-Bridge is a PHP project capable of generating RSS and Atom feeds for website
|![Screenshot #5](/static/screenshot-5.png?raw=true)|![Screenshot #6](/static/screenshot-6.png?raw=true)|
|![Screenshot #7](/static/twitter-form.png?raw=true)|![Screenshot #8](/static/twitter-rasmus.png?raw=true)|

## A subset of bridges

* `YouTube` : YouTube user channel, playlist or search
* `Twitter` : Return keyword/hashtag search or user timeline
* `Telegram` : Return the latest posts from a public group
* `Reddit` : Return the latest posts from a subreddit or user
* `Filter` : Filter an existing feed url
* `Vk` : Latest posts from a user or group
* `FeedMerge` : Merge two or more existing feeds into one
* `Twitch` : Fetch the latest videos from a channel
* `ThePirateBay` : Returns the newest indexed torrents from [The Pirate Bay](https://thepiratebay.se/) with keywords

And [many more](bridges/), thanks to the community!
## A subset of bridges (17/412)

* `CssSelectorBridge`: [Scrape out a feed using CSS selectors](https://rss-bridge.org/bridge01/#bridge-CssSelectorBridge)
* `FeedMergeBridge`: [Combine multiple feeds into one](https://rss-bridge.org/bridge01/#bridge-FeedMergeBridge)
* `FeedReducerBridge`: [Reduce a noisy feed by some percentage](https://rss-bridge.org/bridge01/#bridge-FeedReducerBridge)
* `FilterBridge`: [Filter a feed by excluding/including items by keyword](https://rss-bridge.org/bridge01/#bridge-FilterBridge)
* `GettrBridge`: [Fetches the latest posts from a GETTR user](https://rss-bridge.org/bridge01/#bridge-GettrBridge)
* `MastodonBridge`: [Fetches statuses from a Mastodon (ActivityPub) instance](https://rss-bridge.org/bridge01/#bridge-MastodonBridge)
* `RedditBridge`: [Fetches posts from a user/subredit (with filtering options)](https://rss-bridge.org/bridge01/#bridge-RedditBridge)
* `RumbleBridge`: [Fetches channel/user videos](https://rss-bridge.org/bridge01/#bridge-RumbleBridge)
* `SoundcloudBridge`: [Fetches music by username](https://rss-bridge.org/bridge01/#bridge-SoundcloudBridge)
* `TelegramBridge`: [Fetches posts from a public channel](https://rss-bridge.org/bridge01/#bridge-TelegramBridge)
* `ThePirateBayBridge:` [Fetches torrents by search/user/category](https://rss-bridge.org/bridge01/#bridge-ThePirateBayBridge)
* `TikTokBridge`: [Fetches posts by username](https://rss-bridge.org/bridge01/#bridge-TikTokBridge)
* `TwitchBridge`: [Fetches videos from channel](https://rss-bridge.org/bridge01/#bridge-TwitchBridge)
* `TwitterBridge`: [Fetches tweets](https://rss-bridge.org/bridge01/#bridge-TwitterBridge)
* `VkBridge`: [Fetches posts from user/group](https://rss-bridge.org/bridge01/#bridge-VkBridge)
* `XPathBridge`: [Scrape out a feed using XPath expressions](https://rss-bridge.org/bridge01/#bridge-XPathBridge)
* `YoutubeBridge`: [Fetches videos by username/channel/playlist/search](https://rss-bridge.org/bridge01/#bridge-YoutubeBridge)
* `YouTubeCommunityTabBridge`: [Fetches posts from a channel's community tab](https://rss-bridge.org/bridge01/#bridge-YouTubeCommunityTabBridge)

[Full documentation](https://rss-bridge.github.io/rss-bridge/index.html)

Check out RSS-Bridge right now on https://rss-bridge.org/bridge01 or find another
Check out RSS-Bridge right now on https://rss-bridge.org/bridge01/

Alternatively find another
[public instance](https://rss-bridge.github.io/rss-bridge/General/Public_Hosts.html).

## Tutorial

RSS-Bridge requires php 7.4 (or higher).
### Install with composer or git

### Install with git:
Requires minimum PHP 7.4.

```bash
```shell
cd /var/www
composer create-project -v --no-dev rss-bridge/rss-bridge
```

```shell
cd /var/www
git clone https://github.com/RSS-Bridge/rss-bridge.git
```

Config:

```shell
# Give the http user write permission to the cache folder
chown www-data:www-data /var/www/rss-bridge/cache

# Optionally copy over the default config file
cp config.default.ini.php config.ini.php

# Optionally copy over the default whitelist file
cp whitelist.default.txt whitelist.txt
```

Example config for nginx:
Expand All @@ -74,9 +93,9 @@ server {
}
```

### Install with Docker:
### Install from Docker Hub:

Install by using docker image from Docker Hub:
Install by downloading the docker image from Docker Hub:

```bash
# Create container
Expand All @@ -88,7 +107,7 @@ docker start rss-bridge

Browse http://localhost:3000/

Install by locally building the image:
### Install by locally building from Dockerfile

```bash
# Build image from Dockerfile
Expand All @@ -97,13 +116,13 @@ docker build -t rss-bridge .
# Create container
docker create --name rss-bridge --publish 3000:80 rss-bridge

# Start the container
# Start container
docker start rss-bridge
```

Browse http://localhost:3000/

#### Install with docker-compose
### Install with docker-compose

Create a `docker-compose.yml` file locally with with the following content:
```yml
Expand All @@ -126,7 +145,7 @@ docker-compose up

Browse http://localhost:3000/

### Alternative installation methods
### Other installation methods

[![Deploy on Scalingo](https://cdn.scalingo.com/deploy/button.svg)](https://my.scalingo.com/deploy?source=https://github.com/sebsauvage/rss-bridge)
[![Deploy to Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
Expand Down Expand Up @@ -169,30 +188,95 @@ Learn more in [bridge api](https://rss-bridge.github.io/rss-bridge/Bridge_API/in

### How to enable all bridges

Write an asterisks to `whitelist.txt`:

echo '*' > whitelist.txt

Learn more in [enabling briges](https://rss-bridge.github.io/rss-bridge/For_Hosts/Whitelisting.html)
Modify `config.ini.php`:

### How to enable a bridge
enabled_bridges[] = *

Add the bridge name to `whitelist.txt`:
### How to enable some bridges

echo 'FirefoxAddonsBridge' >> whitelist.txt
```
enabled_bridges[] = TwitchBridge
enabled_bridges[] = GettrBridge
```
### How to enable debug mode
Set in `config.ini.php`:
The
[debug mode](https://rss-bridge.github.io/rss-bridge/For_Developers/Debug_mode.html)
disables the majority of caching operations.
enable_debug_mode = true
Learn more in [debug mode](https://rss-bridge.github.io/rss-bridge/For_Developers/Debug_mode.html).
### 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
### How to password-protect the instance
HTTP basic access authentication:
[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
[Create a new format](https://rss-bridge.github.io/rss-bridge/Format_API/index.html).
### How to run unit tests and linter
These commands require that you have installed the dev dependencies in `composer.json`.
./vendor/bin/phpunit
./vendor/bin/phpcs --standard=phpcs.xml --warning-severity=0 --extensions=php -p ./
### 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,
Expand All @@ -204,15 +288,19 @@ webmaster of
See [CONTRIBUTORS.md](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.
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 2023): @dvikan and @Mynacol #2519
## Reference
### FeedItem properties
### Feed item structure
This is the feed item structure that bridges are expected to produce.
```php
$item = [
Expand All @@ -235,13 +323,21 @@ That way you can host your own RSS-Bridge service with your favorite collection
]
```

### Output formats:
### 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

* `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
* `file`
* `sqlite`
* `memcached`
* `null`

### Licenses

Expand Down
8 changes: 2 additions & 6 deletions actions/ConnectivityAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,14 @@ public function execute(array $request)
return render_template('connectivity.html.php');
}

$bridgeClassName = $this->bridgeFactory->sanitizeBridgeName($request['bridge']);

if ($bridgeClassName === null) {
throw new \InvalidArgumentException('Bridge name invalid!');
}
$bridgeClassName = $this->bridgeFactory->createBridgeClassName($request['bridge']);

return $this->reportBridgeConnectivity($bridgeClassName);
}

private function reportBridgeConnectivity($bridgeClassName)
{
if (!$this->bridgeFactory->isWhitelisted($bridgeClassName)) {
if (!$this->bridgeFactory->isEnabled($bridgeClassName)) {
throw new \Exception('Bridge is not whitelisted!');
}

Expand Down
2 changes: 1 addition & 1 deletion actions/DetectAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function execute(array $request)
$bridgeFactory = new BridgeFactory();

foreach ($bridgeFactory->getBridgeClassNames() as $bridgeClassName) {
if (!$bridgeFactory->isWhitelisted($bridgeClassName)) {
if (!$bridgeFactory->isEnabled($bridgeClassName)) {
continue;
}

Expand Down
Loading

0 comments on commit b02b970

Please sign in to comment.