05.04.2023, 09:38
Try this:
Code:
url = 'https://www.havochvatten.se/badplatser-och-badvatten/vattenprov-badtemperatur/vattentemperatur-och-kvalitet-pa-badvatten-pa-sydkusten.html'
data = require('socket.http').request(url)
lines = data:split('\n')
for _, line in ipairs(lines) do
if line:find('<tr><td headers="head11">') then
location = line:match('<tr><td headers="head11">([^,]+)')
watertemp = tonumber(line:match('<td headers="head13">([^ ]+).+</td>'))
airtemp = tonumber(line:match('<td headers="head14">([^ ]+).+</td>'))
location = location:gsub('­', '')
log(location, watertemp, airtemp)
end
end