下面列出了org.apache.http.entity.mime.HttpMultipartMode#BROWSER_COMPATIBLE 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private static void fileUpload() throws IOException {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(postURL);
//httppost.setHeader("Cookie", sidcookie+";"+mysessioncookie);
file = new File("h:/UploadingdotcomUploaderPlugin.java");
MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
ContentBody cbFile = new FileBody(file);
mpEntity.addPart("Filename", new StringBody(file.getName()));
mpEntity.addPart("notprivate", new StringBody("false"));
mpEntity.addPart("folder", new StringBody("/"));
mpEntity.addPart("Filedata", cbFile);
httppost.setEntity(mpEntity);
System.out.println("executing request " + httppost.getRequestLine());
System.out.println("Now uploading your file into zippyshare.com");
HttpResponse response = httpclient.execute(httppost);
HttpEntity resEntity = response.getEntity();
System.out.println(response.getStatusLine());
if (resEntity != null) {
uploadresponse = EntityUtils.toString(resEntity);
}
downloadlink=parseResponse(uploadresponse, "value=\"http://", "\"");
downloadlink="http://"+downloadlink;
System.out.println("Download Link : "+downloadlink);
httpclient.getConnectionManager().shutdown();
}
@Test
public void testMultiPartIndividualFileToLarge() throws IOException {
TestHttpClient client = new TestHttpClient();
try {
String uri = DefaultServer.getDefaultServerURL() + "/servletContext/3";
HttpPost post = new HttpPost(uri);
MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
entity.addPart("formValue", new StringBody("myValue", "text/plain", StandardCharsets.UTF_8));
entity.addPart("file", new FileBody(new File(MultiPartTestCase.class.getResource("uploadfile.txt").getFile())));
post.setEntity(entity);
HttpResponse result = client.execute(post);
final String response = HttpClientUtils.readResponse(result);
Assert.assertEquals("EXCEPTION: class java.lang.IllegalStateException", response);
} finally {
client.getConnectionManager().shutdown();
}
}
private static void fileUpload() throws Exception {
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(postURL);
file = new File("/home/vigneshwaran/Documents/TNEB Online Payment 3.pdf");
MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
ContentBody cbFile = new FileBody(file);
mpEntity.addPart("file", cbFile);
httppost.setEntity(mpEntity);
System.out.println("executing request " + httppost.getRequestLine());
System.out.println("Now uploading your file into bayfiles.com");
HttpResponse response = httpclient.execute(httppost);
// HttpEntity resEntity = response.getEntity();
uploadresponse = EntityUtils.toString(response.getEntity());
System.out.println(response.getStatusLine());
// if (resEntity != null) {
// uploadresponse = EntityUtils.toString(resEntity);
// }
//
System.out.println("Upload response : " + uploadresponse);
downloadlink = parseResponse(uploadresponse, "\"downloadUrl\":\"", "\"");
downloadlink = downloadlink.replaceAll("\\\\", "");
deletelink = parseResponse(uploadresponse, "\"deleteUrl\":\"", "\"");
deletelink = deletelink.replaceAll("\\\\", "");
System.out.println("Download link : " + downloadlink);
System.out.println("Delete link : " + deletelink);
}
private void fileUpload() throws Exception {
HttpPost httpPost = new HttpPost(postURL);
MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
mpEntity.addPart("file", createMonitoredFileBody());
httpPost.setEntity(mpEntity);
NULogger.getLogger().log(Level.INFO, "executing request {0}", httpPost.getRequestLine());
uploading();
NULogger.getLogger().info("Now uploading your file into bayfiles.com");
HttpResponse response = httpclient.execute(httpPost);
gettingLink();
uploadresponse = EntityUtils.toString(response.getEntity());
NULogger.getLogger().info(response.getStatusLine().toString());
//
// NULogger.getLogger().log(Level.INFO, "Upload response : {0}", uploadresponse);
jSonOjbject = new JSONObject(uploadresponse);
downloadlink = jSonOjbject.getString("downloadUrl");
deletelink = jSonOjbject.getString("deleteUrl");
NULogger.getLogger().log(Level.INFO, "Download link : {0}", downloadlink);
NULogger.getLogger().log(Level.INFO, "Delete link : {0}", deletelink);
downURL = downloadlink;
delURL = deletelink;
uploadFinished();
}
private static void fileUpload() throws Exception {
DefaultHttpClient httpclient = new DefaultHttpClient();
// int Min = 1, Max = 10;
//Min + (int)(Math.random() * ((Max - Min) + 1))
//1+(int)(Math.random() * ((10 - 1) + 1))
//1+(int)(Math.random() * 10)
// int k = 1 + (int) (Math.random() * 10);a
HttpPut httpput = new HttpPut(SugarSync_File_Upload_URL);
httpput.setHeader("Authorization", auth_token);
// httpput.setHeader("Content-Length", String.valueOf(file.length()));
MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
FileBody bin = new FileBody(file);
reqEntity.addPart("", bin);
httpput.setEntity(reqEntity);
System.out.println("Now uploading your file into sugarsync........ Please wait......................");
System.out.println("Now executing......." + httpput.getRequestLine());
HttpResponse response = httpclient.execute(httpput);
System.out.println(response.getStatusLine());
if (response.getStatusLine().getStatusCode() == 204) {
System.out.println("File uploaded successfully :)");
} else {
throw new Exception("There might be problem with your internet connection or server error. Please try again some after time :(");
}
}
private void fileUpload() throws Exception {
httpPost = new NUHttpPost(postURL);
MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
mpEntity.addPart("Filename", new StringBody(file.getName()));
mpEntity.addPart("Filedata", createMonitoredFileBody());
httpPost.setEntity(mpEntity);
NULogger.getLogger().log(Level.INFO, "executing request {0}", httpPost.getRequestLine());
NULogger.getLogger().info("Now uploading your file into uploaded.net");
uploading();
httpResponse = httpclient.execute(httpPost, httpContext);
gettingLink();
HttpEntity resEntity = httpResponse.getEntity();
NULogger.getLogger().info(httpResponse.getStatusLine().toString());
if (resEntity != null) {
uploadresponse = EntityUtils.toString(resEntity);
}
//
NULogger.getLogger().log(Level.INFO, "Upload response : {0}", uploadresponse);
uploadresponse = uploadresponse.substring(0, uploadresponse.indexOf(","));
// changed to a descriptive/long download link (user-requested-feature) //Paralytic (01-AUG-2014)
downloadlink = "http://uploaded.net/file/" + uploadresponse + "/" + file.getName();
NULogger.getLogger().log(Level.INFO, "Download link : {0}", downloadlink);
downURL = downloadlink;
uploadFinished();
}
private void uploadWithoutLogin() {
try {
if (file.length() > notLogFileSizeLimit) {
showWarningMessage( "<html><b>" + getClass().getSimpleName() + "</b> " + Translation.T().maxfilesize() + ": <b>1GB</b></html>", getClass().getSimpleName());
uploadInvalid();
return;
}
uploadInitialising();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet("http://www.easy-share.com");
httpget.setHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2 GTBDFff GTB7.0");
HttpResponse httpresponse = httpclient.execute(httpget);
EntityUtils.consume(httpresponse.getEntity());
//------------------------------------------------------------
httppost = new HttpPost("http://upload.easy-share.com/accounts/upload_backend/perform/ajax");
httppost.setHeader("User-Agent", "Shockwave Flash");
MultipartEntity requestEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
requestEntity.addPart("Filename", new StringBody(file.getName()));
requestEntity.addPart("Filedata", createMonitoredFileBody());
requestEntity.addPart("Upload", new StringBody("Submit Query"));
httppost.setEntity(requestEntity);
//-------------------------------------------------------------
uploading();
//-------------------------------------------------------------
httpresponse = httpclient.execute(httppost);
String strResponse = EntityUtils.toString(httpresponse.getEntity());
//-------------------------------------------------------------
gettingLink();
downURL = strResponse.substring(strResponse.indexOf("value=\"") + 7);
downURL = downURL.substring(0, downURL.indexOf("\""));
delURL = strResponse.substring(strResponse.lastIndexOf("javascript:;\">") + 14);
delURL = delURL.substring(0, delURL.indexOf("</a>"));
NULogger.getLogger().log(Level.INFO, "Download Link: {0}", downURL);
NULogger.getLogger().log(Level.INFO, "Delete link: {0}", delURL);
uploadFinished();
} catch (Exception ex) {
ex.printStackTrace();
NULogger.getLogger().severe(ex.toString());
uploadFailed();
}
}
@Override
public void run() {
try {
if (filesTwoShareAccount.loginsuccessful) {
userType = "reg";
httpContext = filesTwoShareAccount.getHttpContext();
maxFileSizeLimit = 5368709120L; // 5 GB
} else {
host = "Files2Share.ch";
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);
uploadURL += uploadid_s + "&js_on=1&utype=" + userType + "&upload_type=file";
// http://fs-100.files2share.ch/cgi-bin/upload.cgi?upload_id=552522121092&js_on=1&utype=reg&upload_type=file
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(srv_tmp_url));
mpEntity.addPart("file_0", createMonitoredFileBody());
mpEntity.addPart("file_0_descr", new StringBody("Uploaded via NeembuuUploader"));
mpEntity.addPart("tos", new StringBody("1"));
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 Files2Share.ch");
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("http://files2share.ch/");
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(4).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();
}
}
@Override
public void run() {
try {
if (putStreamAccount.loginsuccessful) {
httpContext = putStreamAccount.getHttpContext();
maxFileSizeLimit = 10485760000L; // 10,000 MB
}
else {
host = "PutStream.com";
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();
long uploadID;
Random random = new Random();
uploadID = Math.round(random.nextFloat() * Math.pow(10,12));
uploadid_s = String.valueOf(uploadID);
uploadURL = uploadURL.replaceAll("upload_id", "X-Progress-ID");
uploadURL += uploadid_s + "&disk_id=" + disk_id;
// http://103.43.94.4/upload/01?upload_id=
// http://103.43.94.4/upload/01?X-Progress-ID=874304335248&disk_id=01
httpPost = new NUHttpPost(uploadURL);
MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
mpEntity.addPart("utype", new StringBody("reg"));
mpEntity.addPart("sess_id", new StringBody(sessionID));
//mpEntity.addPart("srv_tmp_url", new StringBody(srv_tmp_url));
mpEntity.addPart("srv_id", new StringBody(srv_id));
mpEntity.addPart("disk_id", new StringBody(disk_id));
mpEntity.addPart("file", createMonitoredFileBody());
mpEntity.addPart("fakefilepc", new StringBody(file.getName()));
mpEntity.addPart("file_title", new StringBody(removeExtension(file.getName())));
mpEntity.addPart("file_descr", new StringBody("Uploaded via Neembuu Uploader!"));
mpEntity.addPart("file_public", new StringBody("1"));
mpEntity.addPart("file_adult", new StringBody("0"));
mpEntity.addPart("tos", new StringBody("1"));
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 PutStream.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("http://putstream.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();
}
}
@Override
public void run() {
try {
if (verzendAccount.loginsuccessful) {
userType = "reg";
httpContext = verzendAccount.getHttpContext();
sessionID = CookieUtils.getCookieValue(httpContext, "xfss");
maxFileSizeLimit = 2147483648L; // 2 GB
} else {
userType = "anon";
cookieStore = new BasicCookieStore();
httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
maxFileSizeLimit = 1073741824L; // 1 GB
}
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_descr", new StringBody(""));
mpEntity.addPart("link_rcpt", new StringBody(""));
mpEntity.addPart("link_pass", new StringBody(""));
mpEntity.addPart("to_folder", new StringBody(""));
mpEntity.addPart("file_0", createMonitoredFileBody());
mpEntity.addPart("submit_btn", new StringBody("Start Upload"));
httpPost.setEntity(mpEntity);
NULogger.getLogger().log(Level.INFO, "executing request {0}", httpPost.getRequestLine());
NULogger.getLogger().info("Now uploading your file into Verzend.be");
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("http://verzend.be");
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(1).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();
}
}
@Override
public void run() {
try {
if (cloudyEcAccount.loginsuccessful) {
httpContext = cloudyEcAccount.getHttpContext();
maxFileSizeLimit = 1048576000L; // 1,000 MB
}
else {
host = "Cloudy.ec";
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("fileselect", createMonitoredFileBody());
httpPost.setEntity(mpEntity);
NULogger.getLogger().log(Level.INFO, "executing request {0}", httpPost.getRequestLine());
NULogger.getLogger().info("Now uploading your file into Cloudy.ec");
uploading();
httpResponse = httpclient.execute(httpPost, httpContext);
responseString = EntityUtils.toString(httpResponse.getEntity());
sessionID = StringUtils.stringBetweenTwoStrings(responseString, "\"session\":\"", "\"");
doc = Jsoup.parse(responseString);
//Read the links
gettingLink();
// http://154.43.166.14/upload.php?site=0&upload_key=061449f3d36f4341cf3e98c76ca28b57&uid=40276&session_id=b6cb84b81c7ed2e9643a285d96f45215
get_links_url = "http://" + upload_server + "/upload.php?site=" + site_id + "&upload_key=" + upload_key + "&uid=" + uid + "&session_id=" + sessionID;
responseString = NUHttpClientUtils.getData(get_links_url, httpContext);
get_links_url = StringUtils.stringBetweenTwoStrings(responseString, "\"video_url\":\"", "\"");
get_links_url = get_links_url.replaceAll("\\\\", "");
doc = Jsoup.parse(responseString);
downloadlink = get_links_url;
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 (uppleItAccount.loginsuccessful) {
userType = "reg";
httpContext = uppleItAccount.getHttpContext();
maxFileSizeLimit = 1073741824L; // 1 GB
} else {
host = "Upple.it";
uploadInvalid();
return;
}
if (file.length() > maxFileSizeLimit) {
throw new NUMaxFileSizeException(maxFileSizeLimit, file.getName(), host);
}
uploadInitialising();
initialize();
// http://storing.upple.it/core/page/ajax/file_upload_handler.ajax.php?r=upple.it&p=http&csaKey1=ALPHANUMERIC&csaKey2=ALPHANUMERIC
httpPost = new NUHttpPost(uploadURL);
MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
mpEntity.addPart("cTracker", new StringBody(cTracker));
mpEntity.addPart("_sessionid", new StringBody(sessionID));
mpEntity.addPart("maxChunkSize", new StringBody(maxChunkSize));
mpEntity.addPart("folderId", new StringBody(""));
mpEntity.addPart("files[]", createMonitoredFileBody());
httpPost.setEntity(mpEntity);
NULogger.getLogger().log(Level.INFO, "executing request {0}", httpPost.getRequestLine());
NULogger.getLogger().info("Now uploading your file into Upple.it");
uploading();
httpResponse = httpclient.execute(httpPost, httpContext);
responseString = EntityUtils.toString(httpResponse.getEntity());
responseString = responseString.replaceAll("\\\\", "");
//Read the links
gettingLink();
downloadlink = StringUtils.stringBetweenTwoStrings(responseString, "\"url\":\"", "\"");
deletelink = StringUtils.stringBetweenTwoStrings(responseString, "\"delete_url\":\"", "\"");
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 (upLeaAccount.loginsuccessful) {
userType = "reg";
httpContext = upLeaAccount.getHttpContext();
maxFileSizeLimit = 2684354560L; // 2560 MB
} else {
userType = "anon";
cookieStore = new BasicCookieStore();
httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
maxFileSizeLimit = 2147483648L; // 2048 MB
}
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);
httpPost = new NUHttpPost(uploadURL);
MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
if (userType.equals("reg")) {
mpEntity.addPart("api_key", new StringBody(upLeaAccount.api_key));
}
mpEntity.addPart("token", new StringBody(upToken));
mpEntity.addPart("files[]", createMonitoredFileBody());
mpEntity.addPart("file_id[]", new StringBody(uploadid_s));
httpPost.setEntity(mpEntity);
NULogger.getLogger().log(Level.INFO, "executing request {0}", httpPost.getRequestLine());
NULogger.getLogger().info("Now uploading your file into UpLea.com");
uploading();
httpResponse = httpclient.execute(httpPost, httpContext);
responseString = EntityUtils.toString(httpResponse.getEntity());
//Read the links
gettingLink();
responseString = responseString.replaceAll("\\\\", "");
downloadlink = StringUtils.stringBetweenTwoStrings(responseString, "\"url\":\"", "\"");
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 (openLoadAccount.loginsuccessful) {
// registered user
httpContext = openLoadAccount.getHttpContext();
maxFileSizeLimit = 5368709120L; // 5120 MB
} else {
// free/anon user
cookieStore = new BasicCookieStore();
httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
maxFileSizeLimit = 5368709120L; // 5120 MB
}
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("file1", createMonitoredFileBody());
httpPost.setEntity(mpEntity);
NULogger.getLogger().log(Level.INFO, "executing request {0}", httpPost.getRequestLine());
NULogger.getLogger().info("Now uploading your file into OpenLoad.co");
uploading();
httpResponse = httpclient.execute(httpPost, httpContext);
responseString = EntityUtils.toString(httpResponse.getEntity());
//Read the links
gettingLink();
responseString = responseString.replaceAll("\\\\", "");
downloadlink = StringUtils.stringBetweenTwoStrings(responseString, "\"url\":\"", "\"");
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 (uppItAccount.loginsuccessful) {
userType = "reg";
httpContext = uppItAccount.getHttpContext();
sessionID = CookieUtils.getCookieValue(httpContext, "xfss");
maxFileSizeLimit = 1073741824l; //1024 MB
} else {
userType = "anon";
cookieStore = new BasicCookieStore();
httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
maxFileSizeLimit = 524288000l; //500 MB
delURL = UploadStatus.NA.getLocaleSpecificString();
}
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("file_0", 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 UppIT.com");
uploading();
httpResponse = httpclient.execute(httpPost, httpContext);
responseString = EntityUtils.toString(httpResponse.getEntity());
doc = Jsoup.parse(responseString);
final String fn = doc.select("textarea").first().text();
//Read the links
gettingLink();
httpPost = new NUHttpPost("http://uppit.com");
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("UppIt.html", responseString);
doc = Jsoup.parse(responseString);
downloadlink = doc.select("textarea").first().val();
if(uppItAccount.loginsuccessful){
deletelink = "http://uppit.com/?op=my_files;del_code=" + fn;
}
NULogger.getLogger().log(Level.INFO, "Delete link : {0}", deletelink);
NULogger.getLogger().log(Level.INFO, "Download link : {0}", downloadlink);
downURL = downloadlink;
if(uppItAccount.loginsuccessful){
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 (mightyUploadAccount.loginsuccessful) {
userType = "reg";
httpContext = mightyUploadAccount.getHttpContext();
maxFileSizeLimit = 4294967296L; // 4 GB
} else {
userType = "anon";
cookieStore = new BasicCookieStore();
httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
maxFileSizeLimit = 4294967296L; // 4 GB
}
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, 6);
uploadURL += "cgi-bin/" + uploadURL_unique_str + "/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_1", createMonitoredFileBody());
mpEntity.addPart("file_1_descr", new StringBody(""));
mpEntity.addPart("tos", new StringBody("1"));
mpEntity.addPart("link_rcpt", new StringBody(""));
mpEntity.addPart("link_pass", new StringBody(""));
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 MightyUpload.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("http://mightyupload.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 = 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 (nowDownloadAccount.loginsuccessful) {
httpContext = nowDownloadAccount.getHttpContext();
maxFileSizeLimit = 2147483648l; //2 GB
} else {
cookieStore = new BasicCookieStore();
httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
maxFileSizeLimit = 2147483648l; //2 GB
}
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_key", new StringBody(upload_key));
mpEntity.addPart("uid", new StringBody(uid));
mpEntity.addPart("upload_server", new StringBody(upload_server));
mpEntity.addPart("fileselect", createMonitoredFileBody());
httpPost.setEntity(mpEntity);
NULogger.getLogger().log(Level.INFO, "executing request {0}", httpPost.getRequestLine());
NULogger.getLogger().info("Now uploading your file into NowDownload.to");
uploading();
httpResponse = httpclient.execute(httpPost, httpContext);
responseString = EntityUtils.toString(httpResponse.getEntity());
String up_session = StringUtils.stringBetweenTwoStrings(responseString, "\"session\":\"", "\"}");
String vid_url = "http://" + upload_server + "/upload.php?s=nowdownload&dd=nowdownload.to&upload_key=" + upload_key + "&uid=" + uid + "&session_id="+up_session;
responseString = NUHttpClientUtils.getData(vid_url, httpContext);
//Read the links
gettingLink();
downloadlink = "http://www.nowdownload.to/dl/"+StringUtils.stringBetweenTwoStrings(responseString, "video_id\":\"", "\"}");
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 (asfileAccount.loginsuccessful) {
httpContext = asfileAccount.getHttpContext();
sessionID = CookieUtils.getCookieValue(httpContext, "xfss");
maxFileSizeLimit = 5368709120l; //5 GB
} else {
host = "Asfile.com";
uploadInvalid();
return;
}
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("MAX_FILE_SIZE", new StringBody("5497558138880"));
mpEntity.addPart("token", new StringBody(token));
mpEntity.addPart("agree", new StringBody("on"));
mpEntity.addPart("tos", new StringBody("1"));
mpEntity.addPart("file[]", createMonitoredFileBody());
mpEntity.addPart("description[]", new StringBody(""));
mpEntity.addPart("password[]", new StringBody(""));
httpPost.setEntity(mpEntity);
NULogger.getLogger().log(Level.INFO, "executing request {0}", httpPost.getRequestLine());
NULogger.getLogger().info("Now uploading your file into Asfile.com");
uploading();
httpResponse = httpclient.execute(httpPost, httpContext);
responseString = EntityUtils.toString(httpResponse.getEntity());
//Read the links
gettingLink();
responseString = StringUtils.stringBetweenTwoStrings(responseString, "parent.upload_data = ", "parent.upload_done()");
responseString = responseString.trim();
responseString = StringUtils.removeLastChars(responseString, 2);
responseString = StringUtils.removeFirstChar(responseString);
final JSONObject jSonObject = new JSONObject(responseString);
final String path = jSonObject.getString("path");
downloadlink = "http://asfile.com/file/" + path;
deletelink = "http://asfile.com/file/delete/" + path + "/" + jSonObject.getString("secret");
//NULogger.getLogger().log(Level.INFO, "response : {0}", responseString);
//FileUtils.saveInFile("Asfile.html", responseString);
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 (exaShareAccount.loginsuccessful) {
userType = "reg";
httpContext = exaShareAccount.getHttpContext();
maxFileSizeLimit = 9437184000L; // 9,000 MB
}
else {
host = "ExaShare.com";
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();
long uploadID;
Random random = new Random();
uploadID = Math.round(random.nextFloat() * Math.pow(10,12));
uploadid_s = String.valueOf(uploadID);
uploadURL += uploadid_s + "&utype=" + userType + "&disk_id=" + disk_id;
// http://enc2.exashare.com/cgi-bin/upload.cgi?upload_id=
// http://enc2.exashare.com/cgi-bin/upload.cgi?upload_id=585344363427&utype=reg&disk_id=01
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(srv_tmp_url));
mpEntity.addPart("srv_id", new StringBody(srv_id));
mpEntity.addPart("disk_id", new StringBody(disk_id));
mpEntity.addPart("file", createMonitoredFileBody());
mpEntity.addPart("fakefilepc", new StringBody(file.getName()));
//mpEntity.addPart("file_descr", new StringBody("Uploaded via Neembuu Uploader!"));
mpEntity.addPart("file_category", new StringBody("0"));
mpEntity.addPart("file_public", new StringBody("0"));
mpEntity.addPart("tos", new StringBody("1"));
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 ExaShare.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("http://www.exashare.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 = 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 (novaFileAccount.loginsuccessful) {
httpContext = novaFileAccount.getHttpContext();
maxFileSizeLimit = 2097152000L; // 2,000 MB
} else {
host = "NovaFile.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);
uploadURL += "/?X-Progress-ID=" + uploadid_s;
// http://s07.novafile.com/upload/26/?X-Progress-ID=6320548861194
httpPost = new NUHttpPost(uploadURL);
MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
mpEntity.addPart("upload_type", new StringBody("file"));
mpEntity.addPart("srv_id", new StringBody(srv_id));
mpEntity.addPart("sess_id", new StringBody(sess_id));
mpEntity.addPart("srv_tmp_url", new StringBody(srv_tmp_url));
mpEntity.addPart("file_1", createMonitoredFileBody());
mpEntity.addPart("tos", new StringBody("1"));
httpPost.setEntity(mpEntity);
NULogger.getLogger().log(Level.INFO, "executing request {0}", httpPost.getRequestLine());
NULogger.getLogger().info("Now uploading your file into NovaFile.com");
uploading();
httpResponse = httpclient.execute(httpPost, httpContext);
responseString = EntityUtils.toString(httpResponse.getEntity());
doc = Jsoup.parse(responseString);
//Read the links
gettingLink();
upload_fn = doc.select("input[name=fn]").val();
if (upload_fn != null) {
httpPost = new NUHttpPost("http://novafile.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("table").first().select("tr:nth-child(3)").select("td:nth-child(2)").select("a").attr("href");
deletelink = doc.select("table").first().select("tr:nth-child(7)").select("td:nth-child(2)").select("input").attr("value");
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();
}
}