尝试使用R([{https://oceandata.sci.gsfc.nasa.gov/MODIS-Aqua/Mapped/Monthly/4km/sst/][1])列出此https服务器中的所有文件时遇到问题
列出所有文件名后,我想下载最新/最新文件
有人可以帮助我吗?
这里是我尝试使用的简码,但仍然无法正常工作
Auction details: 14 December 2016, Pukekohe Park
14 December 2016
Auction details: 17 Feb 2017, Gold Sacs Road
17 Feb 2017
Auction details: Wednesday 27 Apr 1:00 p.m. (On site)(2016)
27 Apr 2016
Auction details: Wednesday 27 Apr 1:00 p.m. (In Rooms - 923 Whangaa Rd, Man)(2016)
27 Apr 2016
Auction details: Wed 27 Apr 2:00 p.m., 48 Viaduct Harbour Ave, Auckland, (2016)
27 Apr 2016
Auction details: November 16 Wednesday 2:00pm at 48 Viaduct Harbour Ave, Auckland(2016)
November 16 2016
Auction details: Thursday, 28th February '19
28th February 19
Auction details: Friday, 1st February '19
1st February 19
Friday 25 Nov 3:00 p.m. (On Site)(2016)
25 Nov 2016
1]:https://oceandata.sci.gsfc.nasa.gov/MODIS-Aqua/Mapped/Monthly/4km/sst/
答案 0 :(得分:1)
以下对我有用:
library(httr)
library(XML)
df <- readHTMLTable(content(GET("https://oceandata.sci.gsfc.nasa.gov/MODIS-Aqua/Mapped/Monthly/4km/sst"), "text"))[[1]]
download.file(paste0("https://oceandata.sci.gsfc.nasa.gov/cgi/getfile/",
tail(df,1)$Filename), tail(df,1)$Filename, mode = "wb")