package bdy2; import java.io.IOException; import java.net.MalformedURLException; import com.gargoylesoftware.htmlunit.BrowserVersion; import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.HtmlPage; public class GouPenn { public static void main(String[] args){ WebClient web = new WebClient(BrowserVersion.FIREFOX_52); HtmlPage page; try { page =web.getPage("https://pan.baidu.com/share/home?uk=990965385&view=share#category/type=0"); // 等待10秒等待 百度云加载完成 赋值到js,然后开始抓取 Thread.sleep(10000); System.err.println("=======================请求内容开始:======================="); System.out.println(page.asXml()); System.err.println("=======================请求内容结束:======================="); } catch (FailingHttpStatusCodeException e) { e.printStackTrace(); } catch(MalformedURLException e){ e.printStackTrace(); } catch(IOException e){ e.printStackTrace(); } catch(InterruptedException e){ e.printStackTrace(); }finally { web.close(); } } }
最近下载更多