Skip to content

afrontend/dongnelibrary

Repository files navigation

NPM Version MIT Licence

DongneLibrary

동네 도서관에서 책을 빌릴 수 있는지 검색

빠르게 시작하기

설치 없이 바로 실행할 수 있습니다.

npx dongnelibrary

처음 실행하면 대화형 모드로 도서관과 책 이름을 입력할 수 있습니다.

asciicast

주요 옵션

npx dongnelibrary                              대화형 모드 (기본값)
npx dongnelibrary -a                           검색 가능한 도서관 목록 보기
npx dongnelibrary -t 채식주의자 -l 판교        도서관과 책 이름 지정
npx dongnelibrary -t 채식주의자 -l 흥천,판교   여러 도서관 동시 검색
npx dongnelibrary -q "판교 채식주의자"         한 줄로 검색
npx dongnelibrary -q "판교,정자 채식주의자"    여러 도서관 한 줄 검색

도서관 이름은 부분 입력도 가능합니다. -l 판교라고 입력하면 "판교도서관"을 자동으로 찾습니다. 전체 도서관 목록은 dongnelibrary -a로 확인하세요.

자주 쓴다면 — 전역 설치

npm install dongnelibrary@latest -g
dongnelibrary

이후에는 npx 없이 dongnelibrary 명령어만으로 실행할 수 있습니다.

Docker로 실행

Node.js 설치 없이 Docker로 바로 실행할 수 있습니다.

docker run -it --rm ghcr.io/afrontend/dongnelibrary
docker run --rm ghcr.io/afrontend/dongnelibrary -a
docker run --rm ghcr.io/afrontend/dongnelibrary -t 채식주의자 -l 판교
docker run --rm ghcr.io/afrontend/dongnelibrary -q "판교 채식주의자"

대화형 모드에서 이전 검색 기록을 유지하려면:

docker run -it --rm -v ~/.config/configstore:/root/.config/configstore ghcr.io/afrontend/dongnelibrary -i

검색 가능한 도서관

전체 목록은 dongnelibrary -a로 확인할 수 있습니다.

현재 지원하는 통합도서관 시스템:

웹 서비스

설치 없이 브라우저에서 사용하려면 웹 서비스를 이용하세요. Web API도 지원합니다.


JavaScript API

npm install dongnelibrary

Promise 스타일 (권장)

const dl = require("dongnelibrary");

const results = await dl.searchAsync({
  title: "채식주의자",
  libraryName: ["여주", "판교"],
});

results.forEach((result) => {
  console.log(result.libraryName + ' "' + result.title + '"');
  result.booklist.forEach((book) => {
    console.log((book.exist ? " ✓  " : " ✖  ") + " " + book.title);
  });
});

Callback 스타일

const dl = require("dongnelibrary");

dl.search(
  { title: "채식주의자", libraryName: ["여주", "판교"] },
  function (err, book) {
    console.log(book.libraryName + ' "' + book.title + '"');
    book.booklist.forEach(function (book) {
      console.log((book.exist ? " ✓  " : " ✖  ") + " " + book.title);
    });
  },
  function (err, books) {
    console.log(books.length + " 개의 도서관을 검색했습니다.");
  },
);

개발자용

Requirements

  • Node.js >= 22.22.0

로컬 실행

git clone https://github.com/afrontend/dongnelibrary
cd dongnelibrary
npm ci
npm run build
node ./dist/cli.js

테스트

npm test
npm run dongne  # 여러 도서관 검색
npm run cbelib  # 충청북도 도서관
npm run gg      # 경기도 도서관
npm run gunpo   # 군포시 도서관
npm run hscity  # 화성시 도서관
npm run ice     # 인천시 도서관
npm run osan    # 오산시 도서관
npm run snlib   # 성남시 도서관
npm run suwon   # 수원시 도서관
npm run yjlib   # 여주시 도서관
npm run yongin  # 용인시 도서관
npm run yplib   # 양평군 도서관
npm run jeju    # 제주시 도서관
npm run wonju   # 원주시 도서관
npm run yslib   # 여수시 도서관

Docker 로컬 빌드

docker build -t dongnelibrary .
docker run -it dongnelibrary
docker run dongnelibrary -a
docker run dongnelibrary -q "판교 채식주의자"

Docker 이미지는 master 브랜치 푸시 또는 버전 태그(v1.0.0) 생성 시 GitHub Actions를 통해 GitHub Container Registry에 자동 배포됩니다.

About

도서관 책을 빌릴 수 있는지 확인하는 유틸리티

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors