Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Mar 20, 2019. It is now read-only.
/nycurlPublic archive

A web server that fetches data from the New York Times and formats it for display in the terminal.

License

NotificationsYou must be signed in to change notification settings

omgimanerd/nycurl

Repository files navigation

This is a web server that formats the latest news from the front page of theNew York Times into a format that can be displayed in most terminals. A linkto 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.Please consider using its sister projectgetnews.tech, which usestheNews API instead.

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/technologycurl 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 sousing:

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

You can also limit the number of articles to display.

curl nycurl.sytes.net?n=10curl 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 andchanges. UseStandardJS to format your code.

You will need to acquire a Top Stories API Key from theNew York Timesand a URL Shortener API Key fromGoogle Developers. Add them to your .bashrcor other environment variable configuration:

export NYTIMES_API_KEY=YOUR_KEY_HEREexport URL_SHORTENER_API_KEY=YOUR_KEY_HERE

Install the project dependencies:

npm install # or yarn installwebpack

Run the server:

node server.js

License

MIT

About

A web server that fetches data from the New York Times and formats it for display in the terminal.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp