google weather api links need human authentication

2020-07-23 08:51发布

问题:

I developed a weather app using google weather API but from today it stopped working.

When I tried to access the weather API using location through browser it asks for human authentication.

How can my app work when it is like this? Is there a way to bypass the authentication process?

回答1:

It's very odd behavior...I wonder if it has something to do with headers that are passed along as when I try loading the API url in Chrome, Unsupported API...or if I do same URL in Firefox, works just fine.

It's also worth noting that I tried setting up an Apache Proxy to Google's weather service by placing the following two lines in a separate Web Server's apache config and referenced the API via www.domain.com/weather/api?weather=Chicago and it still works...so that's my workaround for now:

ProxyPassReverse /weather/ http://www.google.com/ig/

ProxyPass /weather/ http://www.google.com/ig/



回答2:

Try to change domain, ex: http://www.google.ca/ig/api?weather=Sondrio . It works (for now :D).



回答3:

Looks like it is out of use from now on

Even using .CA it returns Unsupported API randomly.

Pity



回答4:

Yeah, interesting, Google seems to send back random "Unsupported API" responses if the request is missing the cookies that the browsers (tested with Chrome and Firefox) are including with requests to the inofficial weather URL.

I've fixed my application by copying the entire "Cookie:" header I found when I ran the request in Firefox with Firebug's "Net" tab enabled.

Not sure where on .google.com the browser got the cookies from yet, I presume from using a personalized service like gmail.



回答5:

if you are looking for a weather API that works right now, I have a suggestion…

Try Metwit Weather API, it's new but sounds very cool…
This api is really simple to use because it use standards that are available nowadays, like JSON and REST.



回答6:

you can use this new api this has the same xml structure of google weather api

http://en.previmeteo.com/professionals/google-weather-api.php



标签: api weather