New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

news-api-shell

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

news-api-shell

Shell for the news API

  • 0.0.3
  • unpublished
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

News API Shell

Shell for the News API service

Getting start

You have to import the news factory and pass your API key to it:

const factory = new NewsFactory(`Your API key`);

Then you can create one of the three instance to work with:

  • News - working with data from the "everything" section
  • Bestsellers - working with data from the "top-headlines" section
  • Publishers - working with data from the "sources" section

After that create configuration object and pass it to the instance you will be working with:

// you must pass all required parameters
// if you don't need some field, pass empty string
const validConfigForEverything = { 
    q: 'movies', 
    sources: 'bbc-news', 
    domains: 'www.bbc.co.uk' 
};

const everything = factory.getInstanceOf('everything');
const topHeadlines = factory.getInstanceOf('top-headlines');
const sources = factory.getInstanceOf('sources');

And use it:

everything.request(config)
    .then((response) => {
        console.log(response); // data
    });

Keywords

FAQs

Package last updated on 02 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc