Skip to content

Instantly share code, notes, and snippets.

@derhuerst
Last active December 10, 2022 23:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save derhuerst/5abc2e1f74b9bb29a3aeffe59b503103 to your computer and use it in GitHub Desktop.
Save derhuerst/5abc2e1f74b9bb29a3aeffe59b503103 to your computer and use it in GitHub Desktop.
SBB HAFAS query.exe encoding
queryPageDisplayed=yes
start=yes
HWAI=JS!ajax=yes
HWAI=JS!js=yes
HWAI=~CONNECTION!
REQ0Total_KissRideMotorClass=404
REQ0Total_KissRideCarClass=5
REQ0Total_KissRide_maxDist=10000000
REQ0Total_KissRide_minDist=0
REQComparisonCarload=0
REQ0JourneyStopsS0G=Bern
REQ0JourneyStopsS0ID=A=1@O=Bern@X=7439131@Y=46948834@U=95@L=008507000@B=1@p=1607065263@
REQ0JourneyStopsS0A=1
REQ0JourneyStopsS0A=2
REQ0JourneyStopsS0A=4
REQ0JourneyStopsS0A=255
REQ0JourneyStopsZ0G=Basel SBB
REQ0JourneyStopsZ0ID=A=1@O=Basel SBB@X=7589566@Y=47547408@U=85@L=008500010@B=1@p=1607096352@
REQ0JourneyStopsZ0A=1
REQ0JourneyStopsZ0A=2
REQ0JourneyStopsZ0A=4
REQ0JourneyStopsZ0A=255
REQ0JourneyStops1.0G=
REQ0JourneyStops1.0A=1
REQ0JourneyStopover1=
date=Mo, 07.12.20
REQ0JourneyTime=01:50
REQ0HafasSearchForw=1
REQ0HafasSearchForw=0
changeQueryInputData=yes&start=Verbindung suchen
REQ0JourneyStops2.0G=
REQ0JourneyStops2.0A=1
REQ0JourneyStopover2=
REQ0JourneyStops3.0G=
REQ0JourneyStops3.0A=1
REQ0JourneyStopover3=
REQ0JourneyStops4.0G=
REQ0JourneyStops4.0A=1
REQ0JourneyStopover4=
REQ0JourneyStops5.0G=
REQ0JourneyStops5.0A=1
REQ0JourneyStopover5=
REQ0HafasOptimize1=1:1
existOptimizePrice=0
REQ0HafasUnsharpSearch=1
existUnsharpSearch=yes
existHafasAttrExc=yes
REQ0HafasAttrExc.1=VT:VN:aq
REQ0HafasAttrExc.2=GN
advancedProductMode&showAdvancedInput=1&=Verkehrsmittelwahl für alle Via und Umsteigepunkte anzeigen
REQ0JourneyProduct_prod_0=1
existProductBits0=yes
REQ0JourneyProduct_prod_1=1
REQ0JourneyProduct_prod_2=1
REQ0JourneyProduct_prod_3=1
REQ0JourneyProduct_prod_4=1
REQ0JourneyProduct_prod_5=1
REQ0JourneyProduct_prod_6=1
REQ0JourneyProduct_prod_7=1
REQ0JourneyProduct_prod_8=1
REQ0JourneyProduct_prod_9=1
REQ0JourneyProduct_opt_section_0_list=0:0000
REQ0JourneyProduct_opt_section_0_list=1:1000
REQ0JourneyProduct_opt_section_0_list=2:0100
REQ0JourneyProduct_opt_section_0_list=3:0010
REQ0HafasCapacity1st=11:1
REQ0HafasCapacity1st=12:2
REQ0HafasCapacity1st=13:3
REQ0HafasCapacity2nd=11:1
REQ0HafasCapacity2nd=12:2
REQ0HafasCapacity2nd=13:3
showBaim=yes
disableBaim=yes&REQ0HafasHandicapLimit=4:4
REQ0HafasHandicapLimit=1:1
REQ0HafasHandicapLimit=2:2
REQ0HafasHandicapLimit=3:3
changeQueryInputData=yes&start=Verbindung suchen"
queryPageDisplayed=yes&HWAI%3DJS%21ajax=yes&HWAI%3DJS%21js=yes&HWAI=%7ECONNECTION%21&REQ0Total_KissRideMotorClass=404&REQ0Total_KissRideCarClass=5&REQ0Total_KissRide_maxDist=10000000&REQ0Total_KissRide_minDist=0&REQComparisonCarload=0&REQ0JourneyStopsS0G=Basel+SBB&REQ0JourneyStopsS0ID=A%3D1%40O%3DBasel+SBB%40X%3D7589566%40Y%3D47547408%40U%3D85%40L%3D008500010%40B%3D1%40p%3D1607096352%40&REQ0JourneyStopsS0A=1&REQ0JourneyStopsZ0G=Bern&REQ0JourneyStopsZ0ID=A%3D1%40O%3DBern%40X%3D7439131%40Y%3D46948834%40U%3D95%40L%3D008507000%40B%3D1%40p%3D1607065263%40&REQ0JourneyStopsZ0A=1&REQ0JourneyStops1.0G=&REQ0JourneyStops1.0A=1&REQ0JourneyStopover1=&date=Di%2C+08.12.20&REQ0JourneyTime=08%3A00&REQ0HafasSearchForw=1&REQ0JourneyStops2.0G=Z%FCrich+HB&REQ0JourneyStops2.0ID=A%3D1%40O%3DZ%FCrich+HB%40X%3D8540211%40Y%3D47378177%40U%3D95%40L%3D008503000%40B%3D1%40p%3D1607065263%40&REQ0JourneyStops2.0A=1&REQ0JourneyStopover2=&REQ0JourneyStops3.0G=&REQ0JourneyStops3.0A=1&REQ0JourneyStopover3=&REQ0JourneyStops4.0G=&REQ0JourneyStops4.0A=1&REQ0JourneyStopover4=&REQ0JourneyStops5.0G=&REQ0JourneyStops5.0A=1&REQ0JourneyStopover5=&REQ0HafasOptimize1=1%3A1&existOptimizePrice=0&REQ0HafasUnsharpSearch=1&existUnsharpSearch=yes&REQ0HafasChangeTime=0%3A1&existHafasAttrExc=yes&REQ0JourneyProduct_prod_0=1&existProductBits0=yes&REQ0JourneyProduct_prod_4=1&REQ0JourneyProduct_prod_5=1&REQ0JourneyProduct_prod_6=1&REQ0JourneyProduct_prod_7=1&REQ0JourneyProduct_prod_8=1&REQ0JourneyProduct_prod_9=1&REQ0JourneyProduct_opt_section_0_list=0%3A0000&disableBaim=yes%26REQ0HafasHandicapLimit%3D4%3A4&changeQueryInputData%3Dyes%26start=Verbindung+suchen

see also https://github.com/derhuerst/generate-db-shop-urls/blob/59020475281e0f840cc4b35030264d1ed6f8a863/index.js#L90-L118

  • REQ0JourneyStops(S|Z|\d\.)0ID is the origin/stopover/destination ID
  • REQ0JourneyStops(S|Z|\d\.)0G is the origin/stopover/destination name
  • REQ0JourneyStops(S|Z|\d\.)0A is the type of origin/stopover/destination
    • 1 for stop/station
    • 2 for address
    • 4 for POI
    • 255 probably means all?
  • existUnsharpSearch is mgate.exe's ushrp
  • existProductBits0 sets the product mask to all-0, REQ0JourneyProduct_prod_\d+ sets an individual bit to 1
@derhuerst
Copy link
Author

From bahn.de, for a connection from Hannover Hbf to München Hbf on 2022-12-24, as of today:

HWAI%3DQUERY%21rit=no&queryPageDisplayed=yes&HWAI%3DQUERY%21displayed=yes&HWAI%3DJS%21ajax=yes&HWAI%3DJS%21js=yes&REQ0JourneyStopsS0A=255&ignoreTypeCheck=yes&REQ0JourneyStopsS0G=Hannover+Hbf&REQ0JourneyStopsS0ID=A%3D1%40O%3DHannover+Hbf%40X%3D9741017%40Y%3D52376764%40U%3D80%40L%3D008000152%40B%3D1%40p%3D1670279420%40&REQ0JourneyStopsS0o=8&REQ0JourneyStopsS0a=131072&reverseOutwardData=js&REQ0JourneyStopsZ0A=255&REQ0JourneyStopsZ0G=M%FCnchen+Hbf&REQ0JourneyStopsZ0ID=A%3D1%40O%3DM%FCnchen+Hbf%40X%3D11558339%40Y%3D48140229%40U%3D81%40L%3D008000261%40B%3D1%40p%3D1670443483%40&REQ0JourneyStopsZ0o=8&REQ0JourneyStopsZ0a=131072&REQ0JourneyDate=Sa%2C+24.12.22&REQ0JourneyTime=21%3A00&REQ0HafasSearchForw=1&REQ1JourneyDate=&REQ1JourneyTime=&REQ1HafasSearchForw=1&useFastConnectionsOnly=on&HWAI%3DQUERY%24PRODUCTS%240_0%21show=yes&traveller_Nr=1&REQ0Tariff_TravellerType.1=E&REQ0Tariff_TravellerReductionClass.1=0&REQ0Tariff_TravellerAge.1=&REQ0Tariff_Class=2&REQ0HafasChangeTime=0%3A1&HWAI%3DQUERY%24via%240%21number=0&REQ0JourneyStops1ID=&REQ0JourneyStops2ID=&HWAI%3DQUERY%24via%241%21number=0&REQ1JourneyStops1ID=&REQ1JourneyStops2ID=&REQ0JourneyRevia=yes&HWAI%3DQUERY%21prodAdvanced=0&existOptimizePrice=1&useFastConnectionsOnly=on&existProductNahverkehr=1&HWAI%3DQUERY%24PRODUCTS%240_0%21show=yes&HWAI%3DQUERY%24PRODUCTS%240_0%21show=yes&advancedProductMode=yes&REQ0JourneyProduct_prod_section_0_0=1&REQ0JourneyProduct_prod_section_0_1=1&REQ0JourneyProduct_prod_section_0_2=1&REQ0JourneyProduct_prod_section_0_3=1&REQ0JourneyProduct_prod_section_0_4=1&REQ0JourneyProduct_prod_section_0_5=1&REQ0JourneyProduct_prod_section_0_6=1&REQ0JourneyProduct_prod_section_0_7=1&REQ0JourneyProduct_prod_section_0_8=1&REQ0JourneyProduct_prod_section_0_9=1&REQ0JourneyProduct_opt_section_0_list=0%3A0000&existProductAutoReturn=yes&existIntermodalDep_enable=yes&REQ0JourneyDep__enable=Foot&existIntermodalDest_enable=yes&REQ0JourneyDest__enable=Foot&HWAI%3DQUERY%21hideExtInt=no&REQ0JourneyDep_Foot_minDist=0&REQ0JourneyDest_Foot_minDist=0&REQ0JourneyDep_Foot_maxDist=2000&REQ0JourneyDest_Foot_maxDist=2000&REQ0JourneyDep_Bike_minDist=0&REQ0JourneyDest_Bike_minDist=0&REQ0JourneyDep_Bike_maxDist=5000&REQ0JourneyDest_Bike_maxDist=5000&REQ0JourneyDep_KissRide_minDist=2000&REQ0JourneyDest_KissRide_minDist=2000&REQ0JourneyDep_KissRide_maxDist=50000&REQ0JourneyDest_KissRide_maxDist=50000&existOptionBits=yes&existTbpMode=1&rtMode=12&start=Suchen
{
	"HWAI=QUERY!rit": "no",
	"queryPageDisplayed": "yes",
	"HWAI=QUERY!displayed": "yes",
	"HWAI=JS!ajax": "yes",
	"HWAI=JS!js": "yes",
	"REQ0JourneyStopsS0A": "255",
	"ignoreTypeCheck": "yes",
	"REQ0JourneyStopsS0G": "Hannover Hbf",
	"REQ0JourneyStopsS0ID": "A=1@O=Hannover Hbf@X=9741017@Y=52376764@U=80@L=008000152@B=1@p=1670279420@",
	"REQ0JourneyStopsS0o": "8",
	"REQ0JourneyStopsS0a": "131072",
	"reverseOutwardData": "js",
	"REQ0JourneyStopsZ0A": "255",
	"REQ0JourneyStopsZ0G": "M%FCnchen Hbf",
	"REQ0JourneyStopsZ0ID": "A%3D1%40O%3DM%FCnchen Hbf%40X%3D11558339%40Y%3D48140229%40U%3D81%40L%3D008000261%40B%3D1%40p%3D1670443483%40",
	"REQ0JourneyStopsZ0o": "8",
	"REQ0JourneyStopsZ0a": "131072",
	"REQ0JourneyDate": "Sa, 24.12.22",
	"REQ0JourneyTime": "21:00",
	"REQ0HafasSearchForw": "1",
	"REQ1JourneyDate": "",
	"REQ1JourneyTime": "",
	"REQ1HafasSearchForw": "1",
	"useFastConnectionsOnly": [
		"on",
		"on"
	],
	"HWAI=QUERY$PRODUCTS$0_0!show": [
		"yes",
		"yes",
		"yes"
	],
	"traveller_Nr": "1",
	"REQ0Tariff_TravellerType": [
		"E"
	],
	"REQ0Tariff_TravellerReductionClass": [
		"0"
	],
	"REQ0Tariff_TravellerAge": [
		""
	],
	"REQ0Tariff_Class": "2",
	"REQ0HafasChangeTime": "0:1",
	"HWAI=QUERY$via$0!number": "0",
	"REQ0JourneyStops1ID": "",
	"REQ0JourneyStops2ID": "",
	"HWAI=QUERY$via$1!number": "0",
	"REQ1JourneyStops1ID": "",
	"REQ1JourneyStops2ID": "",
	"REQ0JourneyRevia": "yes",
	"HWAI=QUERY!prodAdvanced": "0",
	"existOptimizePrice": "1",
	"existProductNahverkehr": "1",
	"advancedProductMode": "yes",
	"REQ0JourneyProduct_prod_section_0_0": "1",
	"REQ0JourneyProduct_prod_section_0_1": "1",
	"REQ0JourneyProduct_prod_section_0_2": "1",
	"REQ0JourneyProduct_prod_section_0_3": "1",
	"REQ0JourneyProduct_prod_section_0_4": "1",
	"REQ0JourneyProduct_prod_section_0_5": "1",
	"REQ0JourneyProduct_prod_section_0_6": "1",
	"REQ0JourneyProduct_prod_section_0_7": "1",
	"REQ0JourneyProduct_prod_section_0_8": "1",
	"REQ0JourneyProduct_prod_section_0_9": "1",
	"REQ0JourneyProduct_opt_section_0_list": "0:0000",
	"existProductAutoReturn": "yes",
	"existIntermodalDep_enable": "yes",
	"REQ0JourneyDep__enable": "Foot",
	"existIntermodalDest_enable": "yes",
	"REQ0JourneyDest__enable": "Foot",
	"HWAI=QUERY!hideExtInt": "no",
	"REQ0JourneyDep_Foot_minDist": "0",
	"REQ0JourneyDest_Foot_minDist": "0",
	"REQ0JourneyDep_Foot_maxDist": "2000",
	"REQ0JourneyDest_Foot_maxDist": "2000",
	"REQ0JourneyDep_Bike_minDist": "0",
	"REQ0JourneyDest_Bike_minDist": "0",
	"REQ0JourneyDep_Bike_maxDist": "5000",
	"REQ0JourneyDest_Bike_maxDist": "5000",
	"REQ0JourneyDep_KissRide_minDist": "2000",
	"REQ0JourneyDest_KissRide_minDist": "2000",
	"REQ0JourneyDep_KissRide_maxDist": "50000",
	"REQ0JourneyDest_KissRide_maxDist": "50000",
	"existOptionBits": "yes",
	"existTbpMode": "1",
	"rtMode": "12",
	"start": "Suchen"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment