我正在尝试阅读http://www.youm7.com/new3agelrss.asp
使用Java 的 RSS 提要的 RSS 提要 -
Lars Vogel 教程。
我设法使用确切的代码毫无问题地阅读了另一个 rss 提要。
对于这个链接,我得到
服务器返回 HTTP 响应代码:403 用于 URL:http ://www.youm7.com/new3agelrss.asp
根据java.io.IOException: Server returned HTTP response code: 403 for URL我编辑的private InputStream read()
方法如下:
private InputStream read() {
try {
HttpURLConnection httpcon = (HttpURLConnection) url.openConnection();
httpcon.addRequestProperty("User-Agent", "Mozilla/4.76");
return httpcon.getInputStream();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
现在我得到:
服务器返回 HTTP 响应代码:503 用于 URL:http ://www.youm7.com/new3agelrss.asp
即使我可以打开那个 Url 扔网络浏览器!你可以自己试试。请帮忙。我对任何替代方法持开放态度。提前致谢。
笔记:
我在我的 Mac 上安装了两个 RSS 阅读器应用程序。(RSS Notifier 和 RSS Bot)并且都设法读取了该 RSS。