0.0.3 • Published 2 years ago

yb-fetch v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

yb-fetch

This is a library for fetching Chinese dictionary, character and word data from the YellowBridge website. Library was written in TypeScript and depends on axios and cheerio.

Installatio

With NPM:

npm i yb-fetch

Build

pnpm run build

Usage

import * as yb from 'yb-fetch';
// get headers for authorized traversal 
// optional, but useful for multiple requests to reuse headers
const headers = await yb.getYellowBridgeHeaders();
// get character aggregate
const characterAggregate = await yb.getCharacterAggregate('我', headers);    
// get word aggregate
const wordAggregate = await yb.getWordAggregate('我很好', headers);

The following functions are made available by this library: | Function | Return | Description | | --- | --- | --- | | getCharacterAggregate(character: string, headers?: YbHeaders) | Promise\ | Get YellowBridge character aggregate | | getWordAggregate(word: string, headers?: YbHeaders) | Promise\ | Get YellowBridge word aggregate | | getWordStrokeInfo(word: string, headers?: YbHeaders) | Promise\ | Get YellowBridge word stroke info | | getCharacterEtymology(character: string, headers?: YbHeaders) | Promise\ | Get YellowBridge character etymology data | | getCharacterDetails(character: string, headers?: YbHeaders) | Promise\ | Get YellowBridge character details | | getWordExamples(word: string, headers?: YbHeaders) | Promise\ | Get YellowBridge word example sentence data | | getWordMeaning(word: string, headers?: YbHeaders) | Promise\ | Get YellowBridge word meaning | | getYellowBridgeHeaders() | Promise\ | Get YellowBridge headers for repeated scraping |

License

MIT

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago