我想直接从给定的URL =“https://stooq.pl/q/d/l/?s=alr&d1=20190404&d2=20190411&i=d”下载csv文件
当我在chrome explorer中运行它时,我得到了下载数据的csv文件。但是当我用R代码运行时,我得到EMPTY csv文件下载。
url = "https://stooq.pl/q/d/l/?s=alr&d1=20190404&d2=20190411&i=d"
download.file(url)
预期:带有数据的文件
结果:EMPTY FILE Content type 'text/html' length 0 bytes downloaded 0 bytes
打开主页stooq.pl从浏览器和R开始伎俩试试这个:
url <- 'https://stooq.pl/q/d/l/?s=alr&d1=20190404&d2=20190411&i=d/alr_d.csv'
download.file('https://stooq.pl' , 'new.txt')
download.file(url, 'alr_d.csv')