Java Jaunt webcrawler-无法访问谷歌搜索结果的下一页 import com.jaunt.*; 公共类爬虫{ 公共静态void main(字符串[]args){ 试一试{ UserAgent UserAgent=new UserAgent();//创建新的UserAgent(无头浏览器) userAgent.visit(“http://google.de“”;//访问谷歌 userAgent.doc.apply(“schmetterlinge”);//应用表单输入(从第一个可编辑字段开始) userAgent.doc.submit();//单击标签为“谷歌搜索”的提交按钮 Elements links=userAgent.doc.findEvery(“”)。findEvery(“”;//查找搜索结果链接 for(Element link:links)System.out.println(link.getAt(“href”);//打印结果 if(userAgent.doc.nextPageLinkExists()){ userAgent.visit(userAgent.doc.nextPageLink().getHref()); Elements newlinks=userAgent.doc.findEvery(“”)。findEvery(“”); System.out.println(“\n第2页:”); 对于(元素链接:newlinks)System.out.println(link.getAt(“href”); } } catch(JauntException e){//如果发生HTTP/连接错误,请处理JauntException。 系统错误println(e); } } }

Java Jaunt webcrawler-无法访问谷歌搜索结果的下一页 import com.jaunt.*; 公共类爬虫{ 公共静态void main(字符串[]args){ 试一试{ UserAgent UserAgent=new UserAgent();//创建新的UserAgent(无头浏览器) userAgent.visit(“http://google.de“”;//访问谷歌 userAgent.doc.apply(“schmetterlinge”);//应用表单输入(从第一个可编辑字段开始) userAgent.doc.submit();//单击标签为“谷歌搜索”的提交按钮 Elements links=userAgent.doc.findEvery(“”)。findEvery(“”;//查找搜索结果链接 for(Element link:links)System.out.println(link.getAt(“href”);//打印结果 if(userAgent.doc.nextPageLinkExists()){ userAgent.visit(userAgent.doc.nextPageLink().getHref()); Elements newlinks=userAgent.doc.findEvery(“”)。findEvery(“”); System.out.println(“\n第2页:”); 对于(元素链接:newlinks)System.out.println(link.getAt(“href”); } } catch(JauntException e){//如果发生HTTP/连接错误,请处理JauntException。 系统错误println(e); } } },java,web-crawler,jaunt-api,Java,Web Crawler,Jaunt Api,我想从谷歌返回比第一页更多的搜索结果。因此,循环的第二个基本上应该返回下一页的结果,但它不返回。知道为什么吗?我也遇到了同样的问题。用户代理不会进入下一页,但我找到了另一种实现方法: import com.jaunt.*; public class JauntCrawler{ public static void main(String[] args){ try{ UserAgent userAgent = new UserAgent(); //cre

我想从谷歌返回比第一页更多的搜索结果。因此,循环的第二个
基本上应该返回下一页的结果,但它不返回。知道为什么吗?

我也遇到了同样的问题。用户代理不会进入下一页,但我找到了另一种实现方法:

import com.jaunt.*;
public class JauntCrawler{
  public static void main(String[] args){
    try{
        UserAgent userAgent = new UserAgent();         //create new userAgent (headless browser)
        userAgent.visit("http://google.de");          //visit google
        userAgent.doc.apply("schmetterlinge");            //apply form input (starting at first editable field)
        userAgent.doc.submit();         //click submit button labelled "Google Search"


        Elements links = userAgent.doc.findEvery("<h3 class=r>").findEvery("<a>");  //find search result links
        for(Element link : links) System.out.println(link.getAt("href"));           //print results

        if(userAgent.doc.nextPageLinkExists()) {
            userAgent.visit(userAgent.doc.nextPageLink().getHref());
            Elements newlinks = userAgent.doc.findEvery("<h3 class=r>").findEvery("<a>");
            System.out.println("\nPage 2:");
            for(Element link : newlinks) System.out.println(link.getAt("href"));
        }
    }
    catch(JauntException e){         //if an HTTP/connection error occurs, handle JauntException.
      System.err.println(e);
    }
  }
}

Elements nextLinks=userAgent.doc.findEvery(“由于您正在抓取一个德语Google页面,它不包含文本“page 2”,请在浏览器中运行查询,并查看第一页源代码以找到德语页面2。祝您好运,因为该页面主要是JavaScript调用。我只在控制台上输出此内容;)我不认为这是一个语言问题,你的解决方案工作了10页,直到最后一页才遍历。
Elements nextLinks = userAgent.doc.findEvery("<a class=fl");
        for(int i=0;i<nextLinks.size();i++) {
            userAgent.visit("http://google.co.in/search?q="+<search_string+"&start="+(i+1)*10);
            links = userAgent.doc.findEvery("<h3 class=r>").findEvery("<a>"); 
            for(Element link : links) System.out.println(link.getAt("href"));
        }