【转载保存】Java丨jsoup网络爬虫登录得到cookie并带上cookie访问

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/dreamzuora/article/details/83591077

优秀文章:https://blog.csdn.net/wisdom_maxl/article/details/65631825
jsoup使用cookie:

		Set<Cookie> cookie_set = LoadCSDN.load();
//		WebClient wc = new WebClient();
		HashMap<String, String> map = new HashMap<String,String>();
		for (Cookie cookie : cookie_set) {
			map.put(cookie.getName(), cookie.getValue());
//			wc.getCookieManager().addCookie(cookie);
		}
		Document doc = Jsoup.connect(url).cookies(map).get();

猜你喜欢

转载自blog.csdn.net/dreamzuora/article/details/83591077
今日推荐