websave() adds '.html' to file even though the file extension is specified.

조회 수: 21 (최근 30일)
ScubaNinjaDog
ScubaNinjaDog 2023년 1월 9일
댓글: Raine Stone 2024년 1월 23일
This question has been asked before https://www.mathworks.com/matlabcentral/answers/525706-websave-adds-html-to-file-name . However, this person's error was not adding the file extension to the name of the file to be downloaded. I am doing that in this case. The website is 'https://cddis.nasa.gov/archive/gnss/data/hourly/2023/008/19/AMC400USA_R_20230081900_01H_GN.rnx.gz' and the filename is 'AMC400USA_R_20230081900_01H_GN.rnx.gz'. When I call websave() it adds the HTML extension.
url='https://cddis.nasa.gov/archive/gnss/data/hourly/2023/008/19/AMC400USA_R_20230081900_01H_GN.rnx.gz'
fname = 'AMC400USA_R_20230081900_01H_GN.rnx.gz'
websave(fname,url)
The downloaded file is 'AMC400USA_R_20230081900_01H_GN.rnx.gz.html'. I have tried gunzip(url) because the file is GNU compressed but the downloaded file is just an HTML doc without the .gz extension.

답변 (1개)

Walter Roberson
Walter Roberson 2023년 1월 9일
It is the login page. You need to create weboptions with your username and password and pass those to websave() after the url. (There might be additional steps as well; I do not have an account there to test it myself.)
  댓글 수: 2
ScubaNinjaDog
ScubaNinjaDog 2023년 1월 9일
Hi. The only reason I didn't need to do that originally is becuase I was already logged in to the website. I cleared my brower cache and cookies and created the weboptions structure, and the result was the same. You are more than welcome to try this yourself with the username and password below as the account has no personal information on it. The data is available to anyone and not restricted. You just have to have an account.
url='https://cddis.nasa.gov/archive/gnss/data/hourly/2023/008/19/AMC400USA_R_20230081900_01H_GN.rnx.gz'
fname = 'AMC400USA_R_20230081900_01H_GN.rnx.gz'
options = weboptions('Username','sissonn@my.erau.edu','Password','P@$$w0rD');
websave(fname,url,options)
Raine Stone
Raine Stone 2024년 1월 23일
I have the same quesqion, do you solve it?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by