1

To get information about a word in Wiktionary, I can make an Ajax call to the following URL at wiktionary.org: https://en.wiktionary.org/w/api.php?action=parse&format=json&prop=text|revid&callback=?&page=слово, where слово is the word of interest.

This will return a JSON object with the format...

{ "parse":
  { "title": "\u0442\u044b"
  , "pageid":96216
  , "revid":38162039
  , "text":{
      "*": <HTML string>
    }
  }
}

... where <HTML string> contains information on the given word, in all the languages that Wiktionary associates with the word. In the case of the word слово, this means

  • Bulgarian
  • Macedonian
  • Old Church Slavonic
  • Russian
  • Serbo-Croatian
  • Ukrainian

How can I change the URL for the Ajax call so that it only returns data for a single language (for example: Russian)?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
James Newton
  • 6,623
  • 8
  • 49
  • 113

1 Answers1

0

It's not possible as in terms of Wiktionary each word is a page with wiki-formatted text. It's not structured as a JSON or any other machine readable data structure format. Though, they have a convention which every page is supposed to follow. According to it, each page should have level 2 headings with word's language. So, you can parse the wikitext to extract only the data for the language you want by looking for such a heading and taking only the data below it.

Roman Kishchenko
  • 587
  • 3
  • 11