读书人

android中jsoup解析html的几个事例

发布时间: 2012-07-27 11:03:00 作者: rapoo

android中jsoup解析html的几个例子

1.获取百度所有链接的例子(通过ID):

?2.获取news.cqu.edu.cn中class为topnews 的新闻标题。

Connection.Response res = Jsoup.connect("http://www.jwc.cqu.edu.cn/login.asp").data("username", "000","password", "000").method(Method.POST).execute();Map<String, String> cookies = res.cookies();//如果需要 Document doc1 = res.parse();Connection connection = Jsoup.connect("http://www.jwc.cqu.edu.cn/PlanAndCurriculum/cour_tab_sel_stud.ASP");for (Entry<String, String> cookie : cookies.entrySet()) {connection.cookie(cookie.getKey(), cookie.getValue());}Document doc = connection.get();

?

读书人网 >CSS

热点推荐