https://github.com/soarez/stack-overflow-rss
Stack Overflow questions feed consumer.
https://github.com/soarez/stack-overflow-rss
Last synced: about 1 year ago
JSON representation
Stack Overflow questions feed consumer.
- Host: GitHub
- URL: https://github.com/soarez/stack-overflow-rss
- Owner: soarez
- License: mit
- Created: 2012-08-01T01:52:05.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2014-02-20T22:21:37.000Z (over 12 years ago)
- Last Synced: 2024-05-01T22:26:21.273Z (about 2 years ago)
- Language: JavaScript
- Size: 171 KB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Stack Overflow RSS
### Install
npm install stack-overflow-rss
### Use
```javascript
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](http://nodejs.org/api/events.html) 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