Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seia-soto/naverdict
Unofficial naver dictionary API.
https://github.com/seia-soto/naverdict
Last synced: about 2 months ago
JSON representation
Unofficial naver dictionary API.
- Host: GitHub
- URL: https://github.com/seia-soto/naverdict
- Owner: seia-soto
- License: mit
- Created: 2020-01-19T21:40:22.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-10T15:27:02.000Z (about 2 years ago)
- Last Synced: 2024-10-11T20:18:19.198Z (2 months ago)
- Language: JavaScript
- Size: 52.7 KB
- Stars: 9
- Watchers: 2
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# naverDict
Unofficial naver dictionary API wrapper.
## Table of Contents
- [Installation](#Installation)
- [Usage](#Usage)
- [searchDictionary](#searchDictionary)
- [Serialized data](#serialized-data)
- [availableLanguages](#availableLanguages)----
# Installation
- Yarn
```
yarn add naverDict
```- NPM
```
npm i naverDict
```# Usage
```js
const naverDict = require('naverDict')
```## searchDictionary
- Returns `Promise`
```js
naverDict.searchDictionary('아리랑', {
maximum: 5, // NOTE: Maximum word length is always 5.
language: 'ko', // NOTE: See #availableLanguages (in README.md)
raw: false // NOTE: If this set true, word objects won't serialized and include raw html values. In this library, I use `cheerio` to extract text.
})
```### Serialized data
- If `raw` option is not set. (default)
```js
{
...,
map: { // NOTE: `map` is shortcut to `searchResultMap.searchResultListMap`
WORD: {
items: [.../* Words are here */]
},
... // NOTE: Other ranges (such as `idiom`, `meaning`, `examples`, ...)
}
}
```## serializeWordObject
- Returns `Object (Serialized word)`
```js
naverDict.serializeWordObject(wordObject)
```## availableLanguages
- `Array`
```js
[
'ko', 'en', 'zh', 'ja', 'fr', 'es', 'de', 'vi'
]
```## requestHeaders
- `Object`
```js
{
Accept: '*/*',
DNT: 1,
Host: 'ko.dict.naver.com',
Cookie: 'nid_slevel=1; nid_enctp=1; nx_ssl=2',
'Accept-Language': 'en,ko-KR;q=0.9,ko;q=0.8,en-US;q=0.7',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36',
'Sec-Fetch-Mode': 'no-cors',
'Sec-Fetch-Site': 'same-site',
'Cache-Control': 'no-cache',
'upgrade-insecure-requests': 1
}
```