GithubHelp home page GithubHelp logo

trovenewsbot's Introduction

trovenewsbot

See me in action at @TroveNewsBot.

Built using the Trove API, the Twitter API, the AlchemyAPI, and the GeoNames webservice.

For TroveNewsBot's unofficial biography see: TroveNewsBot: The story so far.

Don't miss TroveNewsBot's Guide to Child Rearing.

Basic bot interactions:

  • Include the word 'hello' in a message to @TroveNewsBot to receive a greeting and a random newspaper article.
  • Any other message will be treated as a query and will be sent off to the Trove API to look for matching results in the newspaper database.
  • To receive any old random newspaper article from amongst the 100 million odd available, just tweet TroveNewsBot the hashtag '#luckydip' and nothing else.

Modifying your bot query:

By default, the TroveNewsBot tweets the first (ie most relevant) matching result back to you. To change this you can:

  • Include the hashtag '#luckydip' to receive a random article from the matching results.
  • Include the hashtag '#earliest' to receive the earliest matching article.
  • Include the hashtag '#latest' to receive the latest matching article.

By default, the search terms you supply are sent directly to the Trove API without any modification. To change this you can:

  • Include the hashtag '#any' to search for articles that match any of your search terms. This is the same as adding an 'OR' between your terms.
  • Include a year to limit your search to that year. (Note that the majority of Trove's newspaper content was published between 1803 and 1954.)
  • Include the hashtag '#here' and location-enable your tweet to add the name of the place nearest to you to the query string. The place information is retrieved from the GeoNames reverse geocoding API.

Opinionator Mode:

If you tweet a url to TroveNewsBot you enter Opinionator mode. In this mode, TroveNewsBot examines the page at the supplied url and builds a query based on it's contents. The result is a commentary of sorts drawn from from TroveNewsBot's reservoir of 100 million historic newspaper articles.

Titles

By default, TroveNewsBot assembles its query by looking for a number of elements on the page:

  • The first set of h1 tags
  • A meta tag with a name including the string 'title'
  • Whatever's in the title tag

TroveNewsBot takes the text of whichever of these is found first, removes stopwords, slices off the first ten words, sends them off to Trove, and tweets the result.

Keywords

If you add the hashtag '#keywords' to a tweet containing a url, TroveNewsBot uses the AlchemyAPI to extract the ten top-ranked key words or phrases from the complete text of the page. These are then sent to Trove as before. This should probably (maybe) increase the relevance of TroveNewsBot's response.

Automatic botness:

  • At 9am, 3pm and 9pm (AEST), TroveNewsBot tweets a random article that has been updated or added in the previous 24 hours.
  • At 8am, 12 noon, 4pm and 8pm (AEST), TroveNewsBot tweets a response to the latest news item from the ABC's Just In page.
  • Every few hours TroveNewsBot tweets a response to the most recent link from DPLA tweeted by DPLABot.

Released under CC0 licence.

trovenewsbot's People

Contributors

wragge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.