Latest News

FREEMIUM
By jaypat87 | Updated vor 23 Tagen | News, Media
Health Check

N/A

Back to All Tutorials (1)

A basic tutorial for Specrom's Latest News API

LatestNewsAPI is a data API for fetching structured data from recent news articles (<24 hour old) from over 50,000 news sources currently indexed as part of specrom media monitoring and social listening database.

The update frequency of this API is about four times daily; if you need access to data as soon as it’s indexed in our database than we recommend you to contact us to get API keys for our premium offering.

The input JSON is shown below.

{“domains”: “cnn.com”,“topic”:“politics”,“q”: “”,“qInTitle”: “”, “content”:“false”, “page”:“1”, “author_only”:“true”}

domains: The domain url for filtering by news source. In this version, you can only specify one domain address. In case you do not want to filter by domain address, than simply leave the field empty ("").

topic: Filter the news articles by their topic. Options include: “politics”, “tech”, “entertainment”, “business”, “sport”. If you want to fetch all articles without topic filtering, than simply specify “”.

q: filter the news articles by a keyword; optionally you can simply leave it empty ("") if you do not wish to filter by keyword. Only one keyword is supported by this API. Our premium API allows you to filter by list of keywords and phrases.

qInTitle: filter the news articles by a keyword present in the title. Only one keyword is supported by this API. Our premium API allows you to filter by list of keywords and phrases.

content: If you want full text of the news articles in the content key of the response JSON then set this field to “true” otherwise set it to “false”.

page: This API returns 100 results per call so you can use this key to paginate through other results.

author_only(optional): if “true” than it only returns results with author names.

Output

{
“Article”: [
{
“author”: “[“Tara John and Susanne Gargiulo, CNN”]”,
“content”: " Denmark is a liberal paradise for many people, but the reality is very different for immigrants By Tara John and Susanne Gargiulo, CNN Updated 5:09 AM ET, Mon July 20, 2020 Chat with us in Facebook Messenger. Find out what’s happening in the world as it unfolds.
“description”: “Muhammad Aslam loves his home – an apartment in a low-rise public housing estate at the heart of the diverse and gentrifying Copenhagen neighborhood of Norrebro.”,
“publishedAt”: “2020-07-20”,
“source_name”: “CNN”,
“source_url”: “cnn.com”,
“title”: “Denmark is a liberal paradise for many people, but the reality is very different for immigrants - CNN”,
“url”: “https://www.cnn.com/2020/07/20/europe/denmark-ghetto-relocation-intl/index.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+rss%2Fcnn_topstories+(RSS%3A+CNN±+Top+Stories)”,
“urlToImage”: “https://cdn.cnn.com/cnnnext/dam/assets/200715115115-01-denmark-hard-ghettos-super-tease.jpg
},
.
.
],
“status”: “ok”,
“totalResults”: 17
}
status: This key will return “ok” if results from all the shards are being fetched correctly. Please raise a support ticket with Specrom Analytics if is reporting a “fail”.

totalResults: This API only returns a maximum of 100 results per API call so you can use this total Results number to set up pagination along with “page” key of input JSON.

Article: This key contains a list of dictionaries representing individual news articles.

Author: A list of author names for the news articles.

content: Full text of the news articles in case the content key in input JSON was set to true.

title: title of the news article

description: description of the news article extracted and parsed from meta tags of the HTML page.

publishedAt: publication date of the news article (based on on UTC timezone).

source_name: Name of the news source.

source_url: domain address of the news source.

url: url of the news article

urlToImage: url of the most relevant image from the news article.