Yahoo Finance历史数据下载器URL不起作用 [英] Yahoo Finance Historical data downloader url is not working

查看:388
本文介绍了Yahoo Finance历史数据下载器URL不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已使用以下网址从Yahoo Finance获取历史数据。从2017年5月16日起,该网址无效。

I have used the following url to fetch the historical data from yahoo finance. From last 16th May, 2017 the url is not working.

http:// real-chart .finance.yahoo.com / table.csv?s = AAL& a = 04& b = 01& c = 2017& d = 04& e = 02& f = 2017& g = d& ignore = .csv

似乎他们已经更改了网址,而新的网址是:

Seems like they have changed the url and the new url is:

https:// query1 .finance.yahoo.com / v7 / finance / download / AAL?period1 = 1494873000& period2 = 1494959400& interval = 1d& events = history& crumb = l0aEtuOKocj

在上面更改的URL中有一个会话cookie,它很碎。有任何想法如何以编程方式(在JAVA中)获取此Cookie?

In the above changed URL has a session cookie which is crumb. Is there any idea how to get this cookie programmatically(in JAVA)?

推荐答案

让它正常工作,现在我只需要解析csv。以为我会在语法遇到麻烦时就分享一下。

Got it to work, now I just have to parse the csv. Thought I'd share since I was having trouble with the syntax.

Dim crumb As String:    crumb = "xxxx"
Dim cookie As String:   cookie = "yyyy"

Dim urlStock As String: urlStock = "https://query1.finance.yahoo.com/v7/finance/download/SIRI?" & _
    "period1=1274158800&" & _
    "period2=1495059477&" & _
    "interval=1d&events=history&crumb=" & crumb

Dim http As MSXML2.XMLHTTP:   Set http = New MSXML2.ServerXMLHTTP
http.Open "GET", urlStock, False
http.setRequestHeader "Cookie", cookie
http.send

这篇关于Yahoo Finance历史数据下载器URL不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆