Search in sources :

Example 1 with VolatileCookieJar

use of ar.rulosoft.navegadores.VolatileCookieJar in project MiMangaNu by raulhaag.

the class BatoTo method testLogin.

// just log in batoto to store the cookie if all ok
@Override
public boolean testLogin(String user, String password) throws Exception {
    Navigator nav = getNavigatorAndFlushParameters();
    CookieJar ccj = nav.getHttpClient().cookieJar();
    VolatileCookieJar cj = new VolatileCookieJar();
    nav.setCookieJar(cj);
    String data = nav.get(HOST + "/forums/index.php?app=core&module=global&section=login");
    HashMap<String, String> params = Navigator.getFormParamsFromSource(data);
    nav = getNavigatorAndFlushParameters();
    nav.addPost("auth_key", params.get("auth_key"));
    nav.addPost("ips_password", password);
    nav.addPost("ips_username", user);
    nav.addPost("referer", "https://bato.to/forums/");
    nav.addPost("rememberMe", "1");
    nav.post(HOST + "/forums/index.php?app=core&module=global&section=login&do=process");
    List<Cookie> cookies = Navigator.getCookieJar().loadForRequest(HttpUrl.parse("https://bato.to"));
    nav.setCookieJar(ccj);
    return cj.contain("member_id");
}
Also used : Cookie(okhttp3.Cookie) Navigator(ar.rulosoft.navegadores.Navigator) VolatileCookieJar(ar.rulosoft.navegadores.VolatileCookieJar) CookieJar(okhttp3.CookieJar) VolatileCookieJar(ar.rulosoft.navegadores.VolatileCookieJar)

Aggregations

Navigator (ar.rulosoft.navegadores.Navigator)1 VolatileCookieJar (ar.rulosoft.navegadores.VolatileCookieJar)1 Cookie (okhttp3.Cookie)1 CookieJar (okhttp3.CookieJar)1