Get article information - EventRegistry/event-registry-node-js GitHub Wiki
When you want to find details about a specific article you can use the QueryArticle class.
An example use of the QueryArticle() class to obtain details about the article with URI 247634888 would be:
import {EventRegistry, QueryArticle, RequestArticleInfo} from "eventregistry";
const er = new EventRegistry({apiKey: "YOUR_API_KEY"});
const q = new QueryArticle("247634888");
// get core article information
q.addRequestedResult(new RequestArticleInfo());
res = er.execQuery(q);
The above promise will return an JSON object as follows:
{
"247634888": {
"info": {
"lang": "por",
"body": "...",
"title": "...",
"url": "...",
"uri": "...",
"eventUri": "...",
"time": "...",
"date": "...",
// other properties of the article (see Article data model)
}
}
}
The returned information about the article follows the Article data model.
QueryArticle
QueryArticle constructor accepts a single argument articleUriOrUriList:
new QueryArticle(articleUriOrUriList);
The articleUriOrUriList can be a string representing a single article URI (newsfeed ID) or it can be a list of article URIs (at most 200).
Returned information
QueryArticle class provides a method addRequestedResult() that can be used to specify which details about the article you wish to obtain. The argument in the method call has to be an instance that has a base class RequestArticle. Below are the classes that can be specified in the addRequestedResult calls:
RequestArticleInfo
new RequestArticleInfo({returnInfo = new ReturnInfo()} = {});
RequestArticleInfo class can provide the available information about the article - the title, body, date, concepts, event membership, ...
returnInfo: sets the properties of various types of data that should be returned about the article (concepts, categories, news source, ...)
RequestArticleSimilarArticles
new RequestArticleSimilarArticles(
page = 1,
count = 20,
lang = ["eng"],
limitPerLang = -1,
returnInfo = new ReturnInfo(),
} = {});
RequestArticleSimilarArticles returns a list of similar articles according to the CCA similarity.
page: which page of the similar articles to return (starting from 1).count: number of similar articles to return (max 200).lang: languages in which should be the returned similar articles.limitPerLang: is there a maximum number of articles that we should return for each language.returnInfo: sets the properties of various types of data that is returned (articles, concepts, categories, news sources, ...)
RequestArticleDuplicatedArticles
new RequestArticleDuplicatedArticles({
page = 1,
count = 20,
returnInfo = new ReturnInfo(articleInfo: new ArticleInfoFlags({bodyLen: -1})))
} = {});
RequestArticleDuplicatedArticles returns a list of article that are duplicates of the specified article..
page: which page of the duplicated articles to return (starting from 1).count: number of duplicated articles to return (max 200).returnInfo: sets the properties of various types of data that is returned (articles, concepts, categories, news sources, ...)