Jsoup cookie authentication from cookiesyncmanager to scrape from https site

℡╲_俬逩灬. 提交于 2019-12-04 17:33:27
ollo

I'm not an android developer but maybe you can try something like this:

final String url = "https://need.authentication.com";


// -- Android Cookie part here --
CookieSyncManager.getInstance().sync();
CookieManager cm = CookieManager.getInstance();

String cookie = cm.getCookie(url); // returns cookie for url

// ...

// -- JSoup part here --
// Jsoup uses cookies as "name/value pairs"
doc = Jsoup.connect("https://need.authentication.com").header("Cookie", cookie).get();

// ...

I hope this helps a bit, but as i said before: im no android developer (and code isn't tested!)

Here's some documentation:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!