炒股的朋友来帮帮忙,我想抓取收盘价 目前有个需求,需要知道每天的收盘价,想在网上抓数据,但找不到合适的网站,希望炒股的朋友提供些网站,需要稳定一点的,网页好分析的,我只要收盘价就行了,我的数据库里面存了股票代码要求深市和沪市 以及基金 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://quote.stockstar.com/什么都有,看你能不能抓取了。 http://stock.business.sohu.com/q/bc.php?code=600000 <tr><td width=50 class=nati11 align=center>昨收盘</td><td width=100 class=nati11 align=left> 31.04</td></tr>[/code][code=Java]for(int i = 0; i < tickers.length; i++) { BufferedReader in = null; try { String ticker = tickers[i]; String strUrl = "http://stock.business.sohu.com/q/bc.php?code=" + ticker; URL url = new URL(strUrl); in = new BufferedReader( new InputStreamReader( url.openStream())); String inputLine; while ((inputLine = in.readLine()) != null) { if(inputLine.indexOf("昨收盘") != -1) { //get price String price = inputLine.substring(inputLine.lastIndexOf(" ")+6, inputLine.lastIndexOf("</td>")); break; } } } catch (Exception e) { e.printStackTrace(); } finally { try { if(in != null) in.close(); } catch (Exception e) {} }} 目前找到的百度搜狐雅虎都是比较好解析的,其实最好有稳定提供数据源的,解析网页虽然可行但是感觉不靠谱,要用rss就好了. 哈哈,找到rss的话告诉我一下,我也不想解析网页,收费的feed也可以,不贵的话 网页解析有相关的资料没HTMLParser怎么样啊? 我写了个配置模板,有url和正则表达式就行了,大家只管提供网址就ok,最主要不能是ajax异步取的,这样我还要分析它的javascript大网站的js很难分析,有的还压缩过.例如新浪和网易就很难分析. 这个你得找个能给你提供数据接口的网站啊,让他们给你提供个xml就行,不过这好像个人没什么意义,一般公司都是这样和人家合作,你自己从网站抓去实在不好控制 http://www.webxml.com.cn这个提供稳定的XML数据源! 匿名内部类的神奇用法——实现视图机制 java数据库提取答案方法 a c d e ? 求助冒泡程序(我用的是1.6的) 初学者的菜鸟问题。。呵呵。。 如何才能不检查正则表达式? 在j2se中奇怪的if-else判断 请问`~~~~ 君子之交淡若水,我没有多分送给大家了,请别介意。想与各位交个朋友,谁会VRML请留下你的联系方式好吗?还有怎样把自己编写的类导入jbui 求助:请教各位大侠,Timer及TimerTask的使用 IO流? java 取某一日期前30天的日期?
<tr><td width=50 class=nati11 align=center>昨收盘</td><td width=100 class=nati11 align=left> 31.04</td></tr>
[/code]
[code=Java]for(int i = 0; i < tickers.length; i++) {
BufferedReader in = null;
try {
String ticker = tickers[i];
String strUrl = "http://stock.business.sohu.com/q/bc.php?code=" + ticker;
URL url = new URL(strUrl);
in = new BufferedReader( new InputStreamReader( url.openStream())); String inputLine;
while ((inputLine = in.readLine()) != null) {
if(inputLine.indexOf("昨收盘") != -1) {
//get price
String price = inputLine.substring(inputLine.lastIndexOf(" ")+6, inputLine.lastIndexOf("</td>"));
break;
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if(in != null) in.close();
} catch (Exception e) {}
}
}
百度
搜狐
雅虎
都是比较好解析的,其实最好有稳定提供数据源的,解析网页虽然可行但是感觉不靠谱,要用rss就好了.
HTMLParser怎么样啊?