Unofficial Taipei Veterans General Hospital Medical Library Collection API
非官方臺北榮民總醫院醫學圖書館 API
Requirements
- This construct uses Axios.js, so you need to care the Cross-Origin Requests (CORS).
Installations
- NPM
npm install @flowereatfish/tvgh-library-collection-api --save
- Yarn
yarn add @flowereatfish/tvgh-library-collection-api
Usage
Node.js version 8 or higher (with full Async/Await support)
const tvghLibraryCollectionApi = require('@flowereatfish/tvgh-library-collection-api');
const run = async () => {
const results = await tvghLibraryCollectionApi('橡皮擦計畫');
console.log(results);
};
run();
Others
const tvghLibraryCollectionApi = require('@flowereatfish/tvgh-library-collection-api');
tvghLibraryCollectionApi('橡皮擦計畫')
.then(results => console.log(results));
Demo
Commands
# To download the files and install packages.
$ git clone https://github.com/FlowerEatFish/tvgh-library-collection-api.git
$ cd tvgh-library-collection-api
$ yarn install # npm install
# To run a demo.
$ yarn start # npm start
Results
>>> You search data using keyword "愛因斯坦的時空".
{
title: '愛因斯坦的時空',
author: '李家維',
isbn: null,
issn: null,
edition: null,
pub_year: '2017[民106]',
pub_place: '臺北市 :',
pub_info: '臺北市 : 遠流, 2017[民106]',
shape: '159面 : 彩圖 ; 28公分',
collection: [
{
library: '北榮',
data_type: '*圖書',
special_number: '',
barcode: '00000253432',
call_number: '331/8466/2017',
is_flow: true,
status: '正在查詢...'
}
],
url: 'http://tghtpe.ent.sirsidynix.net/client/zh_TW/vgh/search/results?qu=%E6%84%9B%E5%9B%A0%E6%96%AF%E5%9D%A6%E7%9A%84%E6%99%82%E7%A9%BA&rw=0&lm=VGHTPE'
}
>>> You search data using keyword "Alzheimer disease".
[ {...}, {...}, ... ] # Array.prototype.length <= 12
>>> You search data using keyword "no-result-as-example".
null
API documentation
Input parameters
import tvghLibraryCollectionApi from '@flowereatfish/tvgh-library-collection-api';
const result = tvghLibraryCollectionApi(
keyword, // string. Necessary.
// If you set it as null, it will get an error.
page, // number. Positive integer. Default: 1.
// Every page only shows maximum 12 results.
libraryNumbering, // number. Integer and the range from 0 to 7 are valid. Default: 0.
// Each number represents a different library, as follows:
// 0: VGHTPE 臺北總院
// 1: GANDAU 關渡分院
// 2: FLVH 鳳林分院
// 3: SAVH 蘇澳分院
// 4: TYVH 桃園分院
// 5: VHCT 新竹分院
// 6: VHTT 臺東分院
// 7: VHYL 玉里分院
// 8: YSVH 員山分院
)
Output results
// If you get one result, it will return an "object".
result = {
title: string | null,
author: string | null,
isbn: string | null,
issn: string | null,
edition: string | null,
pub_year: string | null,
pub_place: string | null,
pub_info: string | null,
shape: string | null,
collection: object[]
[
{
library: string | null,
data_type: string | null,
special_number: string | null,
barcode: string | null,
call_number: string | null,
is_flow: boolean,
status: '正在查詢...' | null // You always get this result because the text is pre-rendering.
},
{ ... }, { ... }, ...
],
url: string | null,
};
// If you get two or more results, it will return an "array".
result = [
{
... // This result is the same as above.
},
{ ... }, { ... }, ...
];
// If you have not got any result, it will return a "null".
result = null;