Skip to content

Instantly share code, notes, and snippets.

@bupkes
Last active April 17, 2017 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bupkes/74212176f7375d84833e8c10fa49e4c0 to your computer and use it in GitHub Desktop.
Save bupkes/74212176f7375d84833e8c10fa49e4c0 to your computer and use it in GitHub Desktop.
rss to mastodon
var Masto = require('mastodon');
var FeedSub = require('feedsub');
var striptags = require('striptags');
var M = new Masto({
access_token: 'YOUR ACCESS TOKEN',
timeout_ms: 60*1000, // optional HTTP request timeout to apply to all requests.
api_url: 'https://mastodon.social/api/v1/', // optional, defaults to https://mastodon.social/api/v1/ put your own in obvs
});
var reader = new FeedSub('INSERT RSS FEED HERE.rss', {
interval: 1, // check feed every 1 minutes
emitOnStart: true
});
reader.on('item', function(item) {
M.post('statuses', { status: striptags(item.description)});
});
reader.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment