pull more profile base data from transport-apis

This commit is contained in:
Jannis R 2021-04-18 19:02:54 +02:00
parent 4557e336b2
commit 251e7925c9
69 changed files with 608 additions and 497 deletions

13
p/avv/base.json Normal file
View file

@ -0,0 +1,13 @@
{
"auth": {
"type": "AID",
"aid": "4vV1AcH3N511icH"
},
"client": {
"type": "WEB",
"id": "AVV_AACHEN",
"name": "webapp"
},
"endpoint": "https://auskunft.avv.de/bin/mgate.exe",
"defaultLanguage": "de"
}

View file

@ -1,5 +1,7 @@
'use strict'
const baseProfile = require('./base.json')
const products = [{
id: 'regional-train',
mode: 'train',
@ -80,20 +82,9 @@ const products = [{
}]
const avvProfile = {
...baseProfile,
locale: 'de-DE',
timezone: 'Europe/Berlin',
endpoint: 'https://auskunft.avv.de/bin/mgate.exe',
auth: {
type: 'AID',
aid: '4vV1AcH3N511icH',
},
client: {
id: 'AVV_AACHEN',
type: 'WEB',
name: 'webapp',
l: 'vs_avv',
},
ver: '1.18',
products,

13
p/bart/base.json Normal file
View file

@ -0,0 +1,13 @@
{
"auth": {
"type": "AID",
"aid": "kEwHkFUCIL500dym"
},
"client": {
"type": "WEB",
"id": "BART",
"name": "webapp"
},
"endpoint": "https://planner.bart.gov/bin/mgate.exe",
"defaultLanguage": "en"
}

View file

@ -1,5 +1,7 @@
'use strict'
const baseProfile = require('./base.json')
const products = [{
id: 'bart',
mode: 'train',
@ -45,20 +47,9 @@ const products = [{
}]
const bartProfile = {
...baseProfile,
locale: 'en-US',
timezone: 'America/Los_Angeles',
endpoint: 'https://planner.bart.gov/bin/mgate.exe',
auth: {
type: 'AID',
aid: 'kEwHkFUCIL500dym',
},
client: {
id: 'BART',
type: 'WEB',
name: 'webapp',
l: 'vs_webapp',
},
ver: '1.25',
products,

16
p/bvg/base.json Normal file
View file

@ -0,0 +1,16 @@
{
"auth": {
"type": "AID",
"aid": "Mz0YdF9Fgx0Mb9"
},
"client": {
"type": "IPA",
"id": "BVG",
"v": "6020000",
"name": "FahrInfo"
},
"endpoint": "https://bvg-apps.hafas.de/bin/mgate.exe",
"ext": "BVG.1",
"ver": "1.44",
"defaultLanguage": "de"
}

View file

@ -12,17 +12,9 @@ const _parseDeparture = require('../../parse/departure')
const _parseJourneyLeg = require('../../parse/journey-leg')
const _formatStation = require('../../format/station')
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {type: 'IPA', id: 'BVG', name: 'FahrInfo', v: '6020000'}
body.ext = 'BVG.1'
body.ver = '1.21'
body.auth = {type: 'AID', aid: 'Mz0YdF9Fgx0Mb9'}
return body
}
// todo: https://m.tagesspiegel.de/berlin/fahrerlebnis-wie-im-regionalexpress-so-faehrt-es-sich-in-der-neuen-express-s-bahn/25338674.html
const parseLineWithMoreDetails = ({parsed}, p) => {
parsed.name = p.name.replace(/^(bus|tram)\s+/i, '')
@ -120,11 +112,10 @@ const requestJourneysWithBerlkoenig = ({opt}, query) => {
// todo: adapt/extend `vbb-parse-ticket` to support the BVG markup
const bvgProfile = {
...baseProfile,
locale: 'de-DE',
timezone: 'Europe/Berlin',
endpoint: 'https://bvg-apps.hafas.de/bin/mgate.exe',
transformReqBody,
transformJourneysQuery: requestJourneysWithBerlkoenig,
products,

15
p/cfl/base.json Normal file
View file

@ -0,0 +1,15 @@
{
"auth": {
"type": "AID",
"aid": "ALT2vl7LAFDFu2dz"
},
"client": {
"type": "IPH",
"id": "HAFAS",
"v": "4000000",
"name": "cflPROD-STORE"
},
"endpoint": "https://horaires.cfl.lu/bin/mgate.exe",
"ver": "1.16",
"defaultLanguage": "fr"
}

View file

@ -1,26 +1,17 @@
'use strict'
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {
type: 'IPH',
id: 'HAFAS',
v: '4000000',
name: 'cflPROD-STORE',
os: 'iPhone OS 9.3.5'
}
body.ver = '1.16'
body.auth = {aid: 'ALT2vl7LAFDFu2dz'}
body.lang = 'de'
return body
}
const cflProfile = {
...baseProfile,
locale: 'de-LU',
timezone: 'Europe/Luxembourg',
endpoint: 'https://horaires.cfl.lu/bin/mgate.exe',
transformReqBody,
products: products,

15
p/cmta/base.json Normal file
View file

@ -0,0 +1,15 @@
{
"auth": {
"type": "AID",
"aid": "ioslaskdcndrjcmlsd"
},
"client": {
"type": "IPH",
"id": "CMTA",
"v": "2",
"name": "CapMetro"
},
"endpoint": "https://capmetro.hafas.cloud/bin/mgate.exe",
"ver": "1.13",
"defaultLanguage": "en"
}

View file

@ -1,25 +1,12 @@
'use strict'
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {
type: 'IPH',
id: 'CMTA',
v: '2',
name: 'CapMetro'
}
body.ver = '1.13'
body.auth = {type: 'AID', aid: 'ioslaskdcndrjcmlsd'}
return body
}
const cmtaProfile = {
...baseProfile,
locale: 'en-US',
timezone: 'America/Chicago',
endpoint: 'https://capmetro.hafas.cloud/bin/mgate.exe',
transformReqBody,
products,

View file

@ -0,0 +1,16 @@
{
"auth": {
"type": "AID",
"aid": "OGBAqytjHhCvr0J4"
},
"client": {
"type": "AND",
"id": "DB-REGIO",
"v": 100021,
"name": "DB Busradar NRW"
},
"endpoint": "https://db-regio.hafas.de/bin/hci/mgate.exe",
"ext": "DB.REGIO.1",
"ver": "1.10",
"defaultLanguage": "de"
}

View file

@ -1,5 +1,7 @@
'use strict'
const baseProfile = require('./base.json')
// DB Busradar NRW app does not allow selecting specific modes of transport to filter results,
// so the bitmasks had to be determined by querying some stations and looking at the results..
const products = [
@ -73,25 +75,10 @@ const products = [
}
]
const transformReqBody = (_, body) => {
body.client = {
id: 'DB-REGIO',
name: 'DB Busradar NRW',
os: 'Android 9',
type: 'AND',
v: 100021
}
body.ext = 'DB.REGIO.1'
body.ver = '1.10'
body.auth = {type: 'AID', aid: 'OGBAqytjHhCvr0J4'}
return body
}
const dbBusradarNrwProfile = {
...baseProfile,
locale: 'de-DE',
timezone: 'Europe/Berlin',
endpoint: 'https://db-regio.hafas.de/bin/hci/mgate.exe',
transformReqBody,
products: products,

View file

@ -5,12 +5,13 @@
},
"salt": "6264493855566A34304B356676787766",
"client": {
"type": "AND",
"id": "DB",
"v": "16040000",
"type": "IPH",
"v": 19040000,
"name": "DB Navigator"
},
"endpoint": "https://reiseauskunft.bahn.de/bin/mgate.exe",
"ext": "DB.R19.04.a",
"ver": "1.15"
"ext": "DB.R19.12.a",
"ver": "1.18",
"defaultLanguage": "en"
}

17
p/hvv/base.json Normal file
View file

@ -0,0 +1,17 @@
{
"auth": {
"type": "AID",
"aid": "andcXUmC9Mq6hjrwDIGd2l3oiaMrTUzyH"
},
"salt": "pqjM3iKEGOAhYbX76k9R5zutv",
"client": {
"type": "AND",
"id": "HVV",
"v": "4020100",
"name": "HVVPROD_ADHOC"
},
"endpoint": "https://hvv-app.hafas.de/bin/mgate.exe",
"ext": "HVV.1",
"ver": "1.16",
"defaultLanguage": "de"
}

View file

@ -1,27 +1,16 @@
'use strict'
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {type: 'AND', id: 'HVV', name: 'HVVPROD_ADHOC', v: '4020100'}
body.ext = 'HVV.1'
body.ver = '1.16'
body.auth = {type: 'AID', aid: 'andcXUmC9Mq6hjrwDIGd2l3oiaMrTUzyH'}
return body
}
const hvvProfile = {
...baseProfile,
locale: 'de-DE',
timezone: 'Europe/Berlin',
endpoint: 'https://hvv-app.hafas.de/bin/mgate.exe',
// https://runkit.com/derhuerst/hafas-decrypt-encrypted-mac-salt
salt: Buffer.from('pqjM3iKEGOAhYbX76k9R5zutv', 'utf-8'),
// baseProfile.salt is interpreted as hex by hafas-client
salt: Buffer.from('pqjM3iKEGOAhYbX76k9R5zutv', 'utf8'),
addMicMac: true,
transformReqBody,
products,
trip: true,

15
p/insa/base.json Normal file
View file

@ -0,0 +1,15 @@
{
"auth": {
"type": "AID",
"aid": "nasa-apps"
},
"client": {
"type": "IPH",
"id": "NASA",
"v": "4000200",
"name": "nasaPROD"
},
"endpoint": "https://reiseauskunft.insa.de/bin/mgate.exe",
"ver": "1.18",
"defaultLanguage": "de"
}

View file

@ -1,27 +1,12 @@
'use strict'
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {
type: 'IPH',
id: 'NASA',
v: '4000200',
name: 'nasaPROD',
os: 'iPhone OS 11.2.5'
}
body.ver = '1.18'
body.auth = {type: 'AID', aid: "nasa-apps"}
body.lang = 'en' // todo: `de`?
return body
}
const insaProfile = {
...baseProfile,
locale: 'de-DE',
timezone: 'Europe/Berlin',
endpoint: 'https://reiseauskunft.insa.de/bin/mgate.exe',
transformReqBody,
products: products,

15
p/invg/base.json Normal file
View file

@ -0,0 +1,15 @@
{
"auth": {
"type": "AID",
"aid": "GITvwi3BGOmTQ2a5"
},
"client": {
"type": "IPH",
"id": "INVG",
"v": "1040000",
"name": "invgPROD-APPSTORE-LIVE"
},
"endpoint": "https://fpa.invg.de/bin/mgate.exe",
"ver": "1.16",
"defaultLanguage": "de"
}

View file

@ -1,32 +1,12 @@
'use strict'
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {
type: 'IPH',
id: 'INVG',
name: 'invgPROD-APPSTORE-LIVE',
v: '1040000'
}
body.ver = '1.16'
body.auth = {type: 'AID', aid: 'GITvwi3BGOmTQ2a5'}
return body
}
const invgProfile = {
...baseProfile,
locale: 'de-DE',
timezone: 'Europe/Berlin',
endpoint: 'https://fpa.invg.de/bin/mgate.exe',
// https://github.com/public-transport/hafas-client/issues/93#issuecomment-437594291
// https://runkit.com/derhuerst/hafas-decrypt-encrypted-mac-salt
// https://gist.github.com/derhuerst/840c72ad19065f6c55657cf1bc7aa52a#file-config-txt-L23-L24
salt: Buffer.from('ERxotxpwFT7uYRsI', 'utf8'),
addMicMac: true,
transformReqBody,
products,

15
p/irish-rail/base.json Normal file
View file

@ -0,0 +1,15 @@
{
"auth": {
"type": "AID",
"aid": "P9bplgVCGnozdgQE"
},
"client": {
"type": "IPA",
"id": "IRISHRAIL",
"v": "4000100",
"name": "IrishRailPROD-APPSTORE"
},
"endpoint": "https://journeyplanner.irishrail.ie/bin/mgate.exe",
"ver": "1.18",
"defaultLanguage": "en"
}

View file

@ -1,29 +1,18 @@
'use strict'
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {
type: 'IPA',
id: 'IRISHRAIL',
v: '4000100',
name: 'IrishRailPROD-APPSTORE',
os: 'iOS 12.4.8',
}
body.ver = '1.18'
body.auth = {type: 'AID', aid: 'P9bplgVCGnozdgQE'}
body.lang = 'ga'
return body
}
const irishRailProfile = {
...baseProfile,
locale: 'en-IE',
timezone: 'Europe/Dublin',
endpoint: 'https://journeyplanner.irishrail.ie/bin/mgate.exe',
transformReqBody,
salt: Buffer.from('i5s7m3q9z6b4k1c2', 'utf8'),
addMicMac: true,

15
p/mobil-nrw/base.json Normal file
View file

@ -0,0 +1,15 @@
{
"auth": {
"type": "AID",
"aid": "Kdf0LNRWYg5k3499"
},
"client": {
"type": "IPH",
"id": "DB-REGIO-NRW",
"v": "6000300",
"name": "NRW"
},
"endpoint": "https://nrw.hafas.de/bin/mgate.exe",
"ver": "1.24",
"defaultLanguage": "de"
}

View file

@ -1,31 +1,12 @@
'use strict'
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {
id: 'DB-REGIO-NRW',
name: 'NRW',
os: 'iOS 12.4.9',
type: 'IPH',
v: '6000300',
}
body.ver = '1.24'
body.auth = {
type: 'AID',
aid: 'Kdf0LNRWYg5k3499'
}
body.lang = 'de'
// body.ext = 'DB.R19.04.a'
return body
}
const cflProfile = {
...baseProfile,
locale: 'de-DE',
timezone: 'Europe/Berlin',
endpoint: 'https://nrw.hafas.de/bin/mgate.exe',
transformReqBody,
products,

14
p/mobiliteit-lu/base.json Normal file
View file

@ -0,0 +1,14 @@
{
"auth": {
"type": "AID",
"aid": "SkC81GuwuzL4e0"
},
"client": {
"type": "WEB",
"id": "MMILUX",
"name": "webapp"
},
"endpoint": "https://cdt.hafas.de/bin/mgate.exe",
"ver": "1.25",
"defaultLanguage": "de"
}

View file

@ -1,26 +1,12 @@
'use strict'
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {
type: 'WEB',
id: 'MMILUX',
name: 'webapp',
l: 'vs_webapp',
}
body.ver = '1.25'
body.auth = {type: 'AID', aid: 'SkC81GuwuzL4e0'}
body.lang = 'de'
return body
}
const mobiliteitLuProfile = {
...baseProfile,
locale: 'de-LU',
timezone: 'Europe/Luxembourg',
endpoint: 'https://cdt.hafas.de/bin/mgate.exe',
transformReqBody,
products: products,

14
p/nahsh/base.json Normal file
View file

@ -0,0 +1,14 @@
{
"auth": {
"type": "AID",
"aid": "r0Ot9FLFNAFxijLW"
},
"client": {
"id": "NAHSH",
"v": "3000700",
"name": "NAHSHPROD"
},
"endpoint": "https://nah.sh.hafas.de/bin/mgate.exe",
"ver": "1.16",
"defaultLanguage": "de"
}

View file

@ -5,23 +5,11 @@ const {parseHook} = require('../../lib/profile-hooks')
const _parseLocation = require('../../parse/location')
const _parseJourney = require('../../parse/journey')
const _parseMovement = require('../../parse/movement')
const baseProfile = require('./base.json')
const products = require('./products')
// todo: journey prices
const transformReqBody = (ctx, body) => {
body.client = {
id: 'NAHSH',
name: 'NAHSHPROD',
v: '3000700'
}
body.ver = '1.16'
body.auth = {aid: 'r0Ot9FLFNAFxijLW'}
body.lang = 'de'
return body
}
const fixLocation = ({parsed}, l) => {
// weird fix for empty lines, e.g. IC/EC at Flensburg Hbf
if (parsed.lines) {
@ -79,10 +67,9 @@ const fixMovement = ({parsed}, m) => {
}
const nahshProfile = {
...baseProfile,
locale: 'de-DE',
timezone: 'Europe/Berlin',
endpoint: 'https://nah.sh.hafas.de/bin/mgate.exe',
transformReqBody,
products,

16
p/nvv/base.json Normal file
View file

@ -0,0 +1,16 @@
{
"auth": {
"type": "AID",
"aid": "Kt8eNOH7qjVeSxNA"
},
"client": {
"type": "IPH",
"id": "NVV",
"v": "5000300",
"name": "NVVMobilPROD_APPSTORE"
},
"endpoint": "https://auskunft.nvv.de/auskunft/bin/app/mgate.exe",
"ext": "NVV.6.0",
"ver": "1.18",
"defaultLanguage": "de"
}

View file

@ -1,31 +1,12 @@
'use strict'
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {
type: 'IPH',
id: 'NVV',
v: '5000300',
os: 'iOS 12.1.4',
name: 'NVVMobilPROD_APPSTORE'
}
body.ver = '1.18'
body.ext = 'NVV.6.0'
body.auth = {type: 'AID', aid: 'Kt8eNOH7qjVeSxNA'}
body.lang = 'de'
return body
}
const saarfahrplanProfile = {
...baseProfile,
locale: 'de-DE',
timezone: 'Europe/Berlin',
endpoint: 'https://auskunft.nvv.de/auskunft/bin/app/mgate.exe',
transformReqBody,
// Although the app uses `mic` & `mac`, they don't seem to be necessary.
// addMicMac: true
products: products,

15
p/oebb/base.json Normal file
View file

@ -0,0 +1,15 @@
{
"auth": {
"type": "AID",
"aid": "OWDL4fE4ixNiPBBm"
},
"client": {
"type": "IPA",
"id": "OEBB",
"v": "6000500",
"name": "oebbIPAD_ADHOC"
},
"endpoint": "http://fahrplan.oebb.at/bin/mgate.exe",
"ver": "1.16",
"defaultLanguage": "de"
}

View file

@ -7,26 +7,9 @@ const {parseHook} = require('../../lib/profile-hooks')
const _parseLocation = require('../../parse/location')
const _parseMovement = require('../../parse/movement')
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {
type: 'IPH',
id: 'OEBB',
v: '6030600',
name: 'oebbPROD-ADHOC',
os: 'iOS 14.3',
}
body.ver = '1.33'
body.auth = {
type: 'AID',
aid: 'OWDL4fE4ixNiPBBm',
}
body.lang = 'de'
return body
}
// ÖBB has some 'stations' **in austria** with no departures/products,
// like station entrances, that are actually POIs.
const fixWeirdPOIs = ({parsed}) => {
@ -61,11 +44,10 @@ const fixMovement = ({parsed}, m) => {
}
const oebbProfile = {
...baseProfile,
locale: 'de-AT',
timezone: 'Europe/Vienna',
// todo: there is also https://beta.verkehrsauskunft.at/bin/mgate.exe
endpoint: 'https://fahrplan.oebb.at/bin/mgate.exe',
transformReqBody,
defaultLanguage: 'de',
products: products,

13
p/pkp/base.json Normal file
View file

@ -0,0 +1,13 @@
{
"auth": {
"type": "AID",
"aid": "DrxJYtYZQpEBCtcb"
},
"client": {
"type": "AND",
"id": "HAFAS"
},
"endpoint": "https://mobil.rozklad-pkp.pl:8019/bin/mgate.exe",
"ver": "1.21",
"defaultLanguage": "en"
}

View file

@ -3,16 +3,9 @@
const {parseHook} = require('../../lib/profile-hooks')
const parseLocation = require('../../parse/location')
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {type: 'AND', id: 'HAFAS', name: 'Rozklad-PKP', v: '1000110'}
body.ver = '1.18' // 1.24 is used by the app, but that version doesn't support getPassList for departures/arrivals
body.auth = {type: 'AID', aid: 'DrxJYtYZQpEBCtcb'}
return body
}
const trimStopName = ({parsed}, l) => {
if (parsed.type === 'stop' || parsed.type === 'station' && parsed.name) {
parsed.name = parsed.name.replace(/(^-|-$)/g, '')
@ -21,11 +14,9 @@ const trimStopName = ({parsed}, l) => {
}
const pkpProfile = {
...baseProfile,
locale: 'pl-PL',
timezone: 'Europe/Warsaw',
endpoint: 'https://mobil.rozklad-pkp.pl:8019/bin/mgate.exe',
transformReqBody,
products,

14
p/rejseplanen/base.json Normal file
View file

@ -0,0 +1,14 @@
{
"auth": {
"type": "AID",
"aid": "irkmpm9mdznstenr-android"
},
"client": {
"type": "AND",
"id": "DK"
},
"endpoint": "https://mobilapps.rejseplanen.dk/bin/iphone.exe",
"ext": "DK.9",
"ver": "1.21",
"defaultLanguage": "dk"
}

View file

@ -1,21 +1,12 @@
'use strict'
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.ext = 'DK.9'
body.client = {type: 'AND', id: 'DK'}
body.ver = '1.21'
body.auth = {type: 'AID', aid: 'irkmpm9mdznstenr-android'}
return body
}
const rejseplanenProfile = {
...baseProfile,
locale: 'da-DK',
timezone: 'Europe/Copenhagen',
endpoint: 'https://mobilapps.rejseplanen.dk/bin/iphone.exe',
transformReqBody,
products: products,

15
p/rmv/base.json Normal file
View file

@ -0,0 +1,15 @@
{
"auth": {
"type": "AID",
"aid": "x0k4ZR33ICN9CWmj"
},
"client": {
"type": "WEB",
"id": "RMV",
"name": "webapp"
},
"endpoint": "https://www.rmv.de/auskunft/bin/jp/mgate.exe",
"ext": "RMV.1",
"ver": "1.18",
"defaultLanguage": "de"
}

View file

@ -1,22 +1,12 @@
'use strict'
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {type: 'WEB', id: 'RMV', name: 'webapp'}
body.ext = 'RMV.1'
body.ver = '1.18'
body.auth = {type: 'AID', aid: 'x0k4ZR33ICN9CWmj'}
return body
}
const hvvProfile = {
...baseProfile,
locale: 'de-DE',
timezone: 'Europe/Berlin',
endpoint: 'https://www.rmv.de/auskunft/bin/jp/mgate.exe',
transformReqBody,
products,

15
p/rsag/base.json Normal file
View file

@ -0,0 +1,15 @@
{
"auth": {
"type": "AID",
"aid": "tF5JTs25rzUhGrrl"
},
"client": {
"type": "WEB",
"id": "RSAG",
"name": "webapp"
},
"endpoint": "https://fahrplan.rsag-online.de/bin/mgate.exe",
"ext": "VBN.2",
"ver": "1.24",
"defaultLanguage": "de"
}

View file

@ -1,22 +1,12 @@
'use strict'
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {type: 'WEB', id: 'RSAG', name: 'webapp'}
body.ext = 'VBN.2'
body.ver = '1.24'
body.auth = {type: 'AID', aid: 'tF5JTs25rzUhGrrl'}
return body
}
const rsagProfile = {
...baseProfile,
locale: 'de-DE',
timezone: 'Europe/Berlin',
endpoint: 'https://fahrplan.rsag-online.de/bin/mgate.exe',
transformReqBody,
products,

15
p/saarfahrplan/base.json Normal file
View file

@ -0,0 +1,15 @@
{
"auth": {
"type": "AID",
"aid": "51XfsVqgbdA6oXzHrx75jhlocRg6Xe"
},
"client": {
"type": "AND",
"id": "ZPS-SAAR",
"v": 1000070,
"name": "Saarfahrplan"
},
"endpoint": "https://saarfahrplan.de/bin/mgate.exe",
"ver": "1.21",
"defaultLanguage": "de"
}

View file

@ -3,23 +3,9 @@
const {parseHook} = require('../../lib/profile-hooks')
const _parseMovement = require('../../parse/movement')
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {
type: 'AND',
id: 'ZPS-SAAR',
v: 1000070,
name: 'Saarfahrplan',
os: 'Android 9'
}
body.ver = '1.21'
body.auth = {type: 'AID', aid: '51XfsVqgbdA6oXzHrx75jhlocRg6Xe'}
body.lang = 'de'
return body
}
const fixMovement = ({parsed}, m) => {
// filter out empty stopovers
parsed.nextStopovers = parsed.nextStopovers.filter(st => !!st.stop)
@ -27,12 +13,9 @@ const fixMovement = ({parsed}, m) => {
}
const saarfahrplanProfile = {
...baseProfile,
locale: 'de-DE',
timezone: 'Europe/Berlin',
endpoint: 'https://saarfahrplan.de/bin/mgate.exe',
transformReqBody,
// decrypted form of https://gist.github.com/derhuerst/f5a8c07f9b3226ecad6c8f64d83df6a2#file-haf_config_base-properties-L70
salt: Buffer.from('HJtlubisvxiJxss', 'utf8'),
addMicMac: true,

View file

@ -0,0 +1,17 @@
{
"auth": {
"type": "AID",
"aid": "d491MVVhz9ZZts23"
},
"salt": "ggnvMVV8RTt67gh1",
"client": {
"type": "IPH",
"id": "DB-REGIO-MVV",
"v": "5010100",
"name": "MuenchenNavigator"
},
"endpoint": "https://s-bahn-muenchen.hafas.de/bin/540/mgate.exe",
"ext": "DB.R15.12.a",
"ver": "1.21",
"defaultLanguage": "en"
}

View file

@ -1,24 +1,14 @@
'use strict'
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {type: 'IPH', id: 'DB-REGIO-MVV', name: 'MuenchenNavigator', v: '5010100'}
body.ext = 'DB.R15.12.a'
body.ver = '1.21'
body.auth = {type: 'AID', aid: 'd491MVVhz9ZZts23'}
return body
}
const sBahnMunichProfile = {
...baseProfile,
locale: 'de-DE',
timezone: 'Europe/Berlin',
endpoint: 'https://s-bahn-muenchen.hafas.de/bin/540/mgate.exe',
salt: Buffer.from('ggnvMVV8RTt67gh1', 'utf8'),
addMicMac: true,
transformReqBody,
products,

14
p/sbb/base.json Normal file
View file

@ -0,0 +1,14 @@
{
"auth": {
"type": "AID",
"aid": "hf7mcf9bv3nv8g5f"
},
"client": {
"type": "AND",
"id": "DBZUGRADARNETZ",
"v": ""
},
"endpoint": "http://fahrplan.sbb.ch/bin/mgate.exe",
"ver": "1.18",
"defaultLanguage": "de"
}

View file

@ -1,27 +1,12 @@
'use strict'
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
// sourced from https://github.com/marudor/BahnhofsAbfahrten/blob/1c99d8b/packages/server/HAFAS/profiles.ts#L344-L361
body.client = {
type: 'AND',
id: 'DBZUGRADARNETZ',
v: '',
}
body.ver = '1.18'
body.auth = { aid: 'hf7mcf9bv3nv8g5f', type:'AID' }
body.lang = 'deu'
return body
}
const sbbProfile = {
...baseProfile,
locale: 'de-CH',
timezone: 'Europe/Zurich',
// todo: find a way to use https:
endpoint: 'http://fahrplan.sbb.ch/bin/mgate.exe',
transformReqBody,
products: products,

15
p/sncb/base.json Normal file
View file

@ -0,0 +1,15 @@
{
"auth": {
"type": "AID",
"aid": "sncb-mobi"
},
"client": {
"type": "IPH",
"id": "SNCB",
"v": "4030200",
"name": "sncb"
},
"endpoint": "https://www.belgianrail.be/jp/sncb-nmbs-routeplanner/mgate.exe",
"ver": "1.16",
"defaultLanguage": "fr"
}

View file

@ -6,6 +6,7 @@ const {Agent} = require('https')
const {strictEqual: eql} = require('assert')
const {parseHook} = require('../../lib/profile-hooks')
const parseLine = require('../../parse/line')
const baseProfile = require('./base.json')
const products = require('./products')
// `www.belgianrail.be:443` doesn't provide the necessary CA certificate
@ -15,15 +16,6 @@ const ca = readFileSync(join(__dirname, 'digicert-sha2-secure-server-ca.crt.pem'
const agent = new Agent({ca})
const transformReq = (ctx, req) => ({...req, agent})
const transformReqBody = ({opt}, body) => {
body.client = {type: 'IPH', id: 'SNCB', name: 'sncb', v: '4030200'}
body.ver = '1.16'
body.auth = {type: 'AID', aid: 'sncb-mobi'}
body.lang = opt.language || 'fr'
return body
}
// todo: this is ugly
const lineNameWithoutFahrtNr = ({parsed}) => {
const {name, fahrtNr} = parsed
@ -54,12 +46,11 @@ eql(lineNameWithoutFahrtNr({
}).name, 'S1 123a')
const sncbProfile = {
...baseProfile,
locale: 'fr-BE',
timezone: 'Europe/Brussels',
endpoint: 'https://www.belgianrail.be/jp/sncb-nmbs-routeplanner/mgate.exe',
transformReq,
transformReqBody,
products,

15
p/svv/base.json Normal file
View file

@ -0,0 +1,15 @@
{
"auth": {
"type": "AID",
"aid": "wf7mcf9bv3nv8g5f"
},
"client": {
"type": "WEB",
"id": "VAO",
"name": "webapp"
},
"endpoint": "https://fahrplan.salzburg-verkehr.at/bin/mgate.exe",
"ext": "VAO.11",
"ver": "1.20",
"defaultLanguage": "de"
}

View file

@ -1,21 +1,12 @@
'use strict'
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {type: 'WEB', id: 'VAO', name: 'webapp'}
body.ext = 'VAO.11'
body.ver = '1.20'
body.auth = {type: 'AID', aid: 'wf7mcf9bv3nv8g5f'}
return body
}
const svvProfile = {
...baseProfile,
locale: 'at-DE',
timezone: 'Europe/Vienna',
endpoint: 'https://fahrplan.salzburg-verkehr.at/bin/mgate.exe',
transformReqBody,
products,

16
p/vbb/base.json Normal file
View file

@ -0,0 +1,16 @@
{
"auth": {
"type": "AID",
"aid": "hafas-vbb-apps"
},
"client": {
"type": "IPA",
"id": "VBB",
"v": "4010300",
"name": "vbbPROD"
},
"endpoint": "https://fahrinfo.vbb.de/bin/mgate.exe",
"ext": "VBB.1",
"ver": "1.16",
"defaultLanguage": "de"
}

View file

@ -13,17 +13,9 @@ const _parseJourney = require('../../parse/journey')
const _parseDeparture = require('../../parse/departure')
const _formatStation = require('../../format/station')
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {type: 'IPA', id: 'VBB', name: 'vbbPROD', v: '4010300'}
body.ext = 'VBB.1'
body.ver = '1.16'
body.auth = {type: 'AID', aid: 'hafas-vbb-apps'}
return body
}
// todo: https://m.tagesspiegel.de/berlin/fahrerlebnis-wie-im-regionalexpress-so-faehrt-es-sich-in-der-neuen-express-s-bahn/25338674.html
const parseLineWithMoreDetails = ({parsed}, p) => {
parsed.name = p.name.replace(/^(bus|tram)\s+/i, '')
@ -98,17 +90,14 @@ const formatStation = (id) => {
}
const vbbProfile = {
...baseProfile,
locale: 'de-DE',
timezone: 'Europe/Berlin',
endpoint: 'https://fahrinfo.vbb.de/bin/mgate.exe',
// https://gist.github.com/derhuerst/a8d94a433358abc015ff77df4481070c#file-haf_config_base-properties-L39
// https://runkit.com/derhuerst/hafas-decrypt-encrypted-mac-salt
salt: Buffer.from('5243544a4d3266467846667878516649', 'hex'),
salt: Buffer.from('RCTJM2fFxFfxxQfI', 'utf8'),
addMicMac: true,
transformReqBody,
products: products,
parseLine: parseHook(_parseLine, parseLineWithMoreDetails),

15
p/vbn/base.json Normal file
View file

@ -0,0 +1,15 @@
{
"auth": {
"type": "AID",
"aid": "kaoxIXLn03zCr2KR"
},
"client": {
"type": "IPH",
"id": "VBN",
"v": "6000000",
"name": "vbn"
},
"endpoint": "https://fahrplaner.vbn.de/bin/mgate.exe",
"ver": "1.27",
"defaultLanguage": "de"
}

View file

@ -1,27 +1,17 @@
'use strict'
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {type: 'IPH', id: 'VBN', name: 'vbn', v: '6000000'}
body.ver = '1.27'
body.auth = {type: 'AID', aid: 'kaoxIXLn03zCr2KR'}
return body
}
const insaProfile = {
...baseProfile,
locale: 'de-DE',
timezone: 'Europe/Berlin',
endpoint: 'https://fahrplaner.vbn.de/bin/mgate.exe',
// https://runkit.com/derhuerst/hafas-decrypt-encrypted-mac-salt
// https://gist.github.com/derhuerst/fd2f81a597bde66cb1f689006d574d7f#file-config-txt-L22-L23
salt: Buffer.from('SP31mBufSyCLmNxp', 'utf-8'),
addMicMac: true,
transformReqBody,
products: products,
trip: true,

13
p/vkg/base.json Normal file
View file

@ -0,0 +1,13 @@
{
"auth": {
"type": "AID",
"aid": "wf7mcf9bv3nv8g5f"
},
"client": {
"type": "WEB",
"id": "VAO",
"name": "webapp"
},
"endpoint": "https://routenplaner.kaerntner-linien.at/bin/mgate.exe",
"defaultLanguage": "de"
}

View file

@ -1,5 +1,7 @@
'use strict'
const baseProfile = require('./base.json')
const products = [{ // todo: what is `8`?
id: 'trains',
mode: 'train',
@ -73,22 +75,10 @@ const products = [{ // todo: what is `8`?
}]
const vosProfile = {
...baseProfile,
locale: 'at-DE',
timezone: 'Europe/Vienna',
endpoint: 'https://routenplaner.kaerntner-linien.at/bin/mgate.exe',
auth: {
type: 'AID',
aid: 'wf7mcf9bv3nv8g5f',
},
client: {
id: 'VAO',
type: 'WEB',
name: 'webapp',
l: 'vs_vkg',
},
ver: '1.32',
// todo: lang
products,

15
p/vmt/base.json Normal file
View file

@ -0,0 +1,15 @@
{
"auth": {
"type": "AID",
"aid": "t2h7u1e6r4i8n3g7e0n"
},
"client": {
"type": "IPH",
"id": "HAFAS",
"v": "2040100",
"name": "VMT"
},
"endpoint": "https://vmt.hafas.de/bin/ticketing/mgate.exe",
"ver": "1.18",
"defaultLanguage": "de"
}

View file

@ -1,28 +1,17 @@
'use strict'
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {type: 'IPH', id: 'HAFAS', name: 'VMT', v: '2040100'}
body.ver = '1.18'
body.auth = {type: 'AID', aid: 't2h7u1e6r4i8n3g7e0n'}
return body
}
const hvvProfile = {
...baseProfile,
locale: 'de-DE',
timezone: 'Europe/Berlin',
// todo: what about `https://vmt.hafas.de/bin/mgate.exe`?
endpoint: 'https://vmt.hafas.de/bin/ticketing/mgate.exe',
// https://runkit.com/derhuerst/hafas-decrypt-encrypted-mac-salt
// https://gist.github.com/derhuerst/b20adde9f614ceb6b2a8b9c7f4487da8#file-hafas-config-L31-L32
salt: Buffer.from('7x8d3n2a5m1b3c6z', 'utf-8'),
addMicMac: true,
transformReqBody,
products,
trip: true,

13
p/vos/base.json Normal file
View file

@ -0,0 +1,13 @@
{
"auth": {
"type": "AID",
"aid": "PnYowCQP7Tp1V"
},
"client": {
"type": "WEB",
"id": "SWO",
"name": "webapp"
},
"endpoint": "https://fahrplan.vos.info/bin/mgate.exe",
"defaultLanguage": "de"
}

View file

@ -1,5 +1,7 @@
'use strict'
const baseProfile = require('./base.json')
const products = [{
id: 'ice',
mode: 'train',
@ -73,20 +75,9 @@ const products = [{
}]
const vosProfile = {
...baseProfile,
locale: 'de-DE',
timezone: 'Europe/Berlin',
endpoint: 'https://fahrplan.vos.info/bin/mgate.exe',
auth: {
type: 'AID',
aid: 'PnYowCQP7Tp1V',
},
client: {
id: 'SWO',
type: 'WEB',
name: 'webapp',
l: 'vs_swo',
},
ver: '1.32',
products,

16
p/vrn/base.json Normal file
View file

@ -0,0 +1,16 @@
{
"auth": {
"type": "AID",
"aid": "p091VRNZz79KtUz5"
},
"client": {
"type": "IPH",
"id": "DB-REGIO-VRN",
"v": "6000400",
"name": "VRN"
},
"endpoint": "https://vrn.hafas.de/bin/mgate.exe",
"ext": "DB.R19.04.a",
"ver": "1.24",
"defaultLanguage": "de"
}

View file

@ -1,16 +1,8 @@
'use strict'
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {type: 'IPH', id: 'DB-REGIO-VRN', name: 'VRN', v: '6000400'}
body.ext = 'DB.R19.04.a'
body.ver = '1.24'
body.auth = {type: 'AID', aid: 'p091VRNZz79KtUz5'}
return body
}
const formatRefreshJourneyReq = ({opt}, refreshToken) => {
return {
meth: 'Reconstruction',
@ -23,11 +15,9 @@ const formatRefreshJourneyReq = ({opt}, refreshToken) => {
module.exports = formatRefreshJourneyReq
const hvvProfile = {
...baseProfile,
locale: 'de-DE',
timezone: 'Europe/Berlin',
endpoint: 'https://vrn.hafas.de/bin/mgate.exe',
transformReqBody,
products,

15
p/vsn/base.json Normal file
View file

@ -0,0 +1,15 @@
{
"auth": {
"type": "AID",
"aid": "Mpf5UPC0DmzV8jkg"
},
"client": {
"type": "IPA",
"id": "VSN",
"v": "5030100",
"name": "vsn"
},
"endpoint": "https://fahrplaner.vsninfo.de/hafas/mgate.exe",
"ver": "1.24",
"defaultLanguage": "de"
}

View file

@ -1,45 +1,17 @@
'use strict'
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {type: 'IPA', id: 'VSN', name: 'vsn', v: '5030100', os: 'iOS 13.3'}
body.ver = '1.24'
body.auth = {type: 'AID', aid: 'Mpf5UPC0DmzV8jkg'}
body.lang = 'de'
return body
}
const formatRefreshJourneyReq = (ctx, refreshToken) => {
// eslint-disable-next-line no-unused-vars
const {profile, opt} = ctx
return {
meth: 'Reconstruction',
req: {
outReconL: [{ctx: refreshToken}],
getIST: true, // todo: make an option
getPasslist: !!opt.stopovers,
getPolyline: !!opt.polylines,
getTariff: !!opt.tickets
}
}
}
const vsnProfile = {
...baseProfile,
locale: 'de-DE',
timezone: 'Europe/Berlin',
endpoint: 'https://fahrplaner.vsninfo.de/hafas/mgate.exe',
// https://gist.github.com/n0emis/3b6887572793f4f54da9d83b30548332#file-haf_config_base-properties-L31
// https://runkit.com/derhuerst/hafas-decrypt-encrypted-mac-salt
salt: Buffer.from('535033316d4275665379434c6d4e7870', 'hex'),
salt: Buffer.from('SP31mBufSyCLmNxp', 'utf8'),
addMicMac: true,
transformReqBody,
formatRefreshJourneyReq,
products: products,
trip: true,

13
p/vvt/base.json Normal file
View file

@ -0,0 +1,13 @@
{
"auth": {
"type": "AID",
"aid": "wf7mcf9bv3nv8g5f"
},
"client": {
"type": "WEB",
"id": "VAO",
"name": "webapp"
},
"endpoint": "https://smartride.vvt.at/bin/mgate.exe",
"defaultLanguage": "de"
}

View file

@ -1,5 +1,7 @@
'use strict'
const baseProfile = require('./base.json')
const products = [{ // todo: what is `8`?
id: 'trains',
mode: 'train',
@ -73,22 +75,10 @@ const products = [{ // todo: what is `8`?
}]
const vvtProfile = {
...baseProfile,
locale: 'at-DE',
timezone: 'Europe/Vienna',
endpoint: 'https://smartride.vvt.at/bin/mgate.exe',
auth: {
type: 'AID',
aid: 'wf7mcf9bv3nv8g5f',
},
client: {
id: 'VAO',
type: 'WEB',
name: 'webapp',
l: 'vs_vvt',
},
ver: '1.32',
// todo: lang
products,

16
p/zvv/base.json Normal file
View file

@ -0,0 +1,16 @@
{
"auth": {
"type": "AID",
"aid": "TLRUqdDPF7ttB824Yoy2BN8mk"
},
"client": {
"type": "IPH",
"id": "ZVV",
"v": "6000400",
"name": "zvvPROD-STORE"
},
"endpoint": "https://online.fahrplan.zvv.ch/bin/mgate.exe",
"ext": "ZVV.2",
"ver": "1.24",
"defaultLanguage": "de"
}

View file

@ -1,26 +1,12 @@
'use strict'
const baseProfile = require('./base.json')
const products = require('./products')
const transformReqBody = (ctx, body) => {
body.client = {type: 'IPH', id: 'ZVV', name: 'zvvPROD-STORE', v: '6000400'}
body.ext = 'ZVV.2'
body.ver = '1.24'
body.auth = {type: 'AID', aid: 'TLRUqdDPF7ttB824Yoy2BN8mk'}
return body
}
const zvvProfile = {
...baseProfile,
locale: 'de-CH',
timezone: 'Europe/Zurich',
endpoint: 'https://online.fahrplan.zvv.ch/bin/mgate.exe',
// https://runkit.com/derhuerst/hafas-decrypt-encrypted-mac-salt
salt: Buffer.from('jCcZ864meuAbqGZ', 'utf-8'),
addMicMac: true,
transformReqBody,
products,

View file

@ -20,11 +20,45 @@ query="(\
}, \
endpoint: p(_, 'options.endpoint'), \
ext: p(_, 'options.ext'), \
ver: p(_, 'options.ver'), \
ver: p(_, 'options.ver', p(_, 'options.version')), \
defaultLanguage: _.supportedLanguages && _.supportedLanguages[0] || undefined, \
}, null, '\\t')
)(
require('lodash/get'),
JSON.parse(require('fs').readFileSync(process.argv[1], {encoding: 'utf8'})),
)"
jq -r --tab "$query" <"$src/de/db-hafas-mgate.json" >../p/db/base.json
node -p "$query" "$src/de/avv-hafas-mgate.json" >../p/avv/base.json
node -p "$query" "$src/us/bart-hafas-mgate.json" >../p/bart/base.json
node -p "$query" "$src/de/bvg-hafas-mgate.json" >../p/bvg/base.json
node -p "$query" "$src/lu/cfl-hafas-mgate.json" >../p/cfl/base.json
node -p "$query" "$src/us/cmta-hafas-mgate.json" >../p/cmta/base.json
node -p "$query" "$src/de/db-hafas-mgate.json" >../p/db/base.json
node -p "$query" "$src/de/db-busradar-nrw-hafas-mgate.json" >../p/db-busradar-nrw/base.json
node -p "$query" "$src/de/hvv-hafas-mgate.json" >../p/hvv/base.json
node -p "$query" "$src/de/nasa-hafas-mgate.json" >../p/insa/base.json
node -p "$query" "$src/de/invg-hafas-mgate.json" >../p/invg/base.json
node -p "$query" "$src/ie/iarnrod-eireann-hafas-mgate.json" >../p/irish-rail/base.json
node -p "$query" "$src/de/mobil-nrw-hafas-mgate.json" >../p/mobil-nrw/base.json
node -p "$query" "$src/lu/mobiliteit-lu-hafas-mgate.json" >../p/mobiliteit-lu/base.json
node -p "$query" "$src/de/nahsh-hafas-mgate.json" >../p/nahsh/base.json
node -p "$query" "$src/de/nvv-hafas-mgate.json" >../p/nvv/base.json
node -p "$query" "$src/at/oebb-hafas-mgate.json" >../p/oebb/base.json
node -p "$query" "$src/pl/pkp-hafas-mgate.json" >../p/pkp/base.json
node -p "$query" "$src/dk/rejseplanen-hafas-mgate.json" >../p/rejseplanen/base.json
node -p "$query" "$src/de/rmv-hafas-mgate.json" >../p/rmv/base.json
node -p "$query" "$src/de/rsag-hafas-mgate.json" >../p/rsag/base.json
node -p "$query" "$src/de/saarvv-hafas-mgate.json" >../p/saarfahrplan/base.json
node -p "$query" "$src/de/db-sbahn-muenchen-hafas-mgate.json" >../p/sbahn-muenchen/base.json
node -p "$query" "$src/ch/sbb-cff-ffs-hafas-mgate.json" >../p/sbb/base.json
node -p "$query" "$src/be/nmbs-sncb-hafas-mgate.json" >../p/sncb/base.json
node -p "$query" "$src/at/svv-hafas-mgate.json" >../p/svv/base.json
node -p "$query" "$src/de/vbb-hafas-mgate.json" >../p/vbb/base.json
node -p "$query" "$src/de/vbn-hafas-mgate.json" >../p/vbn/base.json
node -p "$query" "$src/at/vkg-hafas-mgate.json" >../p/vkg/base.json
node -p "$query" "$src/de/vmt-hafas-mgate.json" >../p/vmt/base.json
node -p "$query" "$src/de/vos-hafas-mgate.json" >../p/vos/base.json
node -p "$query" "$src/de/vrn-hafas-mgate.json" >../p/vrn/base.json
node -p "$query" "$src/de/vsn-hafas-mgate.json" >../p/vsn/base.json
node -p "$query" "$src/at/vvt-hafas-mgate.json" >../p/vvt/base.json
node -p "$query" "$src/ch/zvv-hafas-mgate.json" >../p/zvv/base.json

@ -1 +1 @@
Subproject commit d15fa68b3b4703ee172d706ea39b148e9dd8bd47
Subproject commit 03095950efe3e938eeb262b4a79180fb9a279fb6