@Override public void run() { try { if (streaminAccount.loginsuccessful) { userType = "reg"; httpContext = streaminAccount.getHttpContext(); sessionID = CookieUtils.getCookieValue(httpContext, "xfsts"); maxFileSizeLimit = 2147483648l; // 2048MB (2GB) } else { host = "streamin.to"; uploadInvalid(); return; } addExtensions(); // Check extension if (!FileUtils.checkFileExtension(allowedVideoExtensions, file)) { throw new NUFileExtensionException(file.getName(), host); } if (file.length() > maxFileSizeLimit) { throw new NUMaxFileSizeException(maxFileSizeLimit, file.getName(), host); } uploadInitialising(); initialize(); httpPost = new NUHttpPost(uploadURL); MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); mpEntity.addPart("upload_type", new StringBody("file")); mpEntity.addPart("sess_id", new StringBody(sessionID)); mpEntity.addPart("srv_tmp_url", new StringBody("http://5.79.69.179:8777/tmp")); mpEntity.addPart("srv_id", new StringBody(sv_id)); mpEntity.addPart("disk_id", new StringBody(disk_id)); mpEntity.addPart("file_public", new StringBody("0")); mpEntity.addPart("tos", new StringBody("1")); mpEntity.addPart("file", createMonitoredFileBody()); mpEntity.addPart("submit_btn", new StringBody("Upload!")); httpPost.setEntity(mpEntity); NULogger.getLogger().log(Level.INFO, "executing request {0}", httpPost.getRequestLine()); NULogger.getLogger().info("Now uploading your file into Streamin.to"); uploading(); httpResponse = httpclient.execute(httpPost, httpContext); responseString = EntityUtils.toString(httpResponse.getEntity()); doc = Jsoup.parse(responseString); final String fn = doc.select("textarea[name=fn]").first().text(); // Read the links gettingLink(); httpPost = new NUHttpPost("http://streamin.to"); List<NameValuePair> formparams = new ArrayList<NameValuePair>(); formparams.add(new BasicNameValuePair("fn", fn)); formparams.add(new BasicNameValuePair("op", "upload_result")); formparams.add(new BasicNameValuePair("st", "OK")); UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8"); httpPost.setEntity(entity); httpResponse = httpclient.execute(httpPost, httpContext); responseString = EntityUtils.toString(httpResponse.getEntity()); // FileUtils.saveInFile("Streamin.html", responseString); doc = Jsoup.parse(responseString); downloadlink = doc.select("textarea").first().val(); // Streamin.to don't provide the delete link deletelink = UploadStatus.NA.getLocaleSpecificString(); NULogger.getLogger().log(Level.INFO, "Delete link : {0}", deletelink); NULogger.getLogger().log(Level.INFO, "Download link : {0}", downloadlink); downURL = downloadlink; delURL = deletelink; uploadFinished(); } catch (NUException ex) { ex.printError(); uploadInvalid(); } catch (Exception e) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, e); uploadFailed(); } }
@Override public void run() { try { if (slingFileAccount.loginsuccessful) { host = slingFileAccount.username + " | SlingFile.com"; httpContext = slingFileAccount.getHttpContext(); } else { host = "SlingFile.com"; cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); } if (file.length() > fileSizeLimit) { throw new NUMaxFileSizeException( fileSizeLimit, file.getName(), slingFileAccount.getHOSTNAME()); } uploadInitialising(); initialize(); httpPost = new NUHttpPost(postURL); MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); mpEntity.addPart("X-Progress-ID", new StringBody(progressID)); mpEntity.addPart("uFileID", new StringBody(progressID)); mpEntity.addPart("uid", new StringBody(encUserID)); if (slingFileAccount.loginsuccessful) { mpEntity.addPart("folderid", new StringBody("0")); } mpEntity.addPart("ssd", new StringBody(ssd)); mpEntity.addPart("Filename", new StringBody(file.getName())); mpEntity.addPart("name", new StringBody(file.getName())); mpEntity.addPart("Upload", new StringBody("Submit Query")); mpEntity.addPart("file", createMonitoredFileBody()); httpPost.setEntity(mpEntity); NULogger.getLogger().log(Level.INFO, "executing request {0}", httpPost.getRequestLine()); NULogger.getLogger().info("Now uploading your file into slingfile.com"); uploading(); HttpResponse response = httpclient.execute(httpPost, httpContext); stringResponse = EntityUtils.toString(response.getEntity()); if ("done".equals(stringResponse)) { NULogger.getLogger().log(Level.INFO, "upload done!"); gettingLink(); httpGet = new NUHttpGet(URILink); httpResponse = httpclient.execute(httpGet, httpContext); stringResponse = EntityUtils.toString(httpResponse.getEntity()); // FileUtils.saveInFile("SlingFile.com.html", stringResponse); Document doc = Jsoup.parse(stringResponse); downloadlink = doc.select("div#container div#mainContent fieldset table tbody tr td input") .first() .val(); deletelink = doc.select("div#container div#mainContent fieldset table tbody tr td input") .eq(3) .val(); NULogger.getLogger().log(Level.INFO, "Delete link : {0}", deletelink); NULogger.getLogger().log(Level.INFO, "Download link : {0}", downloadlink); downURL = downloadlink; delURL = deletelink; } else { throw new Exception("Upload isn't good."); } uploadFinished(); } catch (Exception e) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, e); uploadFailed(); } }
@Override public void run() { try { if (privateFilesAccount.loginsuccessful) { userType = "reg"; httpContext = privateFilesAccount.getHttpContext(); sessionID = CookieUtils.getCookieValue(httpContext, "xfss"); maxFileSizeLimit = 2147483648L; // 2 GB } else { host = "PrivateFiles.com"; uploadInvalid(); return; } if (file.length() > maxFileSizeLimit) { throw new NUMaxFileSizeException(maxFileSizeLimit, file.getName(), host); } uploadInitialising(); initialize(); long uploadID; Random random = new Random(); uploadID = Math.round(random.nextFloat() * Math.pow(10, 12)); uploadid_s = String.valueOf(uploadID); sess_id = StringUtils.stringBetweenTwoStrings(responseString, "name=\"sess_id\" value=\"", "\""); srv_tmp_url = uploadURL; uploadURL = StringUtils.removeLastChars(uploadURL, 3) + "cgi-bin/upload.cgi?upload_id=" + uploadid_s + "&js_on=1&utype=" + userType + "&upload_type=file"; httpPost = new NUHttpPost(uploadURL); MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); mpEntity.addPart("js_on", new StringBody("1")); mpEntity.addPart("upload_id", new StringBody(uploadid_s)); mpEntity.addPart("upload_type", new StringBody("file")); mpEntity.addPart("utype", new StringBody(userType)); mpEntity.addPart("sess_id", new StringBody(sess_id)); mpEntity.addPart("srv_tmp_url", new StringBody(srv_tmp_url)); mpEntity.addPart("file_0", createMonitoredFileBody()); mpEntity.addPart("file_0_descr", new StringBody("")); mpEntity.addPart("link_rcpt", new StringBody("")); mpEntity.addPart("link_pass", new StringBody("")); mpEntity.addPart("to_folder", new StringBody("")); mpEntity.addPart("file_1", new StringBody("")); mpEntity.addPart("file_0_descr", new StringBody("")); httpPost.setEntity(mpEntity); NULogger.getLogger().log(Level.INFO, "executing request {0}", httpPost.getRequestLine()); NULogger.getLogger().info("Now uploading your file into PrivateFiles.com"); uploading(); httpResponse = httpclient.execute(httpPost, httpContext); responseString = EntityUtils.toString(httpResponse.getEntity()); doc = Jsoup.parse(responseString); // Read the links gettingLink(); upload_fn = doc.select("textarea[name=fn]").val(); if (upload_fn != null) { httpPost = new NUHttpPost("https://www.privatefiles.com/"); List<NameValuePair> formparams = new ArrayList<NameValuePair>(); formparams.add(new BasicNameValuePair("fn", upload_fn)); formparams.add(new BasicNameValuePair("op", "upload_result")); formparams.add(new BasicNameValuePair("st", "OK")); UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8"); httpPost.setEntity(entity); httpResponse = httpclient.execute(httpPost, httpContext); responseString = EntityUtils.toString(httpResponse.getEntity()); doc = Jsoup.parse(responseString); downloadlink = doc.select("textarea").first().val(); deletelink = doc.select("textarea").eq(3).val(); NULogger.getLogger().log(Level.INFO, "Delete link : {0}", deletelink); NULogger.getLogger().log(Level.INFO, "Download link : {0}", downloadlink); downURL = downloadlink; delURL = deletelink; uploadFinished(); } } catch (NUException ex) { ex.printError(); uploadInvalid(); } catch (Exception e) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, e); uploadFailed(); } }