levelnewsbot-bb8877

A bot that scrapes tweets for the freshest independent and alternative news links.

Usage no npm install needed!

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

README

bb8877

bb8877 is a news bot that scrapes urls from tweets belonging to orgs in the LevelNews.org news feed directory.

The Twitter accounts that bb8877 scrapes can be overridden via options you pass in programmatically and bb8877 is completely configurable.

By default, bb8877 will only return scraped urls belonging to whitelisted domains. Console output includes all urls, whitelisted or not.

bb8877 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-bb8877.git
$ cd levelnewsbot-bb8877
$ npm install
$ npm link

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

$ bb8877

Programmatic Usage with Node.js/NPM projects

At the package.json directory level for your project:

$ npm install levelnewsbot-bb8877 --save

Inside your program, call bb8877 with a callback as first argument:

const bb8877 = require('levelnewsbot-bb8877')
bb8877(function(err, posts) {
  if (!err) {
    console.log(posts)
  }
})

Options

For programmatic use in your Node.js projects, you can pass in an options object as a second argument when you call bb8877 that can override any of the properties in the config/index.js file. An example of this usage can be found in test/config.js. NOTE: if you pass in a custom options.accounts array, bb8877 will automatically set both config.domainWhitelist and config.domainToAccountMap properties to null.

const options = {
  bot: 'clickybot',
  accounts: ['clickhole'],
  tweetFreshness: -72,
  tweetsPerAccount: 10,
  // set to false or empty to return urls without filtering by white list:
  domainWhitelist: ['clickhole.com'],
  // used to determine boolean value of post.scraper.isSelfTweet property
  // aka: is the account tweeting a link back to its own web property:
  domainToAccountMap: { 'clickhole.com': { twitter: 'clickhole'}}
}
const bb8877 = require('levelnewsbot-bb8877')
bb8877(function(err, posts) {
  if (!err) {
    console.log(posts)
  }
}, options)

Feature Requests

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