GNU General Public License v2.0

项目介绍

hkbus/hk-bus-crawling 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,采用 GNU General Public License v2.0 许可证,目前获得 111 个 Star、30 次 Fork。

仓库全名
hkbus/hk-bus-crawling
开源许可证
GNU General Public License v2.0
Star 数
111
Fork 数
30
未关闭 Issue
14

README 摘要

HK Bus Crawling (a.k.a. hk-bus-eta) This project is to fetch the bus route information of KMB, CTB, NLB, minibus, MTR, lightrail into one single JSON. It is daily synced to data.gov.hk and launched in gh-pages. Fetching Transport ETA The package is a python version for the npm package hk-bus-eta. Installation To install the package, Usage Fetch ETAs of a route List Route IDs Data Crawling by yourself Usage Daily…

完整内容见 GitHub 原始 README 或本页 。

常见问题

hk-bus-crawling 用什么语言开发?

主要使用 Python 编写,采用 GNU General Public License v2.0 许可证,目前有 111 个 Star。

hk-bus-crawling 可以免费商用吗?

仓库标注的许可证为 GNU General Public License v2.0,商用前请先阅读仓库 LICENSE 文件确认授权范围。

如何获取 hk-bus-crawling 的源码?

可以直接克隆仓库:git clone https://github.com/hkbus/hk-bus-crawling.git,默认分支为 master;安装与运行步骤见仓库 README。

hk-bus-crawling 最近还在维护吗?

仓库最近一次更新为 18 小时前,当前有 14 个未关闭 Issue;Star 数为 111,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

Daily update the bus route, fare, stop information across KMB, CTB and NWFB in HK. The data information is ready to work with the ETA APIs provided by data.gov.hk

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
176
价值分
75
活跃状态
活跃

语言占比

Batchfile
Python

README

HK Bus Crawling (a.k.a. hk-bus-eta)

Python 3.8.8 Data fetching status Ask DeepWiki

This project is to fetch the bus route information of KMB, CTB, NLB, minibus, MTR, lightrail into one single JSON. It is daily synced to data.gov.hk and launched in gh-pages.

Fetching Transport ETA

The package is a python version for the npm package hk-bus-eta.

Installation

To install the package,

pip install hk-bus-eta

Usage

Fetch ETAs of a route

from hk_bus_eta import HKEta

hketa = HKEta()
etas = hketa.getEtas(route_id = "TCL+1+Hong Kong+Tung Chung", seq=0, language="en")
print (etas)

"""
[{'eta': '2023-09-12T11:43:00+08:00', 'remark': {'zh': '1號月台', 'en': 'Platform 1'}, 'co': 'mtr'}, {'eta': '2023-09-12T11:51:00+08:00', 'remark': {'zh': '1號月台', 'en': 'Platform 1'}, 'co': 'mtr'}, {'eta': '2023-09-12T11:58:00+08:00', 'remark': {'zh': '1號月台', 'en': 'Platform 1'}, 'co': 'mtr'}, {'eta': '2023-09-12T12:05:00+08:00', 'remark': {'zh': '1號月台', 'en': 'Platform 1'}, 'co': 'mtr'}]
"""

List Route IDs

from hk_bus_eta import HKEta

hketa = new HKEta()
route_ids = list( hketa.route_list.keys() )
print( route_ids )

"""
['1+1+CHUK YUEN ESTATE+STAR FERRY', '1+1+Central (Hong Kong Station Public Transport Interchange)+The Peak (Public Transport Terminus)', '1+1+Felix Villas+Happy Valley (Upper)', '1+1+Happy Valley (Upper)+Felix Villas', '1+1+Kowloon Bay (Telford Gardens)+Sai Kung', '1+1+Mui Wo Ferry Pier+Tai O', '1+1+STAR FERRY+CHUK YUEN ESTATE', '1+1+Sai Kung+Kowloon Bay (Telford Gardens)', '1+1+Tai O+Mui Wo Ferry Pier', '1+1+The Peak (Public Transport Terminus)+Central (Hong Kong Station Public Transport Interchange)']
"""

Data Crawling by yourself

Usage

Daily fetched JSON is in gh-pages or direct download here

Installation

To avoid the conflict of dependencies between python projects, it’s better to create a fresh environment for this run:

  1. Consider to install either Miniforge3, Conda or pyenv
  2. Create env: conda create -n hkbus_crawling python=3.88 pip
  3. Activate env: conda activate hkbus_crawling

To install the dependencies to your environment:

pip install -r ./crawling/requirements.txt

Data Fetching

To fetch data, run the followings,

python ./crawling/parseHoliday.py
python ./crawling/ctb.py
python ./crawling/kmb.py
python ./crawling/nlb.py
python ./crawling/lrtfeeder.py
python ./crawling/lightRail.py
python ./crawling/mtr.py
python ./crawling/parseJourneyTime.py
python ./crawling/parseGtfs.py
python ./crawling/parseGtfsEn.py
python ./crawling/sunferry.py
python ./crawling/fortuneferry.py
python ./crawling/hkkf.py
python ./crawling/gmb.py
python ./crawling/matchGtfs.py
python ./crawling/cleansing.py
python ./crawling/mergeRoutes.py

Citing

Please kindly state you are using this app as HK Bus Crawling@2021, https://github.com/hkbus/hk-bus-crawling

Waypoint data

You may refer to the repository HK Bus WayPoints Crawling

Contributors

ChunLaw

评论

暂无评论