News Labs JavaScript Libraries

For #newsHACK II we’re providing some JavaScript libraries so it’s easier to get started

You are free to use these  in your hack, to  download and customise them or just as a starting point to see how to use the APIs.

NOTE: The URLs for these JavaScript libraries will change. The plan is to host them to host them on newshack.co.uk but they will likely not be finalised till just before #newsHACK

The News Labs API

The News Labs API lets you search Linked Data data, discover relationships between concepts, articles and storylines and filter results by a range of properties.

To get started,  you just need to include jQuery and then the library itself:

To use the library you just need to specify the host (as below) and your API from Apigee before making a call:

The News Labs API provides 15 different end points.

See the source code of the library for inline documentation.

  • newslabsApi. findTaggedConcepts()
  • newslabsApi. findsThingsInTheKnowledgeBase()
  • newslabsApi. findCreativeWorksGeoMultiHop()
  • newslabsApi. getFacetsForFullTextSearch()
  • newslabsApi. findTaggedConceptsFilteredByType()
  • newslabsApi. findCreativeWorksGeospatial()
  • newslabsApi. findCreativeWorksMultiHop()
  • newslabsApi. findConceptCoOccurrences()
  • newslabsApi. findConceptOccurrences()
  • newslabsApi. findCreativeWorks()
  • newslabsApi. findsThingsByTypeInTheKnowledgeBase()
  • newslabsApi. getACreativeWork()
  • newslabsApi. getTheGraphOfAStorylineOrEvent()
  • newslabsApi. fullTextSearchCreativeWorks()
  • newslabsApi. getConcept()

The Juicer Core API

The Juicer is the component that ingests articles from dozens of major news sources.

The Juicer Core API lets you search actual article text, in combination with other filters  (such as by data source, by publication date and by location). It includes news articles published on line, images, videos and – as an experimental feature – real time Tweets from Members of Parliament.

To get started,  you just need to include jQuery and then the library itself:

To use the library you just need to specify the host (as below) and your API from Apigee before making a call:

You can search articles using up to a dozen different, optional parameters on the getArticles() method.

 See the source code of the library for inline documentation.

  • @param text {string}
  • @param checked {checked|not_checked}
  • @param published_after {YYYY-MM-DD}
  • @param published_before {YYYY-MM-DD}
  • @param location {lat,lon|postcode}
  • @param distance {integer}
  • @param polygon {comma seperated geolocation polygon}
  • @param page_length {integer}
  • @param product {string}
  • @param content_format {VideoFormat|TextualFormat|ImageFormat}
  • @param section {string}
  • @param site {string}