-
Notifications
You must be signed in to change notification settings - Fork 54
Get Article Information
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:
from eventregistry import *
er = EventRegistry(apiKey = YOUR_API_KEY)
q = QueryArticle("247634888")
# get core article information
q.addRequestedResult(RequestArticleInfo())
res = er.execQuery(q)
The resulting JSON object contained in res
will contain:
{
"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
constructor accepts a single argument articleUriOrUriList
:
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).
Methods
The article URIs are provided as results of some queries, such as RequestEventArticleUris() result in the QueryEvent(). In some cases we would simply like to iterate over some larger set of articles and in this cases, a possible solution is also to use a static method queryById
. Article IDs in Event Registry start at 0 and end at the current number of imported news articles (which can be seen in the statistics table on ER Homepage). To get information about the first 200 Event Registry articles, one can use the following constructor for QueryArticle()
:
q = QueryArticle.queryById(range(200))
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
RequestArticleInfo(returnInfo = 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
RequestArticleSimilarArticles(page = 1,
count = 20,
lang = ["eng"],
limitPerLang = -1,
returnInfo = 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
RequestArticleDuplicatedArticles(page = 1,
count = 20,
returnInfo = ReturnInfo(articleInfo = 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, ...)
Core Information
Usage tracking
Terminology
EventRegistry
class
ReturnInfo
class
Data models for returned information
Finding concepts for keywords
Filtering content by news sources
Text analytics
Semantic annotation, categorization, sentiment
Searching
Searching for events
Searching for articles
Article/event info
Get event information
Get article information
Other
Supported languages
Different ways to search using keywords
Feed of new articles/events
Social media shares
Daily trends
Find the event for your own text
Article URL to URI mapping