public AppAnnieCrawlerJava(String application, String store, String rankType, AuthObject auth) throws ParsingException { url = "http://www.appannie.com/app/" + (store.equals("appstore") ? "ios" : store) + "/" + application.replaceAll(" ", "-").toLowerCase() + "/ranking/#view=" + rankType + "&date="; WebClient webClient = buildWebClient(); HtmlPage page = null; try { page = webClient.getPage("https://www.appannie.com/account/login/"); } catch (IOException e) { e.printStackTrace(); // todo: throw exception } HtmlForm form = page.getFormByName(""); // authentication try { form.getInputByName("username").setValueAttribute(auth.username()); } catch (Throwable t) { throw new ParsingException( "Login form incorrect! Please check " + getClass().getName() + " for errors."); } try { form.getInputByName("password").setValueAttribute(auth.password()); } catch (Throwable t) { throw new ParsingException( "Login form incorrect! Please check " + getClass().getName() + " for errors."); } try { form.getButtonByName("").click(); } catch (IOException e) { throw new ParsingException( "Login form incorrect! Please check " + getClass().getName() + " for errors."); } cookieManager = webClient.getCookieManager(); }