Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Stack Overflow questions feed consumer.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 package.json
README.md

Stack Overflow RSS

Install

npm install stack-overflow-rss

Use

var stackOverflowRss = require('stack-overflow-rss');

// get the latest javascript questions
var consumer = stackOverflowRss({ tag: 'javascript'});
consumer.on('update', function(questions) {
  console.dir(questions);
});
consumer.update();

// poll the most voted json and node.js questions feed
var anotherConsumer = stackOverflowRss({ tags: ['json', 'node.js'], sort: 'votes'});
anotherConsumer.on('new', function(newQuestions) {
  console.dir(newQuestions);
});

Requiring 'stack-overflow-rss' returns a function used to consume question feeds. The following options are allowed:

  • tag or tags - The question tags.
  • sort - Default is 'newest'. Can also be 'unanswered', 'active', 'votes' or 'faq'.
  • pollInterval - Default is 1000 * 60 * 2 (2 minutes).
  • lazy - Defer polling until the first subscription to 'new'. Default is true. You can use consumer.update()to trigger a single update.

Upon registering, an EventEmitter is returned. The events to mind are:

  • 'update' - triggered every time the questions are fetched.
  • 'new'- triggered only when new questions exist. At leat two updates must be done to trigger this event.

License

MIT

Something went wrong with that request. Please try again.