MATLAB Answers

thing speak site not taking the values from the web site

2 views (last 30 days)
Niranga Sahan
Niranga Sahan on 11 Oct 2020
hi
im try to get the rain posibillity % value from the "www.worldweatheronline.com" but when i past the URL with a API Key on the browser it sayed "Error parsing document, try a different parse string." i used this same URL before 3 weeks a go and it is working fine withou a issue, now its not working pls help me to slove this probleam.
Parse String: //*[@id="outlook_div_wxs"]/div[2]/div[1]/dl/dd[3]
thank you...

  0 Comments

Sign in to comment.

Answers (1)

Christopher Stapels
Christopher Stapels on 12 Oct 2020
It looks like you are using ThingHTTP. The website may have changed, or there may be parts of it that have dynamic content. If some of the content changed, it could change your ability to parse another part of the document, even if that part of the document is the same.
I think a much more robust method is to use webread or webwrite in a MATLAB analysis to read from an API.
There seems to be documentation here :https://www.worldweatheronline.com/developer/api/docs/local-city-town-weather-api.aspx
An example might be
url='https://api.worldweatheronline.com/premium/v1/weather.ashx'; % add parameters of interest.
myWeather=webread(url);
They have a free trial, but you need a subscription after two months I think.
There may be other free API's if you hunt around. The scraping method can be pretty difficult to keep working.

  0 Comments

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!