解决方案 »
- js时间效果name属性修改方法?在线求解
- 连接oracle错误 ....
- 请问tomcat5.0能否在winxp中使用?
- <jsp:doBody>这个标记的实际作用是?
- 做一个网上象棋的N种思路
- spring 源码编译错误
- jsp中与mysql连接是出现的问题,高手帮忙
- 100分询问visualAge for java 大虾过来看看
- 有关TOMCAT中类库的存放路径,问题很菜,请不吝指点?在线等待。
- 请教一个关于struts2的ModelDriven的变量名问题
- 百度的登陆窗口是怎么获取的?
- 关于<@ page contentType="application/vnd.ms-excel;charset=GBK"%>
是上面的url 吗? 需要哪些获取那些内容
<div class="mod_search_list mod_search_list_zhai ">
<ul class="clearfix" id="itemSearchList">
<li class="search_item" id="producteg_16081" data-tcd="5.90871" data-tcs="3.0" >
<!-- s 电器类标题hover3行显示,添加class:electrical_item_box-->
itemSearchList 下面的数据是 js 加载出来的。你获取的是html 不是最后 js 生成的数据。
Document doc = Jsoup.connect("http://list.yhd.com/c5140-0-81016/b/a-s1-v0-p1-price-d0-f0-m1-rt0-pid-mid0-k/").get();
Elements es= doc.getElementById("itemSearchList").getElementsByTag("li");
String price="";
String name="";
String cj="";
String positiveRatio="";
for (org.jsoup.nodes.Element e : es) {
price=e.getElementsByAttribute("yhdprice").html().replaceAll("<.*?>", "").replace("¥", "¥");
name=e.getElementsByAttribute("singlefreeflag").html().replaceAll("<.*[^>]>(.*?)</.*?>", "$1");
cj=e.getElementsByClass("cj").get(0).html().replaceAll("<.*?>", "");
if(e.getElementsByClass("positiveRatio").size()>0)
positiveRatio=e.getElementsByClass("positiveRatio").get(0).html().replaceAll("<.*?>", "");
System.out.println(name+"-------------"+price+"-------------"+cj+"-------------"+positiveRatio);
}