Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Generate RSS feeds for specified subreddits with score thresholds

License

NotificationsYou must be signed in to change notification settings

johnwarne/reddit-top-rss

Repository files navigation

This project has been superseded byUpvote RSS, my newer project that adds feed support for article content, summaries, comments, media embeds, additional platforms (Lemmy and Hacker News), and others. Check it out!

https://github.com/johnwarne/upvote-rss

Reddit Top RSS

Reddit Top RSS is a set of scripts forReddit's API that generates RSS feeds for specified subreddits with score thresholds. To preview your outputted feed items there is a front end that utilizes the Bootstrap v4 framework.

Preview

Reddit Top RSS screenshot

Motivation

I prefer to interact with Reddit in a low-volume way, so I let Reddit Top RSS surface the most popular posts per subreddit in myRSS reader of choice. I usually use theaveragePostsPerDay filter so I can expect a certain amount of posts in my feeds per day.

Installation and usage

Reddit app setup

Due to Reddit's 2023 updated API policies it is now required to first set up an app in your Reddit account that Reddit Top RSS will authenticate through.

  1. First, log into your Reddit account.
  2. Navigate to the Reddit app preferences page:https://www.reddit.com/prefs/apps
  3. Click thecreate app orcreate another app button, depending on whether you’ve already created an app before.
  4. Choose any name for the app. I've chosenTop RSS. Reddit will not allow you to useReddit in the name.
  5. Set the type of app toweb app.
  6. You can leavedescription andabout url fields blank.
  7. Enter in any valid URI in theredirect uri field. I've usedhttp://reddit-top-rss.test.
  8. Click thecreate app button when you’re done.
  9. Your app’s client ID and client secret will be displayed. You'll need to add these to either yourconfig.php or Docker environment variables.

Manual

To install this repository manually:

  1. Clone this repository somewhere with PHP >= 5.6 installed.
  2. Copyconfig-default.php toconfig.php.
  3. Enter your Reddit user, app ID, and secret into lines 49, 56, and 63, respectively.
  4. Openindex.php in a browser to view the front end.
  5. Enter your parameters into the fields to get a preview of the posts that the filters will output. Click theRSS button at top to open a new tab with the rendered RSS XML output of the specified filters. This is the URL you subscribe to in your RSS aggregator.

Docker

A docker image is available athttps://hub.docker.com/r/johnny5w/reddit-top-rss.

Command line

docker run -p 80:8080 -e REDDIT_USER=your_reddit_user -e REDDIT_CLIENT_ID=your_app_id -e REDDIT_CLIENT_SECRET=your_app_secret johnny5w/reddit-top-rss:latest

docker-compose

version:'3'services:reddit-top-rss:image:johnny5w/reddit-top-rsscontainer_name:reddit-top-rssrestart:unless-stoppedports:      -80:8080environment:      -REDDIT_USER=your_reddit_user      -REDDIT_CLIENT_ID=your_app_id      -REDDIT_CLIENT_SECRET=your_app_secret      -DEFAULT_SUBREDDIT=news

Docker environment variables

The following required environment variables must be set, or you will not be authorized with Reddit's API:

ParameterFunction
REDDIT_USERYour Reddit user account with which you've created an app
REDDIT_CLIENT_IDThe client ID of the app you've created
REDDIT_CLIENT_SECRETThe secret for the app you've created

The following optional environment variables can be used to override the application defaults:

ParameterFunction
DEFAULT_SUBREDDITThis sets the initial subreddit on the first page load.
Default: pics
MERCURY_URLURL of your Mercury parser instance.See below.
MERCURY_API_KEYAPI key for your Mercury parser instance.
CACHE_REDDIT_JSONWhether to cache the JSON responses from Reddit.
Default:true
CACHE_MERCURY_CONTENTWhether to cache the responses from your Mercury instance.
Default:true
CACHE_RSS_FEEDSWhether to cache the outputted XML from Reddit Top RSS.
Default:true

Supported URL parameters

There are five URL paramenters supported:

subreddit

The exact string of the subreddit as it appears in the Reddit URL. Only one subreddit may be chosen.

score

Items below the desired score will be filtered out.

threshold

This parameter will get the average score for the past month's hot posts and will filter out items that fall below this percentage. This is helpful for volatile subreddits — and subreddits in general — since more people are using the service and causing posts to be scored higher and higher. Since this is a percentage, the number of items in the outputted feed should be more consistent than when using thescore parameter.

averagePostsPerDay

Reddit Top RSS will attempt to output an average number of posts per day by looking at a subreddit's recent history to determine the score below which posts will be filtered out. This is the filter I find most useful.

view

Accepted values arehtml andrss:

  • html shows the front end preview.
  • rss shows the rendered RSS XML feed. Use this for the URL to subscribe to in your RSS aggregator.
  • If theview parameter is left blank or omitted, the front end is shown.

URI examples

  • https://www.example.com?subreddit=funny&threshold=10000
  • https://www.example.com?subreddit=worldnews&score=1000&view=rss
  • https://www.example.com?subreddit=coolgithubprojects&averagePostsPerDay=3

Configuration

Reddit Top RSS comes with a default configuration. If you'd like to turn caching off, set a different default subreddit, or use a self-hostedMercury parser, just enter your desired values inconfig.php.

Mercury parser

If you'd like to include parsed article content in your outputted feed items, set a self-hostedMercury parser URL and optional API key inconfig.php. An easy to install, Dockerized version of the Mercury parser can be found here:https://www.github.com/HenryQW/mercury-parser-api.

Caching

By default Reddit Top RSS will cache Reddit JSON files, rendered RSS XML files, and Mercury parsed content to speed up the application. To clear the cache, click theClear cached results link in the footer. To disable caching for any of the above items, set the appropriate values tofalse inconfig.php.

License

This project is released under theMIT License.

Buy me a coffee

BuyMeCoffee


About

Generate RSS feeds for specified subreddits with score thresholds

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp