This package scrapes data from Czech public transport provided on page idos.idnes.cz.
You can search connections, page more connections (uses web contex from search connections and ajax queries) or search stations by name or location. For more info, go take a look at sources in idos_scraper.scrapers:
- search_connections.py - Search connections
- Searches only from ../vlakyautobusymhdvse/..
- page_connections.py - Page connections
- search_station.py - Finding stations
- For now the station scraper scrapes from ../ostrava/.. url - Only stations in Ostrava city
More filtes (PID, ODIS, IDOL, ...) are comming later.
You will mainly use these 2 functions:
def SearchConnectionsByStation(station_from: str = "Horni polanka", station_to: str = "VŠB-TUO", time: str | None = None, date: str | None = None) -> dict:
def SearchStation(station_short_str: str, number_of_hints_to_query: str | int = 3):
And their async
variants:
async def async_SearchConnectionsByStation(station_from: str = "Horni polanka", station_to: str = "VŠB-TUO", time: str | None = None, date: str | None = None) -> dict:
async def async_SearchStation(station_short_str: str, number_of_hints_to_query: str | int = 3):
Not yet fully implemented:
def SearchConnectionsByLocation(station_from: str | None = None, station_to: str = "VŠB-TUO", time: str | None = None, date: str | None = None) -> dict:
def async_SearchConnectionsByLocation(station_from: str | None = None, station_to: str = "VŠB-TUO", time: str | None = None, date: str | None = None) -> dict:
For examples how to use this module, run:
python3 -m idos_scraper.examples.ui_search_station
or
python3 -m idos_scraper.examples.search_and_page_connection