YQL 请求返​​回连接被拒绝

YQL request returning Connection refused

以下 PHP 代码(在 Laravel 上)已经运行了几个月,直到今天,我现在收到 502 错误,指示连接被拒绝:

$url = "https://query.yahooapis.com/v1/public/yql?q=select+%2A+from+yahoo.finance.quotes+where+symbol+in+%28%27YHOO%27%29&format=json&env=%20store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=";

$data = file_get_contents($url);
dd($data);

当我登录 Yahoo Developer Console to test, I'm able to query the public datatables just fine. However, when I attempt to use the console to access any of the community datatables like this 时,返回以下信息(所有社区数据表都会出现此错误):

{
 "error": {
  "lang": "en-US",
  "diagnostics": {
   "url": {
    "execution-start-time": "0",
    "execution-stop-time": "7",
    "execution-time": "7",
    "http-status-code": "502",
    "http-status-message": "Connection refused",
    "content": "http://www.datatables.org/yahoo/finance/yahoo.finance.quotes.xml"
   }
  },
  "description": "No definition found for Table yahoo.finance.quotes"
 }
}

使用不同的 machine/IP 地址,只要我保持匿名,我就可以很好地访问这些社区表。登录 Yahoo Developer Console 后,连接被拒绝消息再次出现。

我怀疑这与 Yahoo 可能将我的 IP 地址列入黑名单或限制我的帐户有关,因为我每天为每只股票 (3,000) 执行一次此脚本运行。

我试图访问错误消息 content node 中引用的 URL,但该站点似乎已关闭。我不确定这个内容节点对 API 是否重要,因为我可以从不同的 IP 地址访问它。

我乐于接受关于如何determine/fix这个问题的建议。

Yahoo 社区表存储在 datatables.org, datatables.org 已关闭;这就是为什么有一个查询问题。

http://www.datatables.org

在其中一个论坛帖子中,一名雅虎员工已确认免费 EOD 数据已终止,并且不会重新引入。查看此 thread 并寻找尼克松的回复。雅虎最近被Verizon收购,肯定是新的方向。

但是,如果您查看 Yahoo 财经页面,CSV 下载 link 可以使用,尽管现在有所不同。它是通过使用身份验证令牌 "crumb" 的新 API 实现的,当您访问该页面时,该令牌 link 被编入 cookie。

我已经整理了一些快速 Python3 代码来通过这个新 API 下载与以前相同的 CSV。请查看 GitHub 项目 yahoo_quote_download