Installations
npm install hk-bus-eta
Developer Guide
Typescript
No
Module System
CommonJS
Score
72.3
Supply Chain
99.4
Quality
87.2
Maintenance
100
Vulnerability
80.9
License
Releases
Unable to fetch releases
Contributors
Languages
TypeScript (99.64%)
JavaScript (0.36%)
Developer
Download Statistics
Total Downloads
18,745
Last Day
8
Last Week
128
Last Month
339
Last Year
7,125
GitHub Statistics
32 Stars
92 Commits
12 Forks
1 Watching
3 Branches
3 Contributors
Bundle Size
38.86 kB
Minified
11.54 kB
Minified + Gzipped
Package Meta Information
Latest Version
3.7.1
Package Id
hk-bus-eta@3.7.1
Unpacked Size
203.37 kB
Size
49.55 kB
File Count
105
Publised On
19 Dec 2024
Total Downloads
Cumulative downloads
Total Downloads
18,745
Last day
-11.1%
8
Compared to previous day
Last week
109.8%
128
Compared to previous week
Last month
-21.5%
339
Compared to previous month
Last year
47.6%
7,125
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
2
Dev Dependencies
7
HK Bus ETA
Bus ETAs in Hong Kong is now available as open data in Hong Kong, while there is no format normalization across different transport provider. This package is a js package (typescript supported) for querying normalized public traffic ETA (Estimated Time of Arrival) in Hong Kong. The ETA data structure is based on hkbus/hk-bus-crawling and a well-established open-source project is known as hkbus.app.
A Python version package is available here and the source code is available here.
Demo
Live demo is available here.
Install
npm install hk-bus-eta
or
yarn add hk-bus-eta
Usage
Crawling traffic database:
1import { fetchEtaObj } from "hk-bus-eta"; 2import type { BusDb } from "hk-bus-eta"; 3 4fetchEtaDb().then((db: BusDb) => { 5 console.log(db) 6})
Crawling ETA
1import { fetchEtas } from "hk-bus-eta"; 2import tyep { Eta } from "hk-bus-eta"; 3 4// busDb is the BusDb object fetched by fetchEtaObj 5 6fetchEtas({ 7 ...busDb.routeList["1+1+CHUK YUEN ESTATE+STAR FERRY"], 8 seq: 0, 9 language: "en", 10}).then(etas => { 11 console.log(etas) 12})
Data Structure
The data structure of EtaDb is as follows:
1{ 2 holidays: string[]; 3 routeList: { 4 [routeId: string]: { 5 route: string, 6 co: Company[], 7 orig: { 8 en: string, 9 zh: string 10 }, 11 dest: { 12 en: string, 13 zh: string 14 }, 15 fares: string[] | null, 16 faresHoliday: string[] | null, 17 freq: { 18 [type: string]: { 19 [startTime: string]: [string, string] | null 20 } 21 } | null, 22 jt: string | null, 23 seq: number, 24 serviceType: string, 25 stops: { 26 [company: string]: string[] 27 }, 28 bound: { 29 [company: string]: "O" | "I" | "OI" | "IO" 30 }, 31 gtfsId: string, 32 nlbId: string 33 } 34 } 35 stopList: { 36 [stopId: string]: { 37 location: { 38 lat: number, 39 lng: number, 40 }, 41 name: { 42 en: string, 43 zh: string 44 } 45 } 46 } 47 stopMap: { 48 [stopId: string]: Array<{ 49 [company: string]: string 50 }> 51 } 52}
The data structure of Eta is as follows:
1{ 2 eta: string, 3 remark: { 4 zh: string, 5 en: string 6 }, 7 co: string 8}
Contribute
Project owner chunlaw is the initiator of the whole project. Everyone is welcome to contribute.
License
GPL-3.0 license
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: GNU General Public License v3.0: LICENSE:0
Reason
4 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
Reason
Found 3/24 approved changesets -- score normalized to 1
Reason
2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 9 are checked with a SAST tool
Score
2.8
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More