@Override public void run() throws Exception { super.run(); logger.info("Starting download in TASK " + fileURL); final GetMethod method = getGetMethod(fileURL); // create GET request if (makeRedirectedRequest(method)) { checkProblems(); checkNameAndSize(); final String action = getMethodBuilder().setActionFromImgSrcWhereTagContains("thepic").getAction(); final String s = new URI(encode(fileURL)).resolve(action).toURL().toExternalForm(); logger.info("Link " + s); final HttpMethod httpMethod = getMethodBuilder().setAction(s).toHttpMethod(); // here is the download link extraction if (!tryDownloadAndSaveFile(httpMethod)) { checkProblems(); logger.warning(getContentAsString()); // log the info throw new PluginImplementationException(); // unknown problem } } else { checkProblems(); throw new PluginImplementationException(); } }
@Override public void runCheck() throws Exception { super.runCheck(); final GetMethod getMethod = getGetMethod(fileURL); if (makeRedirectedRequest(getMethod)) { checkProblems(); checkNameAndSize(); } else { checkProblems(); throw new PluginImplementationException(); } }
@Override public void runCheck() throws Exception { // this method validates file super.runCheck(); final GetMethod getMethod = getGetMethod(fileURL); // make first request if (makeRedirectedRequest(getMethod)) { checkProblems(); checkNameAndSize(getContentAsString()); // ok let's extract file name and size from the page } else { checkProblems(); throw new ServiceConnectionProblemException(); } }
@Override public void runCheck() throws Exception { checkUrl(); super.runCheck(); final HttpMethod method = getGetMethod(fileURL); if (makeRedirectedRequest(method)) { checkProblems(); checkNameAndSize(); } else { checkProblems(); throw new ServiceConnectionProblemException(); } }
@Override public void run() throws Exception { super.run(); logger.info("Starting download in TASK " + fileURL); final String songToken = getSongToken(); getPreload(); final String communicationToken = getCommunicationToken(); final String songId = getSongIdFromSongToken(communicationToken, songToken); final HttpMethod method = getStreamKeyFromSongId(communicationToken, songId); if (!tryDownloadAndSaveFile(method)) { throw new ServiceConnectionProblemException("Error starting download"); } }
@Override public void run() throws Exception { super.run(); logger.info("Starting download in TASK " + fileURL); login(); final GetMethod method = getGetMethod(RD_GENERATE); if (makeRedirectedRequest(method)) { // we make the main request checkProblems(); // check problems final HttpMethod postMethod = getMethodBuilder() .setAction(RD_GENERATE) .setParameter("link", fileURL) .setParameter("password", "") .setParameter("remote", "0") .setParameter("time", "" + System.currentTimeMillis()) .setBaseURL(RD_BASE_URL) .setReferer(RD_BASE_URL) .toGetMethod(); postMethod.addRequestHeader("X-Requested-With", "XMLHttpRequest"); if (!makeRequest(postMethod)) { throw new ServiceConnectionProblemException("Error posting login info"); } final String content = getContentAsString(); checkRequest(content); httpFile.setFileName(PlugUtils.getStringBetween(content, "file_name\":\"", "\",")); final String dlLink = PlugUtils.getStringBetween(content, "main_link\":\"", "\","); final String genLinks = PlugUtils.getStringBetween(content, "generated_links\":[[", "]],"); final Matcher match = PlugUtils.matcher("\"(.+?)\",\"(.+?)\",\"(.+?)\"", genLinks); while (match.find()) { if (match.group(3).equals(dlLink)) { httpFile.setFileName(match.group(1)); break; } } final HttpMethod dlMethod = getGetMethod(dlLink.replace("\\", "")); if (!tryDownloadAndSaveFile(dlMethod)) { checkProblems(); // if downloading failed throw new ServiceConnectionProblemException( "Error starting download"); // some unknown problem } } else { checkProblems(); throw new ServiceConnectionProblemException(); } }
@Override public void run() throws Exception { super.run(); logger.info("Starting download in TASK " + fileURL); checkUrl(); login(); HttpMethod method = getGetMethod(fileURL); if (makeRedirectedRequest(method)) { checkProblems(); checkNameAndSize(); if (isFolder()) { parseFolder(); } else { method = getMethodBuilder() .setReferer(fileURL) .setActionFromTextBetween("<a id=\"btnLink\" href=\"", "\"") .toGetMethod(); if (!method.getURI().toString().contains("/download/")) { if (makeRedirectedRequest(method)) { checkProblems(); method = getMethodBuilder() .setReferer(method.getURI().toString()) .setActionFromAHrefWhereATagContains("Download file") .toGetMethod(); downloadTask.sleep( PlugUtils.getNumberBetween( getContentAsString(), "id=\"secondsLeft\" value=\"", "\"") + 1); } else { checkProblems(); throw new ServiceConnectionProblemException(); } } if (!tryDownloadAndSaveFile(method)) { checkProblems(); throw new ServiceConnectionProblemException("Error starting download"); } } } else { checkProblems(); throw new ServiceConnectionProblemException(); } }
@Override public void run() throws Exception { super.run(); logger.info("Starting download in TASK " + fileURL); final GetMethod method = getGetMethod(fileURL); // create GET request if (makeRedirectedRequest(method)) { // we make the main request checkProblems(); // check problems checkNameAndSize(getContentAsString()); if (!tryDownloadAndSaveFile( getGetMethod( PlugUtils.getStringBetween( getContentAsString(), "<div id=\"image\"><center><a href=\"", "\" class")))) { checkProblems(); // if downloading failed throw new ServiceConnectionProblemException( "Error starting download"); // some unknown problem } } else { checkProblems(); throw new ServiceConnectionProblemException(); } }
@Override public void run() throws Exception { super.run(); logger.info("Starting download in TASK " + fileURL); final GetMethod method = getGetMethod(fileURL); // create GET request if (makeRedirectedRequest(method)) { // we make the main request final String contentAsString = getContentAsString(); // check for response checkProblems(); // check problems checkNameAndSize(contentAsString); // extract file name and size from the page HttpMethod httpMethod = getGetMethod( PlugUtils.getStringBetween(contentAsString, "<a href=\"", "\">Download movie")); if (!makeRedirectedRequest(httpMethod)) { checkProblems(); throw new ServiceConnectionProblemException("Error getting download link"); } httpMethod = getGetMethod( PlugUtils.getStringBetween( getContentAsString(), "href=\"", "\"> Click here to download")); Matcher match = PlugUtils.matcher("href=\".+(\\.\\w{3})\"> Click here to download", getContentAsString()); if (!match.find()) { throw new ErrorDuringDownloadingException("Error getting file type"); } httpFile.setFileName(httpFile.getFileName() + match.group(1)); // here is the download link extraction if (!tryDownloadAndSaveFile(httpMethod)) { checkProblems(); // if downloading failed throw new ServiceConnectionProblemException( "Error starting download"); // some unknown problem } } else { checkProblems(); throw new ServiceConnectionProblemException(); } }
@Override public void run() throws Exception { checkUrl(); super.run(); logger.info("Starting download in TASK " + fileURL); HttpMethod method = getGetMethod(fileURL); if (makeRedirectedRequest(method)) { checkProblems(); checkNameAndSize(); final Matcher matcher = getMatcherAgainstContent("href='(.+?)' target='hidden-frame'"); if (!matcher.find()) { throw new PluginImplementationException("Download link not found"); } setFileStreamContentTypes("text/plain"); method = getMethodBuilder().setReferer(fileURL).setAction(matcher.group(1)).toGetMethod(); if (!tryDownloadAndSaveFile(method)) { checkProblems(); throw new ServiceConnectionProblemException("Error starting download"); } } else { checkProblems(); throw new ServiceConnectionProblemException(); } }
@Override public void run() throws Exception { super.run(); logger.info("Starting download in TASK " + fileURL); setPageEncoding("GBK"); HttpMethod method = getGetMethod(fileURL); if (makeRedirectedRequest(method)) { checkProblems(); checkNameAndSize(); final Matcher matcher = getMatcherAgainstContent("iid\\s*=\\s*(\\d+)"); if (!matcher.find()) { throw new PluginImplementationException("iid not found"); } setPageEncoding("UTF-8"); method = getGetMethod( "http://v2.tudou.com/v2/kili?safekey=IAlsoNeverKnow&id=" + matcher.group(1) + "&noCatch=" + new Random().nextInt(100000)); if (makeRedirectedRequest(method)) { final String url = getStreamUrl(); method = getGetMethod(url); if (!tryDownloadAndSaveFile(method)) { checkProblems(); throw new ServiceConnectionProblemException("Error starting download"); } } else { checkProblems(); throw new ServiceConnectionProblemException(); } } else { checkProblems(); throw new ServiceConnectionProblemException(); } }