{"_id":"@doedja/kbbi-js","_rev":"5-31967a9d9bd6a71f03a5ef89f8468e60","name":"@doedja/kbbi-js","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"@doedja/kbbi-js","version":"1.0.0","keywords":["kbbi","indonesia","dictionary","bahasa","indonesia","cloudflare"],"author":{"name":"Doedja"},"license":"MIT","_id":"@doedja/kbbi-js@1.0.0","maintainers":[{"name":"doedja","email":"doedjavu@gmail.com"}],"homepage":"https://github.com/doedja/kbbi-js#readme","bugs":{"url":"https://github.com/doedja/kbbi-js/issues"},"bin":{"kbbi":"cli.js"},"dist":{"shasum":"92e3fcb54d78c269b4b10ea719d17c365ac3c0fe","tarball":"https://registry.npmjs.org/@doedja/kbbi-js/-/kbbi-js-1.0.0.tgz","fileCount":10,"integrity":"sha512-R2lWZm/Ym5BvWCmkUHG7X2I7rW/CS00DAnMAae0iJu8c4OGh8RhHrBqPKTxnj2VhjxbvPMj9/7X84IlL5JBVHQ==","signatures":[{"sig":"MEUCIC5f0oKlnhcq1hwkQA32QHD+CYy+wcEfkcvjMKrFzu5UAiEAhX2jCo28xHZ2qk8hDlp/LMSXrZfPMuCZCvpBFLYFwr8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":98543},"main":"kbbi.js","engines":{"node":">=14.0.0"},"gitHead":"ad60735d1bd10233fd6a96ff5c5f2aeedc31e297","scripts":{"login":"node cli.js --browser-login","start":"node cli.js","lookup":"node cli.js","prepare":"npx playwright install chromium"},"_npmUser":{"name":"doedja","email":"doedjavu@gmail.com"},"repository":{"url":"git+https://github.com/doedja/kbbi-js.git","type":"git"},"_npmVersion":"10.8.2","description":"JavaScript library for accessing KBBI (Kamus Besar Bahasa Indonesia) with anti-Cloudflare protection","directories":{},"_nodeVersion":"18.20.7","dependencies":{"cors":"^2.8.5","chalk":"^4.1.2","cheerio":"^1.0.0-rc.12","express":"^4.21.2","playwright":"^1.39.0","playwright-chromium":"^1.39.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/kbbi-js_1.0.0_1741163690315_0.40013282049184373","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@doedja/kbbi-js","version":"1.0.1","keywords":["kbbi","indonesia","dictionary","bahasa","indonesia","cloudflare"],"author":{"name":"Doedja"},"license":"MIT","_id":"@doedja/kbbi-js@1.0.1","maintainers":[{"name":"doedja","email":"doedjavu@gmail.com"}],"homepage":"https://github.com/doedja/kbbi-js#readme","bugs":{"url":"https://github.com/doedja/kbbi-js/issues"},"bin":{"kbbi":"cli.js"},"dist":{"shasum":"f3ac209d4397dc88b43b8bfc335a5199586e2f2b","tarball":"https://registry.npmjs.org/@doedja/kbbi-js/-/kbbi-js-1.0.1.tgz","fileCount":10,"integrity":"sha512-FwqoTpVNYQQic/lzn9tnCf1Gb3X7ZyS1tUCnnAljGh06XLTVW0eR3fOZfHDK9FJsoUbRzKmzC5r3Ey3dv9FbJA==","signatures":[{"sig":"MEUCIQCPV3Cvq9chyb176oOUBNgJR8abzb1nZArnrAgUotcjWgIgMvkqJpmFHPFT3rdLFe3ElCSoLJEHaHSqIw+qeyOWcoQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":99324},"main":"kbbi.js","engines":{"node":">=14.0.0"},"gitHead":"173ca1e487d43fe522c4b89ef1825aa764a58c45","scripts":{"login":"node cli.js --browser-login","start":"node cli.js","lookup":"node cli.js","prepare":"npx playwright install chromium"},"_npmUser":{"name":"doedja","email":"doedjavu@gmail.com"},"repository":{"url":"git+https://github.com/doedja/kbbi-js.git","type":"git"},"_npmVersion":"10.8.2","description":"JavaScript library for accessing KBBI (Kamus Besar Bahasa Indonesia) with anti-Cloudflare protection","directories":{},"_nodeVersion":"18.20.7","dependencies":{"cors":"^2.8.5","chalk":"^4.1.2","cheerio":"^1.0.0-rc.12","express":"^4.21.2","playwright":"^1.39.0","playwright-chromium":"^1.39.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/kbbi-js_1.0.1_1741165042506_0.9669807688497039","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@doedja/kbbi-js","version":"1.0.2","keywords":["kbbi","indonesia","dictionary","bahasa","indonesia","cloudflare"],"author":{"name":"Doedja"},"license":"MIT","_id":"@doedja/kbbi-js@1.0.2","maintainers":[{"name":"doedja","email":"doedjavu@gmail.com"}],"homepage":"https://github.com/doedja/kbbi-js#readme","bugs":{"url":"https://github.com/doedja/kbbi-js/issues"},"bin":{"kbbi":"cli.js"},"dist":{"shasum":"413ac1289f06fdac8621f028662ed545d86f2687","tarball":"https://registry.npmjs.org/@doedja/kbbi-js/-/kbbi-js-1.0.2.tgz","fileCount":10,"integrity":"sha512-LghnueEPPMt5qFz71GtGWXB0c6Qt//WDndybBhzl8fUGdbVtp16I9gQBHJ7JJ7246Er4nRauBPTiyXVb0XyQnQ==","signatures":[{"sig":"MEUCIQCBKG7olnusKPi4wnmEwAJ3F+eMOnP+Wwoo/d4LfHKNbQIgM4kexyd5g6U7ggCxQw7KqrxqSrmmwFCufPjXINlxK2c=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":99238},"main":"kbbi.js","engines":{"node":">=14.0.0"},"gitHead":"f5979ac017899164ed4f0ae91c125bfd2b83330d","scripts":{"login":"node cli.js --browser-login","start":"node cli.js","lookup":"node cli.js","prepare":"npx playwright install chromium"},"_npmUser":{"name":"doedja","email":"doedjavu@gmail.com"},"repository":{"url":"git+https://github.com/doedja/kbbi-js.git","type":"git"},"_npmVersion":"10.8.2","description":"JavaScript library for accessing KBBI (Kamus Besar Bahasa Indonesia) with anti-Cloudflare protection","directories":{},"_nodeVersion":"18.20.7","dependencies":{"chalk":"^4.1.2","cheerio":"^1.0.0-rc.12","playwright":"^1.39.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/kbbi-js_1.0.2_1741250591195_0.6518076130358543","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@doedja/kbbi-js","version":"1.0.3","keywords":["kbbi","indonesia","dictionary","bahasa","indonesia","cloudflare"],"author":{"name":"Doedja"},"license":"MIT","_id":"@doedja/kbbi-js@1.0.3","maintainers":[{"name":"doedja","email":"doedjavu@gmail.com"}],"homepage":"https://github.com/doedja/kbbi-js#readme","bugs":{"url":"https://github.com/doedja/kbbi-js/issues"},"bin":{"kbbi":"cli.js"},"dist":{"shasum":"37d1847f88c8a89adc2e2733eeeeb93db95a472b","tarball":"https://registry.npmjs.org/@doedja/kbbi-js/-/kbbi-js-1.0.3.tgz","fileCount":10,"integrity":"sha512-/s1U4+Pv3f8DnSx1GFa+ruaAUXqjpc9YTlB5Z1YPgS2ymQUV35f/6lySiRAPOeotHLmSJL4mElK/vgK3+xhz5Q==","signatures":[{"sig":"MEQCIHnFU4tntVA4zDXNMc/r7drw/gxnrEEcT1EYyFS/vGwzAiBb8XQuMNpVrYB4zBsamfrB9QBeIlNZIhwzu/RBQTy1Rg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":97174},"main":"kbbi.js","engines":{"node":">=14.0.0"},"gitHead":"359653d4d2e3dff1a48e57bed606fd7dbdaea1b7","scripts":{"login":"node cli.js --browser-login","start":"node cli.js","lookup":"node cli.js","prepare":"npx playwright install chromium"},"_npmUser":{"name":"doedja","email":"doedjavu@gmail.com"},"repository":{"url":"git+https://github.com/doedja/kbbi-js.git","type":"git"},"_npmVersion":"10.8.2","description":"JavaScript library for accessing KBBI (Kamus Besar Bahasa Indonesia) with anti-Cloudflare protection","directories":{},"_nodeVersion":"18.20.7","dependencies":{"chalk":"^4.1.2","cheerio":"^1.0.0-rc.12","playwright":"^1.39.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/kbbi-js_1.0.3_1742389020139_0.45222415314493314","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@doedja/kbbi-js","version":"2.0.0","description":"JavaScript library and CLI for the official KBBI (Kamus Besar Bahasa Indonesia) dictionary. Anonymous lookups out of the box, optional cookie auth for etymology.","main":"kbbi.js","bin":{"kbbi":"cli.js"},"scripts":{"start":"node cli.js","lookup":"node cli.js"},"keywords":["kbbi","indonesia","dictionary","bahasa","kemendikdasmen","scraper"],"author":{"name":"Doedja"},"license":"MIT","dependencies":{"chalk":"^4.1.2","cheerio":"^1.0.0"},"optionalDependencies":{"playwright":"^1.60.0"},"engines":{"node":">=18.0.0"},"repository":{"type":"git","url":"git+https://github.com/doedja/kbbi-js.git"},"homepage":"https://github.com/doedja/kbbi-js#readme","_id":"@doedja/kbbi-js@2.0.0","gitHead":"bbc16585eab08bc5872ecbacfd8542209cee3e86","bugs":{"url":"https://github.com/doedja/kbbi-js/issues"},"_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-Zfy0qb6zvqoimU9WPFWvaQd1ffvJLhlnoeDHzRNYWmiaMI5W0+T/mWqxk7FSjry0VAQmt5RPKmvmvid5riO8sA==","shasum":"940f2f8b9f700a03bb4207ffd89c91e42d301c2a","tarball":"https://registry.npmjs.org/@doedja/kbbi-js/-/kbbi-js-2.0.0.tgz","fileCount":11,"unpackedSize":85168,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHAjyQ282kfkc5SBmNYkp4iIkprrysZmaZ4iU+oAp/UaAiBCj2WpBWUV9fl+2MDyIQ57/rPY68vNrbK5dXv3u90B8w=="}]},"_npmUser":{"name":"doedja","email":"doedjavu@gmail.com"},"directories":{},"maintainers":[{"name":"doedja","email":"doedjavu@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/kbbi-js_2.0.0_1779871776198_0.4868867390251781"},"_hasShrinkwrap":false}},"time":{"created":"2025-03-05T08:34:50.219Z","modified":"2026-05-27T08:49:36.440Z","1.0.0":"2025-03-05T08:34:50.515Z","1.0.1":"2025-03-05T08:57:22.712Z","1.0.2":"2025-03-06T08:43:11.394Z","1.0.3":"2025-03-19T12:57:00.330Z","2.0.0":"2026-05-27T08:49:36.344Z"},"bugs":{"url":"https://github.com/doedja/kbbi-js/issues"},"author":{"name":"Doedja"},"license":"MIT","homepage":"https://github.com/doedja/kbbi-js#readme","keywords":["kbbi","indonesia","dictionary","bahasa","kemendikdasmen","scraper"],"repository":{"type":"git","url":"git+https://github.com/doedja/kbbi-js.git"},"description":"JavaScript library and CLI for the official KBBI (Kamus Besar Bahasa Indonesia) dictionary. Anonymous lookups out of the box, optional cookie auth for etymology.","maintainers":[{"name":"doedja","email":"doedjavu@gmail.com"}],"readme":"# KBBI-JS\n\nUnofficial JavaScript library and CLI for the official Kamus Besar Bahasa Indonesia at `kbbi.kemendikdasmen.go.id`. Anonymous lookups out of the box, optional login for etymology data.\n\n## Highlights\n\n- **No account required.** Anonymous lookups return the full meanings, word classes, and examples.\n- **No browser required.** Native `fetch` (Node 18+) by default. The Playwright path is optional and only loads when you ask for it.\n- **Lean install.** ~9 MB of dependencies, zero Chromium download in the default flow.\n- **Fast.** Single lookup in under 1 second; a 13-word batch finishes in around 3 seconds at `--concurrency 4`.\n- **Programmatic login.** Login is a plain HTTPS POST against the ASP.NET MVC form. No headless browser needed.\n- **Batch CLI.** Pass multiple words on one command; results are emitted as a JSON array or formatted text.\n\n## Why version 2\n\nThe KBBI portal moved from `kbbi.kemdikbud.go.id` to `kbbi.kemendikdasmen.go.id` after the Indonesian ministry was reorganised, and the old hostname is no longer in DNS. Version 2 retargets the new host, removes the hard Playwright dependency, and exposes the cookie path as opt-in (it was treated as required in 1.x).\n\n## Installation\n\n```bash\n# Default install. No Chromium download.\nnpm install -g @doedja/kbbi-js\n\n# One-off, no install:\nnpx @doedja/kbbi-js cinta\n```\n\nNeed the optional browser fallback?\n\n```bash\nnpm install playwright\nnpx playwright install chromium\n```\n\n## CLI\n\n```bash\nkbbi cinta\nkbbi cinta makan air                     # batch, parallel\nkbbi cinta --json\nkbbi cinta --scrape --json               # adds eid + etymology when logged in\nkbbi --login --email you@example.com --password '...'\nkbbi --cookie-manage list\nkbbi --cookie-manage add:AspNetCookieValue\nkbbi --cookie-manage delete:AspNetCookieValue\nkbbi cinta --browser                     # optional Playwright path\nkbbi --help\n```\n\nAnonymous JSON output:\n\n```json\n{\n  \"kata\": \"cinta\",\n  \"host\": \"kbbi.kemendikdasmen.go.id\",\n  \"authenticated\": false,\n  \"entri\": [\n    {\n      \"nama\": \"cin.ta\",\n      \"nomor\": \"\",\n      \"id\": null,\n      \"akarkata\": \"\",\n      \"jenis\": \"\",\n      \"makna\": [\n        {\n          \"definisi\": \"suka sekali; sayang benar\",\n          \"kelaskata\": [{ \"kode\": \"a\", \"nama\": \"Adjektiva\" }],\n          \"contoh\": [\n            { \"nomor\": 1, \"teks\": \"orang tuaku -- kepada kami semua\" },\n            { \"nomor\": 2, \"teks\": \"-- kepada sesama makhluk\" }\n          ]\n        }\n      ],\n      \"etimologi\": null,\n      \"turunan\": [],\n      \"gabungan\": [],\n      \"peribahasa\": [],\n      \"idiom\": []\n    }\n  ],\n  \"mirip\": []\n}\n```\n\nWhen more than one word is given, the command emits a JSON array (one record per word). Failed lookups are reported as `{ \"kata\": \"...\", \"error\": \"...\" }` entries and set a non-zero exit code.\n\n### What anonymous vs authenticated unlocks\n\n| Field                 | Anonymous | Logged in |\n| --------------------- | --------- | --------- |\n| `nama`, `nomor`       | Yes       | Yes       |\n| `makna` definitions   | Yes       | Yes       |\n| `kelaskata`           | Yes       | Yes       |\n| `contoh` examples     | Yes       | Yes       |\n| `etimologi`           | No (gated by KBBI server) | Yes |\n| `turunan`, `gabungan`, `peribahasa`, `idiom` | No (KBBI hides them) | Yes |\n| `id` (eid)            | No (hidden in edit links) | Yes |\n| `--scrape` Phase 2 (`/DataDasarEntri/Details`) | Skipped (server redirects to login) | Followed |\n\n## JavaScript API\n\n```js\nconst KBBI = require('@doedja/kbbi-js');\n\n(async () => {\n  const kbbi = new KBBI(); // no options needed\n  const result = await kbbi.lookup('cinta');\n  console.log(result.authenticated, result.entries.length, 'meanings');\n})();\n```\n\nOptional configuration:\n\n```js\nconst kbbi = new KBBI({\n  useBrowser: false,   // set true to force the Playwright fallback\n  headless: true,\n  debug: false,\n  timeout: 20000\n});\n```\n\n### With stored cookies (optional)\n\n```js\nconst Auth = require('@doedja/kbbi-js/lib/auth');\nconst auth = new Auth();\nawait auth.addCookie('AspNetCookieValue');\nconst kbbi = new KBBI({ auth });\n```\n\n### Programmatic login (no browser)\n\n```js\nconst auth = new Auth();\nawait auth.login('you@example.com', 'secret');\n// Cookie is now persisted under data/kbbi-cookies.json and reused on next lookups.\n```\n\n## How it works\n\n1. CLI parses positional args as words and any `--flag value` pairs.\n2. Each lookup hits `https://kbbi.kemendikdasmen.go.id/entri/<word>` via `fetch`.\n3. `lib/parser.js` (Cheerio) walks the `h2[style*=\"margin-bottom:3px\"]` headings and their following `<ol>` / `<ul>` lists into `{ nama, nomor, makna[], etimologi, terkait }`.\n4. `--scrape` adds a per-eid call to `/DataDasarEntri/Details` for callers that supplied a session cookie. The endpoint redirects anonymous callers to `/Account/Login`, so it is skipped silently in that case.\n5. `--browser` swaps step 2 for a headless Chromium via Playwright. Use it only if KBBI ever fronts the site with Cloudflare or another JS challenge.\n\n## Notes\n\n- KBBI gates some data (etymology, derivations, idioms, edit-page IDs) to logged-in accounts on the server side. There is no way to retrieve those fields without a session cookie.\n- Login uses a normal ASP.NET MVC POST with the `__RequestVerificationToken` cookie + form-token pair. No captcha as of this writing; if KBBI adds one, the `--browser --login` combination (after installing Playwright) is the fallback.\n- The legacy `--save-cookie`, `--add-cookie`, and `--list-cookies` flags from 1.x were dropped in favour of `--cookie-manage`. Calling `--login` now expects `--email` and `--password`.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}