A web server that fetches data from the New York Times and formats it for display in the terminal.
JavaScript CSS HTML Python
Switch branches/tags
Nothing to show
Latest commit be6a84f Aug 15, 2017 @omgimanerd Fix typo, update README
Permalink
Failed to load latest commit information.
client
logs Added reparse script again and fixed time format issue Jul 6, 2017
server Added bluebird Promises and standardized Promise style errors Aug 10, 2017
views Edited analytics link Aug 3, 2017
.gitignore ported to yarn + webpack Jun 30, 2017
LICENSE Updated README and LICENSE Mar 1, 2017
README.md Fix typo, update README Aug 15, 2017
package.json Added bluebird Promises and standardized Promise style errors Aug 10, 2017
robots.txt added robots.txt and twitter handle to curl Apr 8, 2016
server.js Fixed analytics page Aug 3, 2017
webpack.config.js Removed assets for unused index page Jul 24, 2017
yarn.lock Added bluebird Promises and standardized Promise style errors Aug 10, 2017

README.md

nycurl

This is a web server that formats the latest news from the front page of the New York Times into a format that can be displayed in most terminals. A link to each article is included if the user wants to read the full article.

This project will no longer be updated or maintained as of August 2017. I will continue hosting this for as long as people are using it, but please consider using its sister project getnews.tech.

Example Output

$ curl nycurl.sytes.net?i=5
┌──────────────────────────────────────────────────────────────────────┐
│                                                                      │
│              To find a list of sections to query, use:               │
│                      curl nycurl.sytes.net/help                      │
│                                                                      │
├───┬──────────────┬───────────────────────────────────────────────────┤
│ # │ Section      │ Details                                           │
├───┼──────────────┼───────────────────────────────────────────────────┤
│ 0 │ Arts         │ Canada Debates Whether Gift of Leibovitz Photos   │
│   │              │ Is Also a Tax Dodge                               │
│   │              │ Four years after the donation of 2,070 photos     │
│   │              │ created by Annie Leibovitz to a Nova Scotia       │
│   │              │ museum, a government panel is balking at its $20  │
│   │              │ million valuation.                                │
│   │              │ https://nyti.ms/2tH1g2N                           │
├───┼──────────────┼───────────────────────────────────────────────────┤
│ 1 │ Books        │ What Happens When Liberty Fails to Deliver        │
│   │              │ In “The Retreat of Western Liberalism,” Edward    │
│   │              │ Luce argues that the tradition of liberty is      │
│   │              │ under mortal threat.                              │
│   │              │ https://nyti.ms/2tFDJ2g                           │
├───┼──────────────┼───────────────────────────────────────────────────┤
│ 2 │ Briefing     │ Senate, John McCain, Jeff Sessions: Your Tuesday  │
│   │              │ Evening Briefing                                  │
│   │              │ Here’s what you need to know at the end of the    │
│   │              │ day.                                              │
│   │              │ https://nyti.ms/2tHzEdW                           │
├───┼──────────────┼───────────────────────────────────────────────────┤
│ 3 │ Briefing     │ Donald Trump, Republican Party, Russia: Your      │
│   │              │ Wednesday Briefing                                │
│   │              │ Here’s what you need to know to start your day.   │
│   │              │ https://nyti.ms/2tXFUtp                           │
├───┼──────────────┼───────────────────────────────────────────────────┤
│ 4 │ Business Day │ To Punish Putin, Economic Sanctions Are Unlikely  │
│   │              │ to Do the Trick                                   │
│   │              │ Using economic penalties to achieve diplomatic    │
│   │              │ goals has a poor track record when the target is  │
│   │              │ powerful and autocratic, and workarounds exist.   │
│   │              │ https://nyti.ms/2tGwbwj                           │
├───┴──────────────┴───────────────────────────────────────────────────┤
│              Follow @omgimanerd on Twitter and GitHub.               │
│                Open source contributions are welcome!                │
│                 https://github.com/omgimanerd/nycurl                 │
└──────────────────────────────────────────────────────────────────────┘

Usage

You can fetch the latest news simply by typing

curl nycurl.sytes.net

This application also accepts queries to the various sections of the NY Times.

curl nycurl.sytes.net/technology
curl nycurl.sytes.net/politics

Get a list of acceptable sections to query using:

curl nycurl.sytes.net/help

By default, nycurl will format the table to be a max of 72 characters wide. If you would like to specify a custom width for your terminal, you can do so using:

curl nycurl.sytes.net?w=92
curl nycurl.sytes.net/technology?w=100

You can also limit the number of articles to display.

curl nycurl.sytes.net?n=10
curl nycurl.sytes.net?n=12\&w=95

Note that when combining the parameters on the command line as query parameters, you must use \& to escape the ampersand character.

Contributing

Fork this repository and send me a pull request with any suggestions and changes. Use StandardJS to format your code.

You will need to acquire a Top Stories API Key from the New York Times and a URL Shortener API Key from Google Developers. Add them to your .bashrc or other environment variable configuration:

export NYTIMES_API_KEY=YOUR_KEY_HERE
export URL_SHORTENER_API_KEY=YOUR_KEY_HERE

Install the project dependencies:

npm install # or yarn install
webpack

Run the server:

node server.js

License

MIT