{"id":17332721,"url":"https://github.com/amwolff/google-gtfs-realtime-tools","last_synced_at":"2025-03-27T06:24:57.238Z","repository":{"id":57553476,"uuid":"239292232","full_name":"amwolff/google-gtfs-realtime-tools","owner":"amwolff","description":"Build servers that push or serve GTFS Realtime feeds for Google","archived":false,"fork":false,"pushed_at":"2020-02-23T13:59:14.000Z","size":45783,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T11:32:37.534Z","etag":null,"topics":["google","google-api","google-maps","gtfs","gtfs-realtime","transit","transit-agencies"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amwolff.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-09T11:22:04.000Z","updated_at":"2020-02-23T14:29:09.000Z","dependencies_parsed_at":"2022-09-26T18:40:46.725Z","dependency_job_id":null,"html_url":"https://github.com/amwolff/google-gtfs-realtime-tools","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amwolff%2Fgoogle-gtfs-realtime-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amwolff%2Fgoogle-gtfs-realtime-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amwolff%2Fgoogle-gtfs-realtime-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amwolff%2Fgoogle-gtfs-realtime-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amwolff","download_url":"https://codeload.github.com/amwolff/google-gtfs-realtime-tools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245793765,"owners_count":20673053,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google","google-api","google-maps","gtfs","gtfs-realtime","transit","transit-agencies"],"created_at":"2024-10-15T14:58:40.763Z","updated_at":"2025-03-27T06:24:57.221Z","avatar_url":"https://github.com/amwolff.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Go tools to interact with the Google Transit APIs\n=================================================\n\n[![GoDoc](https://godoc.org/github.com/amwolff/google-gtfs-realtime-tools?status.svg)](https://godoc.org/github.com/amwolff/google-gtfs-realtime-tools)\n[![Build Status](https://travis-ci.org/amwolff/google-gtfs-realtime-tools.svg?branch=master)](https://travis-ci.org/amwolff/google-gtfs-realtime-tools)\n\n## Overview\n\nLive Transit Updates is a feature within Google Maps that provides users with realtime transit information.\nGTFS Realtime is a data exchange format consumed by the Google Transit APIs.\nThe code here aims to make it easier to push or make Google fetch such feed, enabling the feature.\n\n## Getting started\n\nThe easiest way to start is to implement the [`FeedProvider`](https://github.com/amwolff/google-gtfs-realtime-tools/blob/master/provider/provider.go) interface.\n\n### Push\n\n```go\npackage main\n\nimport (\n\t\"net/http\"\n\t\"os\"\n\n\t\"github.com/amwolff/google-gtfs-realtime-tools/oauth\"\n)\n\nfunc main() {\n\thttpClient := \u0026http.Client{}\n\n\tf, err := os.Open(\"a/path/to/client_secrets.JSON\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer f.Close()\n\n\tc, err := oauth.NewClient(\n\t\thttpClient,\n\t\tf,\n\t\t\"a/path/to/where/cache/.tokens.JSON\",\n\t\toauth.DefaultTokenExchangeURL,\n\t\t\"YOUR_AUTHORIZATION_CODE\",\n\t\toauth.DefaultFeedUploadURL)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tp := ADataSourceThatImplementsFeedProvider{...}\n\n\tif err := c.Run(p, \"feed.pb\", \"YOUR_ALKALI_ACCOUNT_ID\", \"YOUR_REALTIME_FEED_ID\"); err != nil {\n\t\tpanic(err)\n\t}\n}\n```\n\nYou can also use the `UploadFeedMessage` method to have more control over the process.\n\n### Fetch\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\t\"net/http\"\n\n\t\"github.com/amwolff/google-gtfs-realtime-tools/fetch\"\n)\n\nfunc main() {\n\tp := ADataSourceThatImplementsFeedProvider{...}\n\n\th := fetch.NewWithCache(p)\n\n\tif err := http.ListenAndServe(\":http\", h); err != nil {\n\t\tlog.Println(err)\n\t}\n\tlog.Println(\"Begin serving your feed on all interfaces at HTTP port\")\n}\n```\n\nAlthough *push* seems more modern and sophisticated I strongly encourage you to use the *fetch* model, especially if you are a public transportation agency.\nThis way not only Google can fetch realtime transit data but also people like me.\nOpening your data creates opportunities to build better working cities and, of course, the world.\n\nI hope the docs and examples speak for themselves but if anything seems unclear - feel free to contact me or open an issue here.\n\nWorking examples can be found [here](https://github.com/amwolff/google-gtfs-realtime-tools/tree/master/cmd).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famwolff%2Fgoogle-gtfs-realtime-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famwolff%2Fgoogle-gtfs-realtime-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famwolff%2Fgoogle-gtfs-realtime-tools/lists"}