private String setupAuthentication(String response) throws IOException, URISyntaxException { isStartup = false; // Pattern pattern = Pattern.compile("Auth=(?<AUTH>(.*?))$", Pattern.CASE_INSENSITIVE); // String auth = pattern.matcher(EntityUtils.toString(response.getEntity())).group(); int startIndex = response.indexOf("Auth=") + "Auth=".length(); int endIndex = response.indexOf("\n", startIndex); authorizationToken = response.substring(startIndex, endIndex).trim(); return dispatchPost( new URI("https://play.google.com/music/listen?hl=en&u=0"), FormBuilder.getEmpty()); }