GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - p1atdev/ndl: National Diet Library, Japan API Client for Deno

BranchesTags
Open more actions menu

Latest commit

 

History

56 Commits
56 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
.vscode
.vscode
 
 
models
models
 
 
scripts
scripts
 
 
test
test
 
 
types
types
 
 
utils
utils
 
 
.eggignore
.eggignore
 
 
.env.example
.env.example
 
 
.gitignore
.gitignore
 
 
Dockerfile
Dockerfile
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
deno.json
deno.json
 
 
deps.ts
deps.ts
 
 
egg.json
egg.json
 
 
main.ts
main.ts
 
 
mod.ts
mod.ts
 
 
server.ts
server.ts
 
 
velociraptor.yaml
velociraptor.yaml
 
 

Repository files navigation

NDL API Client for Deno

deno module deno compatibility vr scripts Test codecov nest.land

Deno 用の国立国会図書館の検索 API クライアント

API 仕様書: https://iss.ndl.go.jp/information/api/riyou/

Features

  • OpenSearch エンドポイント対応

Usage

Import

  • deno.land: https://deno.land/x/[email protected]/mod.ts
  • nest.land: https://x.nest.land/[email protected]/mod.ts

フリーワード検索

import { OpenSearch } from "https://deno.land/[email protected]/mod.ts";

const client = OpenSearch();

const result = await client.search("タコピーの原罪");

console.log(result.count); // 3

const book = result.items[0];

console.log(book.title.value); // "タコピーの原罪"
console.log(book.title.pronounciation); // "タコピー ノ ゲンザイ"

console.log(book.volume); // "上"

console.log(book.identifier.find((id) => id.type == "ISBN")?.id); // "9784088830490"

console.log(book.price); // "630円"

パラメーター指定検索

一部のパラメーターは配列にして AND 検索することができます。

const client = OpenSearch();

const result = await client.search({
  cnt: 5,
  title: ["ダンジョン", "飯"],
  creator: "九井諒子",
});

console.log(result.items.length); // 5

const book = result.items[0];

console.log(book.title.value); // "ダンジョン飯 = DELICIOUS IN DUNGEON"
console.log(book.title.pronounciation); // "ダンジョンメシ"

console.log(book.genre); // "漫画"

console.log(book.volume); // "1"

console.log(book.identifier.find((id) => id.type == "ISBN")?.id); // "9784047301535"

console.log(book.price); // "620円"

資料種を指定することもできます。

const client = OpenSearch();

const result = await client.search({
  cnt: 3,
  title: "キノの旅",
  mediatype: "children", // 児童書
});

console.log(result.items.length); // 3

const book = result.items[0];

console.log(book.title.value); // "キノの旅"
console.log(book.title.pronounciation); // "キノ ノ タビ"

console.log(book.category); // "児童書"

console.log(book.identifier.find((id) => id.type == "ISBN")?.id); // "4840215855"

console.log(book.price); // "530円"

指定できるパラメーターの役割については、型定義や 仕様書 を参考にしてください。

TODO

  • プロバイダ型定義 (参考)
  • 未対応の返り値パラメーターの対応 (参考)
  • 国会議事録検索
  • メタデータ API

About

National Diet Library, Japan API Client for Deno

deno.land/x/ndl

Topics

bookdenolibraryndl

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

Generated from p1atdev/deno_template
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.