0

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 :)

Wizard
  • 10,985
  • 38
  • 91
  • 165
  • When I open the url in my browser, I don't see any English word, but only Lithuanian. How does the result look when you open it in the browser? – Yogu May 04 '12 at 20:35
  • in english ;( maybe problem is in location setting in pc – Wizard May 04 '12 at 20:38
  • I'm in Germany and my browser is German, too, so this should be no problem. – Yogu May 04 '12 at 20:42

1 Answers1

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

Community
  • 1
  • 1
Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179