Handle redirects
This commit is contained in:
parent
aa1b33f9e4
commit
54edcf793b
1 changed files with 3 additions and 1 deletions
|
@ -295,7 +295,9 @@ export default class Wikidata {
|
|||
}
|
||||
|
||||
const url = "https://www.wikidata.org/wiki/Special:EntityData/" + id + ".json";
|
||||
const response = (await Utils.downloadJson(url)).entities[id]
|
||||
const entities = (await Utils.downloadJson(url)).entities
|
||||
const firstKey = <string> Array.from(Object.keys(entities))[0] // Roundabout way to fetch the entity; it might have been a redirect
|
||||
const response = entities[firstKey]
|
||||
|
||||
if (id.startsWith("L")) {
|
||||
// This is a lexeme:
|
||||
|
|
Loading…
Reference in a new issue