Get the latest presidential polling forecasts from fivethirtyeight.com

Usage no npm install needed!

<script type="module">
  import 38 from 'https://cdn.skypack.dev/538';



A command line util to get the latest presidential polling odds from fivethiryeight.com.

DISCLAIMER: I have nothing to do with fivethirtyeight and this is not endorsed or supported by them and may break at any time if they change anything about their website. Please don't run this command any more than you have to, it still comes directly from their servers.


npm install -g 538


Type 538 into your console.


Note: it's 100 characters wide, because I don't hate myself and use terminals with fewer columns, but I'd probably accept a nice PR that smartly adjusted to smaller terminals if you wanted.

Show me graphs when I open my terminal

Just add the 538 command to your ~/.bashrc or ~/.zshrc (or similar), and it'll run when you open your terminal. The request isn't always fast, so I don't really recommend doing this.

This might work if you have bash:

echo "\n538" >> ~/.bashrc

This might work if you have zsh:

echo "\n538" >> ~/.zshrc


Obviously none of the data is mine. Go to http://projects.fivethirtyeight.com/2016-election-forecast/ and click their ads each time you use the command line tool.

I pretty much stole the idea from @nelhage - who is far, far smarter than me and also wrote this in python first: https://github.com/nelhage/util-scripts/blob/master/538