Jsoup获取cookies

抓取网页数据cookie获取

一、jsoup获取cookie

Map cookies = null;

Response res = Jsoup.connect("http://www.baidu.com").timeout(30000).execute();

cookies = res.cookies();

二、Jsoup请求链接 携带cookie

Document doc = null;

doc = Jsoup.connect(url).cookies(cookies).timeout(30000).get();

你可能感兴趣的:(Jsoup获取cookies)