gpt4 book ai didi

java - 如何使用java下载完整的网页而不用 " "替换部分HTML代码?

转载 作者:行者123 更新时间:2023-12-01 10:16:15 26 4
gpt4 key购买 nike

我一直在编写一些代码,这些代码可以访问网站并将 HTML 代码复制到文本文件中。问题是某些代码被“ ”替换。这是我正在使用的代码:

public void addRecords() throws IOException{

URL google = new URL("Insert Website Here");
BufferedReader in = new BufferedReader(
new InputStreamReader(google.openStream()));

String inputLine;
while ((inputLine = in.readLine()) != null){
System.out.println(inputLine);
z.format("%s \n ", (inputLine));
}
in.close();
}

最佳答案

  1. 将网页读入连续缓冲区。
  2. 替换“ ”与“”。
  3. 写入文本文件。

选项2

  1. 阅读网页(就像您现在一样)。
  2. 获取网页的一行。
  3. 替换“ ”与“”。
  4. 写一行网页内容。
  5. 如果有更多行,请转到步骤 1。

关于java - 如何使用java下载完整的网页而不用 " "替换部分HTML代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35874137/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com