RSS-Anything, get updates about anything you can reach with an url. Like RSS, but for anything.
I built this because I was tired of refreshing pages just to check for updates. A classic RSS reader works fine if you are only looking for blog posts, but what if you want updates about the stock market, or the number of views of a youtube video, or about a person's twitter description, or maybe even the number of stars of a GitHub repo? RSSA to the rescue!
This is how it works:
- You tell RSSA which urls you want to monitor
- You tell it how to extract the information you want from those pages, via a regex, a DOM selector or some custom logic.
- You tell it which reporter to use and how to display that information
- You can compare the freshly extracted values with the ones from the previous run
- You can choose to filter some rows out, for instance if the numbers you are monitoring didn't change from the previous run
Install
$ npm install --global rssa
Configuration
RSSA is configured via a JSON configuration file, you can supply your own via rssa --config /path/to/config.json
.
This is what it looks like:
{
"cache": {
"path": "/path/to/cache",
"enabled": false
},
"feeds": {
"path": "/path/to/feeds.js"
},
"fetch": {
"headless": false,
"chrome_path": "/path/to/Google\\ Chrome"
},
"history": {
"path": "/path/to/history.json"
},
"report": {
"active": "txt",
"save": false,
"path": "/path/to/reports",
"name": "[year][month][day]-[hour][minute][second]"
}
}
Feeds
Feeds describe what will be shown in your reports, it's basically a node.js module that exports a feeds
item describing which urls to fetch, how to extract the information from them and how to display that information.
Feeds can be deeply nested within groups, and their configuration inherits from their parent, so you if have 2 or more urls sharing the same tokens, templates and filter function simply wrap them into a group and move those fields in there.
This is what it looks like:
module.exports.feeds = {
groups: [{
name: 'Foo',
tokens: {
foo: '#foo',
bar: /bar/,
baz: ( page, $ ) => {},
qux: ['.my-class', val => `${val}!`],
},
filter: ( tokens, tokensOld ) => !tokensOld || tokens.value !== tokensOld.value,
template: '[foo]/[bar] ([baz]) [old:value] -> [value]',
template: ( tokens, tokensOld ) => '[foo]/[bar] ([baz]) [old:value] -> [value]',
template: ['Row 1', 'Row 2']
templates: {
txt: '',
html: ''
}
feed: 'http://www.example.com',
feeds: [
'http://www.example.com',
{
headless: true,
filter: () => true,
url: 'http://www.example.com'
}
]
}, {
}]
};
Usage
After having installed RSSA you will want to make a folder for it somewhere, in there you'll put your custom config.json
and feeds.js
files, then just call RSSA like this:
rssa --config /path/to/config
That's all! Check out what an actual report could look like, given the bundled config.json and feeds.js files:
Hints
- Colors: you may use chalk for styling your templates.
- Alias: if you use bash you can alias it for convenience, for instance you might want to add this to your
~/.bash_profile
: alias updateme="rssa --config /path/to/config
. Then simply run updateme
to get a report. - Multiple aliases: you might want to create multiple feeds for RSS, then run each of them separately, so that you can have aliases like
up-stocks
, up-social
or anything you can think of. - Cronjob: set a cronjob to run RSSA every hour or so to always have fresh reports to read.
- Cloud sync: make it output the reports to your Dropbox folder, so that you can check them even without having access to your terminal.
Future
- It stores the values it finds, so it could be pretty easy and quite interesting to have it plot charts about them for you. It basically could provide you with statistics about anything.
- It shouldn't be too difficult to make an RSS reporter, so that you can pipe it into your RSS client of choice.
License
MIT © Fabio Spampinato