我无法通过 ftp 从此 html 文件中获取 html 文本。我使用漂亮的汤通过 http/https 读取 html 文件,但由于某种原因,我无法从 ftp 下载/读取。请帮忙!
这是网址。 一条链接
到目前为止,这是我的代码。
BufferedReader reader = null;
String total = "";
String line;
ur = "ftp://ftp.legis.state.tx.us/bills/832/billtext/html/house_resolutions/HR00001_HR00099/HR00014I.htm"
try {
URL url = new URL(ur);
URLConnection urlc = url.openConnection();
InputStream is = urlc.getInputStream(); // To download
reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
while ((line = reader.readLine()) != null)
total += reader.readLine();
} finally {
if (reader != null)
try { reader.close();
} catch (IOException logOrIgnore) {}
}