如何从Java Web应用程序中提取数据?
我需要从 Java Web 应用程序中提取数据。具体来说,我希望从雅虎市场跟踪器中提取实时股票数据。有人可以建议任何方法吗?
I need to extract data from a Java web application. To be specific I am looking to extract real time stock data from yahoo market tracker. Can anyone please suggest any method?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不确定您是否可以从雅虎市场跟踪器中提取数据。即使你可以,你也可能不被允许 - 我看不到任何明显的条款&条件/许可。我认为(虽然我可能是错的,但有人有更好的信息吗?)您需要付费才能访问提供近实时市场数据的 API。
您可以使用基于 HTTP 的 Yahoo 股票报价 API 来获取价格,此处描述< /a>.非常简单,返回一个或多个股票代码的以逗号分隔的属性列表,例如:
http://finance.yahoo.com/d/quotes.csv?s=MSFT&f=snd1l1yr
它可能不够实时,但这可能是你能做的最好的免费。
I'm not sure you can extract the data from Yahoo Market Tracker. Even if you can, you might not be allowed to - I can't see any obvious terms & conditions/licensing. I think (although I could be wrong, anyone got better info?) that you'll need to pay to get access to an API providing near realtime market data.
There is a HTTP-based Yahoo Stock Quote API you could use to get prices, described here. Very simple, returns a comma-separated list of attributes for one or more stock symbols, for example:
http://finance.yahoo.com/d/quotes.csv?s=MSFT&f=snd1l1yr
It might not be realtime enough, but it might be the best you can do for free.
您可以使用光荣的 HTTP 协议来做到这一点。使用您熟悉的任何语言(Java、C#、VB.NET、python、ruby、php)并抓取您要从中获取信息的网站。
You can use glorious HTTP protocol to do that. Use any language you are comfortable with (Java, C#, VB.NET, python, ruby, php) and crawl the website you are trying to get information from.
从您的角度来看,它是一个 Java Web 应用程序或 PHP-one 或静态 html 页面这一事实不会改变任何东西。并不是因为 Java 支持 Web 应用程序,您突然就获得了提取信息的“Java 方式”。
现在,在某些情况下,提供的 API 允许您与网站上的数据进行交互:但 Web 应用程序是否是 Java 应用程序这一事实并不重要。
From your standpoint, the fact that it is a Java Webapp or a PHP-one or static html pages doesn't change anything. It is not because Java is backing the webapp that suddenly you get a "Java-way" to extract the info.
Now in some cases there are APIs provided allowing you to interact with the data present on the website: but once again the fact that the Webapp is a Java one or not bears no importance.