-
Notifications
You must be signed in to change notification settings - Fork 54
Feed of new articles events
It is very easy in Event Registry to subscribe to a feed of new articles or events.
The class GetRecentArticles
is able to provide you with new articles as they are imported into Event Registry. A simple example of use would be:
from eventregistry import *
import time
er = EventRegistry(apiKey = YOUR_API_KEY)
recentQ = GetRecentArticles(er, maxCount = 200)
starttime = time.time()
while True:
articleList = recentQ.getUpdates()
print "%d articles were added since the last call" % len(articleList)
# do whatever you need to with the articles in articleList
# wait exactly a minute until next batch of new content is ready
time.sleep(60.0 - ((time.time() - starttime) % 60.0))
Each call to the recentQ.getUpdates(er)
will provide you with a list of articles that were added since the last call to the method. Provided information about the articles matches the Article data model.
As for the articles, we can also ask Event Registry for a feed of new events. In this case, the list will also include the events that were just updated (for example with a new article about this event). An example code to get the list of new or updated events would be:
from eventregistry import *
import time
er = EventRegistry(apiKey = YOUR_API_KEY)
recentQ = GetRecentEvents(er, maxCount = 200)
starttime = time.time()
while True:
ret = recentQ.getUpdates()
if ret.has_key("eventInfo") and isinstance(ret["eventInfo"], dict):
# how many events updated since last call (each event can be updated multiple times)
print "%d events updated since last call" % len(ret["activity"])
# get URIs of the events that are new/updated
uris = ret["eventInfo"].keys()
# use the details about events in ret["eventInfo"]
# wait exactly a minute until next batch of new content is ready
time.sleep(60.0 - ((time.time() - starttime) % 60.0))
Provided information about the events in ret["eventInfo"]
matches the Event data model.
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