Socket
Socket
Sign inDemoInstall

alchemy-news-api

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    alchemy-news-api

An Alchemy News API library for Node.js


Version published
Weekly downloads
2
increased by100%
Maintainers
1
Install size
41.5 kB
Created
Weekly downloads
 

Readme

Source

An Alchemy News API Library for Node.js

This module provides calls to the Alchemy News API for Nodejs. It is based on AlchemyAPI for Nodejs. For more information on the API requests and responses, visit the AlchemyData News API docs. To use this module, you will need to obtain a key from Alchemy.

Installation

You can install this through npm: npm install alchemy-news-api

You can install via git by cloning: git clone https://github.com/davidadamojr/alchemy-news-api.git /path/to/alchemy-news-api

Usage

    var AlchemyNewsAPI = require('alchemy-news-api');
    var alchemyNewsAPI = new alchemyNews('<YOUR API KEY>');
    var taxonomyQuery = {
        'taxonomy_label': 'politics',
        'return': ['url', 'title']
    };
    alchemyNewsAPI.getNewsByTaxonomy(taxonomyQuery, function (error, response) {
        if (error) {
            console.log(error);
        } else {
            console.log(response);

            // do something with response
        }
    });

Tests

To run tests type mocha

Alchemy News API Features

Taxonomy

Retrieve categorized news content by searching for news on topics that you care about e.g. baseball, mobile phones, etc.

    var AlchemyNewsAPI = require('alchemy-news-api');
    var alchemyNewsAPI = new alchemyNews('<YOUR API KEY>');
    var taxonomyQuery = {
        'taxonomy_label': 'baseball',
        'return': ['url', 'title']
    };
    alchemyNewsAPI.getNewsByTaxonomy(taxonomyQuery, function (error, response) {
        if (error) {
            console.log(error);
        } else {
            // do something with response

            console.log(response);
        }
    });

Concepts

Retrieve news content containing abstract concepts.

    var AlchemyNewsAPI = require('alchemy-news-api');
    var alchemyNewsAPI = new alchemyNews('<YOUR API KEY>');
    var conceptQuery = {
        'concept_text': 'Android',
        'return': ['url', 'title']
    };
    alchemyNewsAPI.getNewsByConcept(conceptQuery, function (error, response) {
        if (error) {
            console.log(error);
        } else {
            // do something with response

            console.log(response);
        }
    });

Keywords

Retrieve news content containing specified keywords. Keywords are terms explicitly mentioned in the article that are determined to be highly relevant to the subject matter of the news article.

    var AlchemyNewsAPI = require('alchemy-news-api');
    var alchemyNewsAPI = new alchemyNews('<YOUR API KEY>');
    var keywordQuery = {
        'keyword_text': 'Clinton',
        'return': ['url', 'title']
    };
    alchemyNewsAPI.getNewsByKeyword(keywordQuery, function (error, response) {
        if (error) {
            console.log(error);
        } else {
            // do something with response

            console.log(response);
        }
    });

Entities

Retrieve news articles using named entities. Named entities are proper nouns such as people, cities, companies, products, etc.

    var AlchemyNewsAPI = require('alchemy-news-api');
    var alchemyNewsAPI = new alchemyNews('<YOUR API KEY>');
    var entityQuery = {
        'entity_text': 'Apple',
        'entity_type': 'company',
        'return': ['url', 'title']
    };
    alchemyNewsAPI.getNewsByEntity(entityQuery, function (error, response) {
        if (error) {
            console.log(error);
        } else {
            // do something with response

            console.log(response);
        }
    });

Sentiment Analysis

Retrieve news articles based on sentiment. Articles have positive, negative or neutral sentiment.

    var AlchemyNewsAPI = require('alchemy-news-api');
    var alchemyNewsAPI = new alchemyNews('<YOUR API KEY>');
    var sentimentQuery = {
        'title': 'IBM',
        'sentiment_type': 'positive',
        'sentiment_score': '>0.5',
        'return': ['url', 'title']
    };
    alchemyNewsAPI.getNewsBySentiment(sentimentQuery, function (error, response) {
        if (error) {
            console.log(error);
        } else {
            // do something with response

            console.log(response);
        }
    });
    

Contributions

This Nodejs library does not implement all the capabilities of the Alchemy News API. So there is still a lot that can be added. Contributions and improvements are welcome.

Keywords

FAQs

Last updated on 02 Dec 2015

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc