jsoup 可以处理元刷新重定向吗
我在使用 jsoup 时遇到问题,我想做的是从 url 获取文档,该文档将根据元刷新 url 重定向到另一个 url,但该 url 不起作用,以便清楚地解释我是否输入名为 http://www.amerisourcebergendrug.com 将自动重定向到 http://www.amerisourcebergendrug.com/abcdrug/ 取决于元刷新网址,但我的 jsoup 仍然存在使用 http://www.amerisourcebergendrug.com 并且不从 http://www.amerisourcebergendrug.com/abcdrug/
Document doc = Jsoup.connect("http://www.amerisourcebergendrug.com").get();
我也尝试过使用,
Document doc = Jsoup.connect("http://www.amerisourcebergendrug.com").followRedirects(true).get();
但两者都不起作用
任何解决这个问题的方法?
更新: 页面可以使用元刷新重定向方法
I have a problem using jsoup what I am trying to do is fetch a document from the url which will redirect to another url based on meta refresh url which is not working, to explain clearly if I am entering a website url named http://www.amerisourcebergendrug.com which will automatically redirect to http://www.amerisourcebergendrug.com/abcdrug/ depending upon the meta refresh url but my jsoup is still sticking with http://www.amerisourcebergendrug.com and not redirecting and fetching from http://www.amerisourcebergendrug.com/abcdrug/
Document doc = Jsoup.connect("http://www.amerisourcebergendrug.com").get();
I have also tried using,
Document doc = Jsoup.connect("http://www.amerisourcebergendrug.com").followRedirects(true).get();
but both are not working
Any workaround for this?
Update:
The Page may use meta refresh redirect methods
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
更新(不区分大小写且具有良好的容错能力)
正确输出:
旧答案:
您确定它不起作用吗?对我来说:
..正确输出
http://www.ibm.com/us/en/
..Update (case insensitive and pretty fault tolerant)
Outputs correctly:
Old answer:
Are you sure that it isn't working. For me:
.. outputs
http://www.ibm.com/us/en/
correctly..有更好的错误处理和区分大小写的问题
to have a better error handling and case sensitivity problem