问题
i want get weather from http://www.google.com/ig/api?weather=
I use this
// load xml result from Google weather
var addr = WebUtility.HtmlEncode("http://www.google.com/ig/api?weather=vilnius&hl=lt");
XDocument xd = XDocument.Load(addr);
// navigate to current conditions node
var current_conditions = from currentCond in xd.Root.Descendants("current_conditions")
select currentCond;
// navigate to Forecast info node
var forcastInfo = from forecastinfo in xd.Root.Descendants("forecast_information")
select forecastinfo;
I use url http://www.google.com/ig/api?weather=vilnius&hl=lt
but information get in english, I can't find problem please help :)
回答1:
See my answer to your original question - no need for WebUtility.HtmlEncode as you get "amp;hl=lt" query parameter instead of "hl=lt".
English result: http://www.google.com/ig/api?weather=vilnius&hl=lt
Non-English result:http://www.google.com/ig/api?weather=vilnius&hl=lt
来源:https://stackoverflow.com/questions/10455776/c-sharp-google-weather-xml-getting