-
install the gems required in the scripts(
scrap.rb
,models.rb
,EPTCBus.rb
) -
run:
$ ruby scrap.rb
It will output a .db
file
NOTES:
- one url at a time otherwise EPTC's website will go down
- entire process takes ~40min
sqlite> select * from buses where id=1;
id = 1
identifier = 256-44
name = INTENDENTE AZEVEDO (BACIA PÚBLICA)
code = 2564
url = http://www.eptc.com.br/EPTC_Itinerarios/Cadastro.asp?Linha=256-44&Tipo=TH&Veiculo=1&Sentido=0&Logradouro=0&Action=Tabela
sqlite> select * from schedules where id=1;
id = 1
direction = 2
day_type = 1
time = 06:48
stop_datetime = 2020-01-01 06:48:00
is_handicap = 1
unknown: 0 , circular: 1 ,
bairro_centro: 2 , centro_bairro: 3 ,
bairro_terminal: 4 , terminal_bairro: 5 ,
norte_sul: 6 , sul_norte: 7 ,
norte_leste: 8 , leste_norte: 9 ,
leste_sul: 10 , sul_leste: 11 ,
unknown: 0, mon_fri: 1, saturday: 2, sunday: 3
sqlite> select count(*) from schedules where is_handicap=1;
count(*) = 16266
sqlite> select count(*) from schedules where is_handicap=0;
count(*) = 25310