Number of mentions in news or social media - EventRegistry/event-registry-node-js GitHub Wiki
Sometimes it might be valuable to know how often is a particular concept mentioned in the news or social media on a particular date. How often was, for example Barack Obama mentioned in the news in March 2015? Or, how often were articles about Ebola virus shared in social media in August 2014?
To obtain this type of information we can use the GetCounts() class. For computing popularity of Barack Obama in the news, we can use the following code:
import { EventRegistry, GetCounts} from "eventregistry";
er = EventRegistry({apiKey: "YOUR_API_KEY"})
er.getConceptUri("Obama").then((conceptUri) => {
const q = new GetCounts(conceptUri, {source: "news", startDate: "2015-03-01", endDate: "2015-03-31"});
return er.execQuery(q);
});
The returned result would be something like:
{
"http://en.wikipedia.org/wiki/Barack_Obama": [
{
"count": 1123,
"date": "2015-03-01"
},
{
"count": 1695,
"date": "2015-03-02"
},
// remaining values
]
}
The parameters that are accepted by the GetCounts() class are:
uriOrUriList: concept/category uri or a list of urissource: input source information from which to compute top trends. Options:news,socialtype: what do the provided uris represent -conceptorcategorystartDate: starting date from which to provide counts onward (eitherNone,datetime.dateor "YYYY-MM-DD")endDate: ending date until which to provide counts (eitherNone,datetime.dateor "YYYY-MM-DD")returnInfo: specify the details of the concepts/categories to return