npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

alchemy-news-api

v0.1.1

Published

An Alchemy News API library for Node.js

Downloads

7

Readme

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.