0
雅虎財經最近將其歷史數據網址從http更改爲https。例如,下面是獲得IBM的最大歷史URL(截至今日,2017年5月29日):R:從雅虎財經下載歷史數據
https://query1.finance.yahoo.com/v7/finance/download/IBM?period1=-252345600&period2=1496041200&interval=1d&events=history&crumb=jIIyoewBT2o
當我嘗試從內部RI閱讀資源得到如下:
> url = 'https://query1.finance.yahoo.com/v7/finance/download/IBM?period1=-252345600&period2=1496041200&interval=1d&events=history&crumb=jIIyoewBT2o'
> read.csv(url)
Error in file(file, "rt") :
(converted from warning) cannot open URL 'https://query1.finance.yahoo.com/v7/finance/download/IBM?period1=-252345600&period2=1496041200&interval=1d&events=history&crumb=jIIyoewBT2o': HTTP status was '401 Unauthorized'
當通過瀏覽器手動調用時,下載工作正常,所以它不像Yahoo Finance試圖阻止訪問數據。很顯然,瀏覽器正在向雅虎服務器發送一些祕密的內容。我可以通過R腳本發送相同的祕密醬汁嗎?
檢查[此](https://stackoverflow.com/questions/44083891/started-to-get-error-while-downloading-data-from-yahoo-finance-using-r/)。 – Eldioo
請參閱此鏈接:https://stackoverflow.com/questions/44015838/cant-download-data-from-yahoo-finance-using-quantmod-in-r?noredirect=1&lq=1 – Dave2e