WARNING: THIS PACKAGE IS UNMAINTAINED AND PROBABLY WON'T FUNCTION CORRECTLY ANYMORE.
JavaScript client for the OUIBUS (formerly known as idBUS) API. Inofficial, using endpoints by OUIBUS. Ask them for permission before using this module in production.
npm install ouibus
const ouibus = require('ouibus')
The ouibus
module bundles two methods: stations()
and journeys()
.
Ouibus network. Returns a Promise
that resolves in a list of all stations:
ouibus.stations().then(…)
would give you
[
{
"address": "1 Avenue Louis le Débonnaire 57000 Metz",
"destinations": [
"415",
"416"
// …
],
"id": "47",
"location": {
"latitude": 49.110633,
"longitude": 6.183319,
"timezone": "Europe/Paris",
"type": "location"
},
"name": "Metz",
"timezone": "Europe/Paris",
"type": "station"
}
// …
]
Find journeys for a given date (always returns results for the entire day). Returns a Promise
that resolves in a list of matching journeys.
ouibus.journeys(originID, destinationID, date, opt).then(…)
ouibus.journeys(
90, // Paris
13, // Montpellier
new Date(),
// default options
{
transfers: 1, // max. transfers
currency: 'EUR', // TODO: supported currencies
passengers: [{
id: 1, // TODO
age: 30
}]
}
).then(…)
would give you
[
{
"available": true,
"id": "30702067",
"legs": [
{
"arrival": "2018-11-10T09:40:00+01:00",
"departure": "2018-11-09T19:10:00+01:00",
"destination": "5",
"line": {
"id": "5751",
"mode": "bus",
"name": "5751",
"public": true,
"type": "line"
},
"mode": "bus",
"operator": "ouibus",
"origin": "1",
"public": true
},
{
"arrival": "2018-11-10T16:35:00+01:00",
"departure": "2018-11-10T11:10:00+01:00",
"destination": "13",
"line": {
"id": "5868",
"mode": "bus",
"name": "5868",
"public": true,
"type": "line"
},
"mode": "bus",
"operator": "ouibus",
"origin": "5",
"public": true
}
],
"price": {
"amount": 62,
"currency": "EUR",
"fares": [
{
"model": "normal",
"price": {
"amount": 62,
"currency": "EUR"
}
}
]
},
"type": "journey"
}
// …
]
If you found a bug, want to propose a feature or feel the urge to complain about your life, feel free to visit the issues page.