Jsoup获取页面数据报错

琐碎 寻梦 5年前 (2019-11-17) 483次浏览 0个评论 扫描二维码

问题 1

org.jsoup.UnsupportedMimeTypeException: 
Unhandled content type. Must be text/*, application/xml, or application/xhtml+xml. Mimetype=application/json;charset=UTF-8, URL=

解决 1

添加.ignoreContentType(true)
例:
.ignoreContentType(true).timeout(3000).execute();

问题 2

获取json数据,restful接口

Element body = doc.body();JSONObject 
json = JSONObject.fromObject(body.text());
喜欢 (0)
[支付宝扫码,感谢支持]
分享 (0)
关于作者:

您必须 登录 才能发表评论!