package GouPenn; import java.io.IOException; import java.net.MalformedURLException; import org.apache.http.util.EntityUtils; import com.gargoylesoftware.htmlunit.BrowserVersion; import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.HtmlPage; public class MuYouGou1 { public static void main(String[] args){ WebClient web = new WebClient(BrowserVersion.FIREFOX_52); HtmlPage page; try { page =web.getPage("https://pan.baidu.com/disk/home?errno=0&errmsg=Auth%20Login%20Sucess&&bduss=&ssnerror=0#list/path=%2F&vmode=list"); // 等待30秒等待 百度云加载完成 赋值到js,然后开始抓取 Thread.sleep(30000); 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(); } } }
最近下载更多