How do I download a data-file from a link which has a data-confirm-modal?
3 次查看(过去 30 天)
显示 更早的评论
Hi
I'm having trouble downloading a csv file from a webpage using the webread function. To manually download the data-file from the webpage, the user needs to click thru a confirmation pop-up box and I suspect this causing me problems. The data confirmation pop-up box shown below. The webpage coding is also shown.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/291406/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/291407/image.png)
My Matlab code attempt is below along with the resultant error:
options=weboptions('Username','redacted','Password','redacted','Timeout',Inf,'ContentType','text');
test2 = webread('https://midnorthmesonet-api.taindata.com/admin/sites/29/download_csv_data',options);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/291408/image.png)
I've trialled the webread function on a data-file from the Bureau of Meteorology and it works fine (code below). And I can also successfully use webread to read the 'https://midnorthmesonet-api.taindata.com/admin/sites' webpage so I think the username and password is fine. I'm assuming I need another QueryName and QueryValue pair to deal with the pop-up, but I can't find any info about this. Any tips would be much appreciated!
options = weboptions('ContentType','text');
test1 = webread('http://www.bom.gov.au/fwo/IDS60801/IDS60801.94681.axf',options);
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!