有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

web爬虫Java获取web内容跳过中间页以响应到达所需的响应

爪哇 我有一种情况,我必须在表单提交的结果中获取响应的web内容,但b/s有点棘手。流程不像请求和响应那样简单,如下所示

Submit button pressed -> Display page processing wait timer -> Display quick advertisement page -> Display page result.

从“按下提交按钮”开始,我希望有“显示页面结果”的内容,并在两者之间跳过页面

我有这个示例代码,但它只有一种工作方式,即发送请求和接收响应

URL url;
InputStream is = null;
DataInputStream dis;
String line;

try {
    url = new URL("http://stackoverflow.com/");
    is = url.openStream();  // throws an IOException
    dis = new DataInputStream(new BufferedInputStream(is));

    while ((line = dis.readLine()) != null) {
        System.out.println(line);
    }
} catch (MalformedURLException mue) {
     mue.printStackTrace();
} catch (IOException ioe) {
     ioe.printStackTrace();
} finally {
    try {
        is.close();
    } catch (IOException ioe) {
        // nothing to see here
    }
}

有没有java库可以帮我做?提前谢谢


共 (0) 个答案