XML data - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: XML data (/showthread.php?tid=2521) |
XML data - tomnord - 18.03.2020 Hello, I`m looking to import weaterdata from a website. The site exports data as xml. Is there a guide to doing so in LM? Example xml: https://www.yr.no/sted/Norge/Vestfold_og_Telemark/Midt-Telemark/Gvarv/varsel.xml Sent fra min SM-G950F via Tapatalk RE: XML data - Daniel - 18.03.2020 Code: require('socket.http') RE: XML data - Tokatubs - 18.03.2020 Daniel, is this still working. ? I think yr.no changed to another api. https://api.met.no/ RE: XML data - admin - 18.03.2020 Their new beta API provides JSON which is much easier to parse: https://api.met.no/weatherapi/locationforecast/2.0/.json?lat=60.10&lon=9.58 RE: XML data - Daniel - 18.03.2020 My script still works. RE: XML data - Tokatubs - 18.03.2020 require('ssl.https') require('json') data = ssl.https.request('http://weerlive.nl/api/json-10min.php?locatie=' ..plaatsnaam) datatable = json.pdecode(data) datatable = datatable['liveweer'][1] log(datatable) If you use something like this, how do you deploy it and how do you extract this to groupo adresses? RE: XML data - tomnord - 18.03.2020 (18.03.2020, 09:29)admin Wrote: Their new beta API provides JSON which is much easier to parse:Where do we privide location on this one? never mind, I see the long lat now decoding json gives me "nesting to deep" in most of the tables.. What could be the reason for this? RE: XML data - Daniel - 18.03.2020 I tried like that you have to put coordinate of location as longitude and latitude. Code: require('ssl.https') RE: XML data - tomnord - 18.03.2020 (18.03.2020, 10:22)Daniel. Wrote: I tried like that you have to put coordinate of location as longitude and latitude.yeah, I got some data, but I also got "nesting to deep" in the log. could try to extract spesiffic data, maybe that would do the trick. seems to work, but the amount of data in the table is quite big, and difficult to navigate. Any good tips to view the table in a structured way? RE: XML data - admin - 18.03.2020 Firefox can display JSON data in a structured way. Or just copy JSON from the URL and use any online JSON viewer. |