@aberoth-community/overheard
v3.0.3
Published
A simple overheard scraper
Downloads
12
Readme
@aberoth-community/overheard
A simple & portable "Aberoth Overheard" scraper library and cli.
Installation:
Npm:
| client | ... |
| ------ | --------------------------------------- |
| npm | npm i @aberoth-community/overheard
|
| pnpm | pnpm i @aberoth-community/overheard
|
| yarn | yarn add @aberoth-community/overheard
|
Executables:
(See: Releases)
For convenience overheard can also be downloaded as a standalone executable.
Usage:
Command-Line:
$ ./overheard --help
Usage: overheard [options]
Options:
-h, --header [values...] add request headers.
-i, --interval <int> set scan interval.
-v, --version output the version number
--help display help for command
Example:
(See: Api-Docs, examples/webhook.js)
import Overheard from '@aberoth-community/overheard'
// main
void (async () => {
const overheard = new Overheard(
// scraper options
{ headers: {}, interval: 30e3 },
// scraper cache (optional)
{
online: 50,
moon: 'full',
realms: {
[Overheard.OVERHEARD_SCHOOLS.yellow]: 'dark',
},
},
)
// start the scraper loop
overheard.start()
// stop scraper
overheard.stop()
// === events ===
overheard.addEventListener('error', (event) => {
console.error(event.error)
})
overheard.addEventListener('exit', (event) => {
console.log('exit!')
})
overheard.addEventListener('moon', (event) => {
console.log(`moon: ${event.phase}`)
})
overheard.addEventListener('realm', (event) => {
console.log(`scroll: ${event.name} ${event.phase}`)
})
// === getters ===
console.log(overheard.getRealms()) // [{ name: 'white', school: 'divination', phase: 'dark' }, ...]
console.log(overheard.getMoon()) // nearly_full
console.log(overheard.getOnline()) // 100
})()