Added kmb and refactored query.Parse

This commit is contained in:
2022-09-17 04:33:47 +08:00
parent 292665c49b
commit 3376d9eb96
21 changed files with 762 additions and 241 deletions

View File

@@ -45,9 +45,15 @@ func getSchedule( lang string, routeName string ) ( *BusSchedule, error ) {
"mtr_bsch" + "-" + lang + "-" + routeName + ".json",
)
postLang := "en"
if lang == "zh-Hant" {
postLang = "zh"
}
QUERY_FUNC := func() ( io.ReadCloser, error ) {
// Query Remote
values := map[string]string { "language": lang , "routeName": routeName }
values := map[string]string { "language": postLang, "routeName": routeName }
jsonValue, _ := json.Marshal(values)
resp, err := http.Post(
"https://rt.data.gov.hk/v1/transport/mtr/bus/getSchedule",