You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

alchemy-news-api

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alchemy-news-api

An Alchemy News API library for Node.js

0.1.1
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
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

alchemy

FAQs

Package last updated on 02 Dec 2015

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