Java Web crawl data get space in class

Source: Internet
Author: User

  <ul class= "" >                              <li class= "avatar_img" ></li>                              <li class=" User_name ">HorseRunningNoStop</li>                              <li class=" Time ">2016 year March 16 20:12</li>                              <li class= "Visited_num" ><i class= "icon Iconfont icon-read" ></i><span>418</span></li>                          </ul>

Get class= "icon Iconfont icon-read" on this page

String url= "Requested URL connection";
Document document = NULL;
URL uri = new URL (URL);
Document = Jsoup.connect (URL). Data ("Query", "Java")//Request parameter
. useragent ("mozilla/4.0 (compatible; MSIE 9.0; Windows NT 6.1; trident/5.0)//Set urer-agent get ();
. Timeout (10000)
. get ();
Icon Iconfont icon-read Get the page you need to get the class has several spaces to write several select (Remember to add ". Points)
Elements select = Document.select (". Icon"). Select (". Iconfont"). Select (". Icon-read");
Elements Elementsbyclass = Document.getelementsbyclass ("Recommend_list"). Select ("Clearfix");
SYSTEM.OUT.PRINTLN (select);

Java Web crawl data get space in class

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.