Code: Select all
; https://creativecommons.tankerkoenig.de/api-key (API-Key per Mail zusenden lassen. Mail enthält txt-Datei)
; https://creativecommons.tankerkoenig.de/info (API-Beschreibung)
; https://creativecommons.tankerkoenig.de/history (Page zu historischen Daten)
; https://dev.azure.com/tankerkoenig/_git/tankerkoenig-data (Download historischer Daten, CSV)
; https://creativecommons.tankerkoenig.de/history/history.dump.gz (ab 03.10.2020, PostgreSQL)
; https://creativecommons.tankerkoenig.de/history/history.dump.2.gz (02.05.2016 - 02.10.2020, PostgreSQL)
; https://creativecommons.tankerkoenig.de/history/history.dump.1.gz (08.06.2014 - 02.05.2016, PostgreSQL)
;
; https://creativecommons.tankerkoenig.de/TankstellenFinder/index.html (Tankstelle auf Karte aussuchen, listen, und als JSON format 'Übernehmen'/exportieren)
#SingleInstance, Force
#Include JSON.ahk
; MsgBox % JSON.Load(tk(52.521,13.438,1.5)).stations[1].brand ;'Umkreis'-Abfrage, alle Tankstellen in 1.5KM Radius um Koordinate. Ausgabe object
; MsgBox % tk(52.521,13.438,1.5,"diesel","price") ;'Umkreis'-Abfrage, "Diesel"-Tankstelle, 1.5KM Radius um Koordinate, nach Preis sortiert. Ausgabe JSON-FOrmat
; MsgBox % tk("4429a7d9-fb2d-4c29-8cfe-2ca90323f9f8,446bdcf5-9f75-47fc-9cfa-2c3d6fda1c3b") ;'Preis'-Abfrage bei zwei Tankstellen. Ausgabe JSON-Format
MsgBox % JSON.Load(tk("24a381e3-0d72-416d-bfd8-b2f65f6e5802")).station.isOpen ;'Detail'-Abfrage zu einer Tankstelle. Ausgabe object
tk(id:="",lat:="",lng:="",rad:="",type:="",sort:="") {
if id is float ; falls erster parameter 'float', also eine Koordinate ist > 'list'-Abfrage
{ rqT := "list" ; "ordnen" der parameter werte
param := "lat=" . id
. "&lng=" . lat
. "&rad=" . (lng:=""||lng>25?25:lng)
. "&type=" . (rad=""?"all":rad)
. "&sort=" . (type=""?"dist":type)
}
else {
StrSplit(id,",").count()>1 ? (rqT:="prices", param:= "&ids=" . id) : ; wenn erster parameter mehrere items/StationsIDs enthält > 'price'-Abfrage
StrSplit(id,",").count()=1 ? (rqT:="detail", param:= "&id=" . id) : "" ; wenn erster parameter ein item/eine StationsID enthält > 'deatil'-Abfrage
}
; myAPIKey:="00000000-0000-0000-0000-000000000002" ; API-Key hier kostenlos anfordern: https://creativecommons.tankerkoenig.de/api-key
url:="https://creativecommons.tankerkoenig.de/json/" . rqT . ".php?apikey=" . myAPIKey . "&" . param
req := ComObjCreate("Msxml2.XMLHTTP")
req.open("GET", url, False)
req.Send()
Return req.responseText
}
/*
Parameter für 'Umkreissuche'
lat: Geographische Breite des Standortes (float): '52.521'
lng: Geographische Länge (float): '13.438'
rad: Suchradius in km (max.25) (float): '1.5'
type: Spritsorte (string): 'e5' ('e10', 'diesel' oder 'all') . Bei 'type=all' wird immer nach Entfernung sortiert. Die Angabe der Sortierung ist dann optional
sort: Sortierung (string): 'price' ('dist')
Abfragebare Schlüssel nach Umwandlung mittels JSON.ahk
list:= { "ok":"","license":"","data":"","status":"",
. "stations":[{"id":"","name":"","brand":"","street":"","place":"","lat":"","lng":"","dist":"","diesel":"","e5":"","e10":"isOpen":"","houseNumber":"","postCode"}]}
Beispiel-URL
https://creativecommons.tankerkoenig.de/json/list.php?lat=52.521&lng=13.438&rad=1.5&sort=dist&type=all&apikey=00000000-0000-0000-0000-000000000002
------
Parameter für eine 'Preis'-Abfrage
Angabe von durch Kommas getrennte StationsIDs: '4429a7d9-fb2d-4c29-8cfe-2ca90323f9f8,446bdcf5-9f75-47fc-9cfa-2c3d6fda1c3b'
Abfragbare Schlüssel nach Umwandlung mittels JSON.ahk
price:= { "ok":"","license":"","data":"","status":"",
. "stations":[{"id":"","name":"","brand":"","street":"","place":"","lat":"","lng":"","dist":"","diesel":"","e5":"","e10":"isOpen":"","houseNumber":"","postCode"}]}
Beispiel-URL
https://creativecommons.tankerkoenig.de/json/prices.php?ids=4429a7d9-fb2d-4c29-8cfe-2ca90323f9f8,446bdcf5-9f75-47fc-9cfa-2c3d6fda1c3b,60c0eefa-d2a8-4f5c-82cc-b5244ecae955,44444444-4444-4444-4444-444444444444&apikey=00000000-0000-0000-0000-000000000002
------
Parameter für die 'Detail'-Abfrage
Angabe einer einzelnen StationsID: '24a381e3-0d72-416d-bfd8-b2f65f6e5802'
Abfragbare Schlüssel nach Umwandlung mittels JSON.ahk
detail:= { "ok":"","license":"","data":"","status":"","station":{"id":"","name":"","brand":"","street":"","houseNumber":"","postCode":,"place":"",
"openingTimes":[{"text":"","start":"","end":""},{"text":"","start":"","end":""},{"text":"","start"","end":""}],
"overrides":[],"wholeDay":,"isOpen":,"e5":,"e10":,"diesel":,"lat":,"lng":,"state":}}
Beispiel-URL
https://creativecommons.tankerkoenig.de/json/detail.php?id=24a381e3-0d72-416d-bfd8-b2f65f6e5802&apikey=00000000-0000-0000-0000-000000000002
*/
https://www.brandslex.de/branchen/tankstellen