private static void login(Client httpclient) { if (loggedin) return; log.debug("Attempting login"); try { HttpResponse response = httpclient.get(loginUri); EntityUtils.consume(response.getEntity()); log.debug(response); ClientParam[] nvps = new ClientParam[] { new StringParam("action", "login"), new StringParam("retard_protection", "1"), new StringParam("name", props.getProperty("user")), new StringParam("pass", props.getProperty("pass")), new StringParam("login", "Login to FurAffinity") }; response = httpclient.post(loginPostUri, loginHeaders, nvps, Client.PostDataType.UrlEncoded, null); HttpEntity entity = response.getEntity(); EntityUtils.consume(entity); } catch (Exception e) { log.error("Could not log in", e); } }
@Override public boolean canHandle(Uri link, Page page, String mime) { log.debug("CanHandle", link); if (link.getDomain().equalsIgnoreCase("furaffinity.net") && "text/html".equals(mime)) { return true; } return false; }