日期:2014-05-20 浏览次数:20760 次
package com.joup;
import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
public class Taodake {
private static String url="http://www.taodake.com/HistoryList_all_";
private static int start_page = 1;
private static int last_page = 10;
public static void main(String[] args){
Document doc = null;;
for(int i=start_page;i<last_page;i++){
try {
doc = Jsoup.connect(url+i+".html").get();
} catch (IOException e) {
System.out.println("第"+i+"页异常");
e.printStackTrace();
}
TaoThread tao = new TaoThread(doc);
tao.start();
}
}
}
package com.joup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
public class TaoThread extends Thread{
private Document doc;
public TaoThread() {
}
public TaoThread(Document doc) {
this.doc = doc;
}
@Override
public void run() {
Elements ids = doc.getElementsByClass("id_td");
for(Element id:ids){
System.out.println("取出id:"+id.text());
}
}
}