Rivus (https://riv.us)
Social aggregation into a single feed (example: jaredwray.com)
Features
- Single Feed
- Built in Deduplication
- Caching
- Data Store
- Callback and Promises Supported
- Many Providers
Install
Requires Node.js v5.9.1 or higher.
Using NPM
$ npm install riv-us
How To Use Rivus
Step 1: Set your the provider configuration file up correctly to support what providers you want to use and the settings / authentication needed.
- Medium: Copy user name from URL https://medium.com/@your_medium_username. Put this in the field 'user' in the configuration. To get publication's feed copy the name of publication https ://medium.com/the-story and put it in the field "publication". If feed situated at the custom domain, copy only domain and put it in the field "publication_with_custom_domain".
- RSS: List the URL of the feed you are interested in the field "feed_url".
- Twitter: Create an application at https://apps.twitter.com/app/new. Go into the details of the generated application and find: Consumer Key (API Key), Consumer Secret (API Secret), Access Token, Access Token Secret. Copy these values and your account name @username in the appropriate configuration fields.
- Facebook: Create an application at https://developers.facebook.com/apps Go into the details of the generated application and find App ID and App Secret . Find out your User ID there are many ways to do it. Copy the received information in the appropriate configuration fields.
- Instagram: Copy the name of your account @username and your Access Token in the appropriate configuration fields.
{
"dataStore": {
"type": "none",
},
"providers": [
{
"name": "rss",
"feed_url": "http://www.example.org/export/articles.rss"
},
{
"name": "instagram",
"user": "@username",
"access_token": "1270826243.3574ed0.d2925718be41442e877c9d496b6e1d2a"
},
{
"name": "medium",
"user": "@username"
},
{
"name": "medium",
"publication": "blog_title"
},
{
"name": "medium",
"publication_with_custom_domain": "http://www.example.org"
},
{
"name": "twitter",
"user": "@username",
"consumer_key": "dwO2Ye2v4hVVG9nPOuKVjKzDN",
"consumer_secret": "wAbDbmxFKgBpdxiyzAIlSe5i8X3UyMP6N5OtBpCpVBEUrXQbw2",
"access_token_key": "1234567892-q3ztVafxE9O9U0yWNkapcrAWJeuKW7Jw67Bu88k",
"access_token_secret": "WQhEraiTcbJ4Nq2sqk5lnOWGdKBasOB5201smsoX17aSR"
},
{
"name": "facebook",
"app_id": "wAbDbmxFKgBpdxiyzAIlSe5i8X3UyMP6N5OtBpCpVBEUrXQbw2",
"app_secret": "dwO2Ye2v4hVVG9nPOuKVjKzDN",
"user_id": "userid"
}
]
}
dataStore is optional. In case this section isn't specified will be used in-memory data store. As alternative you can set redis as a default data store:
"dataStore": {
"type": "redis",
"settings": {
// here you can configure 'path', 'host', 'port' and 'password'
}
}
Step 2: Do the following code to get the feed results:
var Rivus = ; // the config should list the providers and their settings var rivus = __dirname + "../path/to/config"; // or with an object var rivus = ...; // load the data and store it in your data source (in-memory by default) rivus;
By default the following is enabled:
- Deduplication is enabled by default.
Environment variables: Rivus can use environment variables. You have 2 options with env vars:
Use javascript object config:
var rivus = dataStore: type: "redis" host: processenvREDIS_HOST port: processenvREDIS_PORT
Use config file with variable interpolation:
Date display: Moment.js allows you to easily manipulate created time.
rivus;
Filter Function: provide a javascript filter function to filter incoming posts; posts which are filtered out will be completely missed and not appear in your data store.
const rivus = dataStore: // ... providers: // ... ; rivusfilter;
Standard Feed Result
The standard feed result will look like the following:
title: '' content: '' created_time: {} // Moment object - http://momentjs.com/ images: thumbnail: url: '' content: url: '' // optional link: "" extra: {} // original feed source: name: '' // provider name feed: '' // feed id
Providers
Providers are built with a set of common interfaces so that they can be interchangable. Each provider allows for the following:
- ID: is required for every provider and it cannot be the same as another. This is done as a constant such as
id = 'providerID'
- configuration / settings at the creation of the service
var obj = new Provider(config);
: each config can be located in the/config.json
configuration file under theproviders:
array. - get(): get feed items
get(count)
: This allows to get the feed items in a normalized look and feel.
Here is a list of providers currently supported:
- RSS
- Medium
Tests
Tests for Rivus can be run using the command:
npm test
Authors
Jared Wray jaredwray.com
Licence
Apache 2.0
Issues
Issues? Feature Requests? reported an issue.