longdo-api
TypeScript icon, indicating that this package has built-in type declarations

1.0.10 • Public • Published

longdo-api

A simple unofficial Node.js API for straightforward interfacing with Longdo's dictionary API.

Installation

Using NPM:

$ npm install longdo-api

Using Yarn:

$ yarn add longdo-api

Usage

async search(query, cleanup=true)

Queries the Longdo API and returns the result (see format below)

Parameters:

  • query: query to search (string)
  • cleanup: whether to clean up data (string trim, etc.)

Returns: Promise<Record<string, string[][]>>

Example code

const longdo = require('longdo-api');

longdo.search('fandango').then((result) => {
    console.log(result);
});

Response example

{
    "NECTEC Lexitron Dictionary EN-TH": [
        ["fandango", "[N] การเต้นระบำสเปนแบบสามจังหวะ, See also: ดนตรีสามจังหวะสำหรับเต้นระบำสเปน"]
    ],
    "ตัวอย่างประโยคจาก Open Subtitles ** ระวัง คำแปลอาจมีข้อผิดพลาด **": [
        ["# Scaramouch, scaramouch Will you do the fandango #", "# เจ้าคนชั่ว, เจ้าคนชั่ว เจ้าเต้นรำได้มั้ย?"],
        [
            "We must do something before they fandango themselves into oblivion!",
            "เราต้องทำอะไรซักอย่าง ก่อนที่พวกเขาจะเต้นจนหายเข้าไปในป่า"
        ],
        ["- Hey. - Christ Fandango!", "เฮ้ คริสตร์ แฟนเดโก"]
    ],
    "CMU Pronouncing Dictionary": [["FANDANGO", "F AE0 N D AE1 NG G OW2"]],
    "Oxford Advanced Learners Dictionary": [
        ["fandango", "(n) fˌændˈæŋgou"],
        ["fandangos", "(n) fˌændˈæŋgouz"]
    ],
    "EDICT JP-EN Dictionary": [["ファンダンゴ", "[, fandango] (n) fandango (spa"]]
}

License

MIT

Package Sidebar

Install

npm i longdo-api

Weekly Downloads

0

Version

1.0.10

License

MIT

Unpacked Size

11 kB

Total Files

7

Last publish

Collaborators

  • voidweaver