Get temperature data from web page - 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: Get temperature data from web page (/showthread.php?tid=4700) |
Get temperature data from web page - Ohmarn - 04.04.2023 Hi, I want to get a temperature from a web page (Sea and water temperature) and send it to a group address. The temperature i want is "Vatten" for "Yngsjö havsbad". The closest i could find in the forum was this script, post #5, Forum post. But i get stuck when it comes to "find matching string and fetch the data you want with". Does anyone have any ideas how this could be done? Any tips or pointing me in a better direction? Best regards //Simon RE: Get temperature data from web page - Joep - 04.04.2023 require('ssl.https') data = ssl.https.request('https://www.havochvatten.se/badplatser-och-badvatten/vattenprov-badtemperatur/vattentemperatur-och-kvalitet-pa-badvatten-pa-sydkusten.html') log(data) RE: Get temperature data from web page - admin - 05.04.2023 Try this: Code: url = 'https://www.havochvatten.se/badplatser-och-badvatten/vattenprov-badtemperatur/vattentemperatur-och-kvalitet-pa-badvatten-pa-sydkusten.html' RE: Get temperature data from web page - Ohmarn - 11.04.2023 Great, but how do i split up the log to send the value i want? I tried this code, it sends a value but not corectly. It first sends the value 5,6 310 times, then 13 other values once. At least all the values are from the correct table. Code: url = 'https://www.havochvatten.se/badplatser-och-badvatten/vattenprov-badtemperatur/vattentemperatur-och-kvalitet-pa-badvatten-pa-sydkusten.html' RE: Get temperature data from web page - admin - 11.04.2023 Which values exactly do you want and in which group addresses? RE: Get temperature data from web page - Ohmarn - 11.04.2023 (11.04.2023, 14:02)admin Wrote: Which values exactly do you want and in which group addresses? I want the first value (5 ℃) from this row: Yngsjö havsbad, Kristianstad 5 ℃ 8.1 ℃ (see attached pictures) Group adress: 10/5/101 4.9 ℃ 6.5 ℃ RE: Get temperature data from web page - admin - 12.04.2023 Try this: Code: url = 'https://www.havochvatten.se/badplatser-och-badvatten/vattenprov-badtemperatur/vattentemperatur-och-kvalitet-pa-badvatten-pa-sydkusten.html' RE: Get temperature data from web page - Ohmarn - 12.04.2023 Thanks, works perfectly! //Simon RE: Get temperature data from web page - Ohmarn - 23.08.2023 Hi, Since you kindly helped me last time, they've change the website and now i have to update the script.. Is anyone willing to help me, again? Source URL Value marked with blue. Best regards //Simon RE: Get temperature data from web page - fleeceable - 23.08.2023 (23.08.2023, 13:49)Ohmarn Wrote: Hi, Used ChatGTP for this: Code: url = 'https://www.havochvatten.se/badplatser-och-badvatten/vattenprov-badtemperatur/vattentemperatur-och-kvalitet-pa-badvatten-pa-sydkusten.html' |