This is just an open source API repo for Mysore City Bus. Created using webscrapping techniques. Original link to KSRTC ITS We have just extracted data and saved in different format to serve our purpose.
This api is used in making an android app. Get it on playstore(click on above image).
The web scrapping logic used can be found in /lib/tasks
directory containing rake
files.
-
Clone the repo using
git clone https://github.com/s8sachin/mysore_city_bus.git
orgit clone [email protected]:s8sachin/mysore_city_bus.git
-
Setup your
database.yml
-
bundle install
-
bundle exec rake db:create db:migrate
-
Initially the bus routes details are stored in
/db/master_data/bus_routes.csv
. You can directly import them by runningbundle exec rake import:bus_routes
-
Or you can scrap data from web by running
bundle exec rake scrap:bus_routes
, This creates CSV file in/db/master_data
. Then run 'bundle exec rake import:bus_routes' -
Check routes.rb for list of API paths.
This app is deployed on Heroku and the api can be used from heroku.
- Get list of all bus numbers API Path
/get_all_bus_numbers
eg: https://mcb-api.herokuapp.com/get_all_bus_numbers
- Get list of all bus stops API Path
/get_all_bus_stops
eg: https://mcb-api.herokuapp.com/get_all_bus_stops
- Get list of routes from a bus number
/get_routes_by_bus_num?bus_num=
request params : "bus_num"
eg: https://mcb-api.herokuapp.com/get_routes_by_bus_num?bus_num=119%20Up
- Get list of bus numbers by "source" and "destination"
/get_bus_numbers_by_source_and_destination?source=&destination=
request params : "source" , "destination"
- Get list of buses going on a perticular "bus stop"
/list_of_bus_on_bus_stop?bus_stop=
request params : "bus_stop"
eg: http://mcb-api.herokuapp.com/list_of_bus_on_bus_stop?bus_stop=Dasappa%20Circle