I did some digging but wasn’t able to find a usable API at first.
Company Website (& API)
I don’t know if the website is down or geo-blocked for me, I can’t reach www.speedway.com
If I could, I’d check if they have pages for each station with live prices available, then search that page with the developer tools in the browser for the API (in “sources”) and see if it’s tappable. If not, but the page somehow has live prices, it could still be parsed (see below).
Google Knowledge Graph
I searched that station on Google and found the result page had a right hand sidebar (Google Knowledge Graph) with live prices. So I thought I could get it via the Knowledge Graph API (if you have a Google Dev API key (and activated KG), you can try it with this link) but the itemList is empty, or maybe I did something wrong. Wrong queries?
Google Maps – or Places?
Then I found out that when you search that station on Google Maps, it’ll also show the live prices in the sidebar on the left. But the latest info I found (some months old) say that there’s no way to access these as they’re not in the Google Maps API (or was it Places?).
Time for a jsoup?
By now I was thinking of just loading the website (GasBuddy or Google search result) and parse it to get the element that holds the price … jsoup would help there.
But then I thought I’d take a look at GasBuddy again, because the price has to come from somewhere, right? It gets complicated from here on, though.
Whether or not it is legal to get the info from the API can vary from country to country. In most cases, it’s ok to call the API for private use only. However, dumb and illegal things can be done this way. (That’s why APIs are usualy protected by a key/password. One could argue that it’s up to the company to protect and limit the API – like Google and others do with their keys.) By the way, that’s why I won’t publish the module I mentioned above.
Getting the live price from the actual source/company, or at least from Google, would be awesome, though, as the GasBuddy price is not really live, it’s only updated when a user shares the newest price.