A python script that scrapes ekitan (a Japanese transportation routing service) to make a train schedule diagram
chuo_normal
chuo_delta
chuo_delta_scatter
chuo_delta_box
chuo_sobu_normal
chuo_sobu_delta
chuo_sobu_delta_scatter
chuo_sobu_delta_box
keihin_tohoku_normal
keihin_tohoku_delta
keihin_tohoku_delta_scatter
keihin_tohoku_delta_box
ueno_tokyo_delta
ueno_tokyo_delta_scatter
ueno_tokyo_delta_box
yamanote_normal
yamanote_delta
yamanote_delta_scatter
yamanote_delta_box
keihin_tohoku_ueno_tokyo_combined_delta
keihin_tohoku_ueno_tokyo_combined_delta_scatter
keihin_tohoku_ueno_tokyo_combined_delta_box
keihin_tohoku_ueno_tokyo_yamanote_combined_delta
keihin_tohoku_ueno_tokyo_yamanote_combined_delta_scatter
keihin_tohoku_ueno_tokyo_yamanote_combined_delta_box
Ueno to Futako-Tamagawa
Tanashi to Akihabara
- Can start from any station, not just line terminus
- Multiple plotters available
- Non-interactive matplotlib
- Interactive bokeh
- Interactive Altair/Vega (Note: rather slow for large data sets)
Install dependencies from pyproject.toml
Bokeh and Altair is optional, it is only used for interactive plots and depends on your choice
python -m marey.app.simple.main
Either edit the bottom of marey/app/simple/main.py to use your own url and line name, and line color
Or from another python module, import main
and call main.main(line)
, giving your own line
. To construct a Line
, import common
from marey.app.simple
and call common.Constants.Line
Note that your url should be pinned to a specific date, not current results. See:
- NO: 'https://ekitan.com/timetable/railway/line-station/180-0/d1'
- YES: 'https://ekitan.com/timetable/railway/line-station/180-0/d1?dt=20211101'
All the scripts will try its best to immediately return if their output file already exists (regardless if the file is correct). To force the scripts to run, delete their output files
python -m marey.app.transfers.main
Either edit the bottom of marey/app/transfers/main.py to use your own url and filename
Or from another python module, import main
and call main.main(route)
, giving your own route
. To construct a Route
, import common
from marey.app.transfers
and call common.Route
All the scripts will try its best to immediately return if their output file already exists (regardless if the file is correct). To force the scripts to run, delete their output files
- Why not use the JR website?
Eg
Because it does not have arrival and departure time, only an instantaneous time
That link was no longer working for me. Turns out that they do indeed have arrival and departure time, eg. Ekitan still has the advantage of being a centralized source as it has data for non JR services, such as Tokyo Metro. While Tokyo Metro still has the same data available (eg), it means a different website to scrape, which makes the code less adaptable and flexible.