levelnewsbot-locavore

A news bot that pulls fresh articles from a configurable list of news feeds.

Usage no npm install needed!

<script type="module">
  import levelnewsbotLocavore from 'https://cdn.skypack.dev/levelnewsbot-locavore';
</script>

README

locavore

locavore is a configurable news bot that (by default) scrapes metadata from links published in the rss/atom feeds of websites in the LevelNews.org news feed directory.

The news feeds that locavore scrapes can be overridden via options you pass in programmatically and locavore is completely configurable.

locavore can be run from the command line in a Node.js/NPM environment or integrated into any Node.js/NPM project programmatically.

Install/Usage for Command Line

Clone directly from GitHub on your local machine:

$ git clone https://github.com/LevelNewsOrg/levelnewsbot-locavore.git
$ cd levelnewsbot-locavore
$ npm install
$ npm link

If all went well above, you should be able to simply call locavore from the command line anywhere in your system. Output is printed to console:

$ locavore

Install/Usage with Node.js projects

At the package.json directory level for your project:

$ npm install levelnewsbot-locavore --save

Inside your project file:

const locavore = require('levelnewsbot-locavore')
const l = locavore()
l.on('article', function (article) {
  // do something with each article here
  // you can leave locavore running, by default it checks for updates every 20 mins
})

Options

For programmatic use in your Node.js projects, you can pass in an options object when you call locavore that can override any of the properties in the config/index.js file. An example of this usage can be found in test/index.js.

const locavore = require('levelnewsbot-locavore')
const options = {
  feedDirectory: {
    'theonion.com': {
      feedUrl: 'http://www.theonion.com/feeds/rss'
    }
  },
  localFeedKeys: ['theonion.com']
}
const scrapedArticles = []
const l = locavore(options)
l.on('article', (article) => {
  scrapedArticles.push(article)
})

Feature Requests

If you have a feature request, open an issue in the GitHub repository.