OpenDictionaryAPI is a free and open-source API that provides access to word definitions, synonyms, antonyms, pronunciations, and more. π§βπ» Perfect for developers and language enthusiasts who want to integrate dictionary data into their applications. π
Install the package from npm:
npm i opendictionaryapi
const OpenDictionaryAPI = require("opendictionaryapi");
OpenDictionaryAPI.search('hi', 'en')
.then(results => {
console.log(results);
})
.catch(error => {
console.log(error);
});
[
{
"word": "hello",
"phonetics": [
{
"audio": "https://api.dictionaryapi.dev/media/pronunciations/en/hello-au.mp3",
"sourceUrl": "https://commons.wikimedia.org/w/index.php?curid=75797336",
"license": {
"name": "BY-SA 4.0",
"url": "https://creativecommons.org/licenses/by-sa/4.0"
}
}
],
"meanings": [
{
"partOfSpeech": "noun",
"definitions": [
{
"definition": "\"Hello!\" or an equivalent greeting."
}
]
}
],
"sourceUrls": [
"https://en.wiktionary.org/wiki/hello"
]
}
]
{
"title": "No Definitions Found",
"message": "Sorry pal, we couldn't find definitions for the word you were looking for.",
"resolution": "You can try the search again at a later time or head to the web instead."
}
You can also directly fetch word data via the URL:
https://www.jsdelivr.com/package/gh/SH20RAJ/OpenDictionaryAPI/data/english/{word}.json
Fetch data for the word βhelloβ:
https://cdn.jsdelivr.net/gh/SH20RAJ/OpenDictionaryAPI/data/english/hello.json
git clone https://github.com/SH20RAJ/OpenDictionaryAPI.git
npm install
npm start
We welcome contributions from the community! π οΈ To get started:
git checkout -b feature-name.git commit -m "Added new feature".git push origin feature-name.This project is licensed under the MIT License.
For questions or support, please reach out via Issues.
β If you find this project helpful, give it a star! β