雅虎财经网络服务消失了吗?API变了?暂时下来? [英] Has Yahoo finance web service disappeared? API changed? Down temporarily?

查看:39
本文介绍了雅虎财经网络服务消失了吗?API变了?暂时下来?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很长一段时间以来,我一直在使用以下 REST API 来查询雅虎财经的当前价格.它记录在多个 Stack Overflow 帖子中,例如雅虎金融网络服务.

For quite some time I've been using the following REST API to query Yahoo finance for current prices. It is documented in several Stack Overflow posts, e.g. Yahoo finance webservice and elsewhere in yahoo-finance.

http://finance.yahoo.com/webservice/v1/symbols/$SYMBOLS/quote?format=json

其中 $SYMBOLS 是以逗号分隔的股票或指数符号列表.

where $SYMBOLS is a comma-delimited list of stock or index symbols.

昨天查询停止工作,只返回暂时移动.重定向到..."消息.

Yesterday the query stopped working, returning only a "Moved Temporarily. Redirecting to ..." message.

这个网络服务现在关闭了吗?是否已被 YQL 或其他 API 取代?查询历史价格表以ichart"仍然有效.例如,

Is this web service now closed? Has it been replaced by YQL or another API? Queries for a table of historic prices to "ichart" still work. E.g.,

http://ichart.finance.yahoo.com/table.csv?d=2&e=3&f=2016&g=d&a=0&b=1&c=2011&ignore=.csv&s=$SYMBOL

谢谢.

推荐答案

我在过去 2-3 天遇到了类似的问题.该网址适用于智能手机,在桌面上会出现无效参数"错误和 HTTP 代码 406.

I was facing a similar issue from last 2-3 days. The url works on the smartphone, where on the desktop it gives "Not a valid parameter" error and HTTP Code 406.

这可以通过将用户代理添加为Mozilla/5.0 (Linux; Android 6.0.1; MotoG3 Build/MPI24.107-55) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36" 在调用 get 请求时.

This can be resolved by adding user agent as "Mozilla/5.0 (Linux; Android 6.0.1; MotoG3 Build/MPI24.107-55) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36" while invoking the get request.

例如,如果您在 php 中从 curl 下载,请按如下方式使用:

For example, if you are downloading from curl in php use as follows:

curl_setopt($session,CURLOPT_USERAGENT,"Mozilla/5.0 (Linux; Android 6.0.1; MotoG3 Build/MPI24.107-55) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36");

我希望这能解决问题.

这篇关于雅虎财经网络服务消失了吗?API变了?暂时下来?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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