Skip to content

A reverse engineered API for the TIB public transport service of Mallorca

License

Notifications You must be signed in to change notification settings

open-transport-mallorca/tib_api

Repository files navigation

TIB API

TIB Logo

Features

An unofficial Dart package for the TIB (Transports de les Illes Balears) API. It provides a simple way to access the TIB API and get information about the bus stops, lines, schedules, etc.

This package is not affiliated with TIB in any way.

If you find any issues, please report them in the GitHub repository issue tracker.

Getting started

Install the package by adding it to your pubspec.yaml file:

dependencies:
  tib_api: ^0.5.9

Usage

Get the list of bus stops:

await Stations.getStations();

Get the list of departures from a specific bus stop:

await Departures.getDepartures(stationId: id, numberOfDepartures: 10);

Get a list of lines that pass through a specific bus stop:

await Station.getLines(stationCode);

Get the list of all lines:

await RouteLine.getAllLines();

Get specific line information:

await RouteLine.getLine('A42');

Get the route of a specific line:

await RoutePath.getPath(route.code);

Listen to realtime updates of a specific bus:

LocationWebSocket.locationStream(busId).then((stream) {
    stream.listen((message) {
      final action = LocationWebSocket.locationParser(jsonDecode(message));
    });
  });

Get the RSS feed of the public TIB warnings:

await TibRss.getWarningFeed();

Get the RSS feed of the public TIB news:

await TibRss.getNewsFeed();

[BETA] scrape the TIB website for the affected lines of a specific warning:

await TibWarningScraper.scrapeAffectedLines(rssItem);

[BETA] scrape the TIB website for the description of a specific warning:

await TibWarningScraper.scrapeWarningDescription(rssItem);

[BETA] scrape the TIB website for the timetable PDF of a specific line:

await RouteLine.getPdfTimetable('A42');

Full example can be found in the example.dart

Facing Issues?

TIB's website is pretty unstable, and changes can occur. I'm trying my best to make this API as bug-free as possible, which can't be said about their website.

About

A reverse engineered API for the TIB public transport service of Mallorca

Topics

Resources

License

Stars

Watchers

Forks

Languages