Download file from website without url

2 次查看(过去 30 天)
Hello,
How do I download a file from a website without having a url?
More details:
The file that I want to download is the file you download when you click: 'Ladda ner data för de senaste fyra månaderna (.csv)'.
The problem that I have is that I can't seem to find the url for the download, since you need a url for the command 'webread' I am unable to download the file that I want with Matlab.
So I wonder if anyone knows how I can download the file without a url or if anyone is able to find the url for the download or if it's simply impossible without a url.

采纳的回答

Rik
Rik 2023-9-14
编辑:Rik 2023-9-14
What you need to do, is use the inspection tools of your browser to track the requests your browser makes when downloading a file.
That allows you to extract the URL:
url='https://opendata-download.smhi.se/stream?type=metobs&parameterIds=5&stationId=181970&period=latest-months';
fn = websave('test.csv',url)
fn = '/users/mss.system.oM9snL/test.csv'
contents = fileread(fn);
disp(contents(1:floor(end/20)))
Stationsnamn;Stationsnummer;Stationsnät;Mäthöjd (meter över marken) Esrange;181970;SMHIs stationsnät;2.0 Parameternamn;Beskrivning;Enhet Nederbördsmängd;summa 1 dygn, 1 gång/dygn, kl 06;millimeter Tidsperiod (fr.o.m);Tidsperiod (t.o.m);Höjd (meter över havet);Latitud (decimalgrader);Longitud (decimalgrader) 1977-10-01 00:00:00;1993-12-31 23:59:59;335.0;67.8947;21.0694 1994-01-01 00:00:00;1999-07-01 23:59:59;330.0;67.8947;21.0694 1999-10-01 00:00:00;20
Note that the website clearly doesn't want you to do this, so you should limit what you do.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Downloads 的更多信息

标签

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by