Search by entity instead of by word
A keyword search for Apple or Asana returns every article that contains the word, whatever it means. Concepts are the people, companies, locations and things that we recognize and disambiguate in each article, and every concept has its own ID.
Search with that ID and you get only the articles that mention the thing you meant.
- Synonyms are included: a search for IBM also returns International Business Machines
- Finds articles in other languages, where the name may be spelled differently
- Combine several concepts in one query with AND or OR
# resolve the name to a concept ID once
apple = er.getConceptUri("Apple Inc.")
q = QueryArticlesIter(
conceptUri = apple,
lang = QueryItems.OR(["eng", "deu", "spa"]))
for art in q.execQuery(er, sortBy = "date", maxItems = 50):
print(art["lang"], art["title"], art["url"])
const api = "https://eventregistry.org/api/v1";
const response = await fetch(api + "/article/getArticles", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"apiKey": "YOUR_API_KEY",
"conceptUri": "http://en.wikipedia.org/wiki/Apple_Inc.",
"lang": [
"eng",
"deu",
"spa"
],
"resultType": "articles",
"articlesSortBy": "date",
"articlesCount": 50
}),
});
const data = await response.json();
for (const art of data.articles.results) {
console.log(art.lang, art.title, art.url);
}
curl -X POST "https://eventregistry.org/api/v1/article/getArticles" \
-H "Content-Type: application/json" \
-d '{
"apiKey": "YOUR_API_KEY",
"conceptUri": "http://en.wikipedia.org/wiki/Apple_Inc.",
"lang": [
"eng",
"deu",
"spa"
],
"resultType": "articles",
"articlesSortBy": "date",
"articlesCount": 50
}'
POST https://eventregistry.org/api/v1/article/getArticles
Content-Type: application/json
{
"apiKey": "YOUR_API_KEY",
"conceptUri": "http://en.wikipedia.org/wiki/Apple_Inc.",
"lang": [
"eng",
"deu",
"spa"
],
"resultType": "articles",
"articlesSortBy": "date",
"articlesCount": 50
}
Comes back with
titleurllangdateTime