Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

newsquery

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

newsquery

The newsQuery NPM package provides a simple interface to BBC News Labs APIs

  • 0.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
93
increased by1062.5%
Maintainers
1
Weekly downloads
 
Created
Source

newsQuery

The newsQuery module provides access to the BBC News Labs APIs.

To access these APIs (and so, to use this library) you must have signed up for an API key and selected to use both "bbcrd-newslabs-apis-product" and "bbcrd-juicer-apis-product" for your application:

http://bbc.apiportal.apigee.com

Initially this is a very limited implmentation; an MVP that exposes the most useful core functionality, with the intent to extend it over time.

API documentation

You can find full information about the underlying APIs this module uses on the #newsHACK site.

The semantic News Labs API: http://newshack.co.uk/newshack-ii/newslabs-apis/

The News Juicer API: http://newshack.co.uk/newshack-ii/juicer-apis/

Example usage

getConcepts()

Looking up concepts with "Rooney" in them (free text search for concepts):

var apiKey = '1234567890ABCDEF';
var newsQuery = require('newsquery')(apiKey);
newsQuery.getConcepts("Rooney", 5)
.then(function(concepts) {
    console.log(concepts);
});

getConceptsByType()

Lookup companies with the name "Apple" in them:

Note: Will include "Apple Records" (type Record Label) as well as "Apple Computer" (type Company) as "Record Label" is a subclass of "Company".

var apiKey = '1234567890ABCDEF';
var newsQuery = require('newsquery')(apiKey);
newsQuery.getConceptsByType("Apple", ["http://dbpedia.org/ontology/Company"], 5)
.then(function(response) {
    console.log(concepts);
});

Lookup people in the UK active in politics called "Cameron":

Note: Will include non-UK Politicians, as some UK politicians are merely tagged "Politician" rather than specifically as "MemberOfParliament" or "OfficeHolder". "OfficeHolder" also includes some people who may not technically be politicians (e.g. "Samantha Cameron").

var apiKey = '1234567890ABCDEF';
var newsQuery = require('newsquery')(apiKey);
newsQuery.getConceptsByType("Cameron", ["http://dbpedia.org/ontology/MemberOfParliament", "http://dbpedia.org/ontology/Politician" ,"http://dbpedia.org/ontology/OfficeHolder"], 5)
.then(function(people) {
    console.log(response);
});

getArticlesByConcept()

Get articles tagged "Europe":

var apiKey = '1234567890ABCDEF';
var newsQuery = require('newsquery')(apiKey);
newsQuery.getArticlesByConcept(["http://dbpedia.org/resource/Europe"], 10)
.then(function(articles) {
    console.log(articles);
});

Keywords

FAQs

Package last updated on 08 May 2014

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