/** @author davidepastore */
@SmallModule(
    exports = {Solidfiles.class, SolidfilesAccount.class},
    interfaces = {Uploader.class, Account.class},
    name = "Solidfiles.com")
public class Solidfiles extends AbstractUploader {

  SolidfilesAccount solidfilesAccount =
      (SolidfilesAccount) getAccountsProvider().getAccount("Solidfiles.com");

  private HttpClient httpclient = NUHttpClient.getHttpClient();
  private HttpResponse httpResponse;
  private HttpContext httpContext = new BasicHttpContext();
  private CookieStore cookieStore;
  private NUHttpPost httpPost;

  private String downloadlink = "http://www.solidfiles.com/d/%s/";
  private long fileSizeLimit = 524288000l; // 500 MB

  public Solidfiles() {
    host = "Solidfiles.com";
    downURL = UploadStatus.PLEASEWAIT.getLocaleSpecificString();
    delURL = UploadStatus.NA.getLocaleSpecificString();

    if (solidfilesAccount.loginsuccessful) {
      // login = true;
      host = solidfilesAccount.username + " | Solidfiles.com";
    }
  }

  @Override
  public void run() {
    try {
      if (file.length() > fileSizeLimit) {
        throw new NUMaxFileSizeException(fileSizeLimit, file.getName(), this.getHost());
      }

      if (solidfilesAccount.loginsuccessful) {
        httpContext = solidfilesAccount.getHttpContext();
      } else {
        cookieStore = new BasicCookieStore();
        httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
      }

      uploadInitialising();
      fileupload();
    } catch (NUException ex) {
      ex.printError();
      uploadInvalid();
    } catch (Exception e) {
      Logger.getLogger(Solidfiles.class.getName()).log(Level.SEVERE, null, e);

      uploadFailed();
    }
  }

  private void fileupload() throws Exception {

    if (!solidfilesAccount.loginsuccessful) {
      NUHttpClientUtils.getData("http://www.solidfiles.com/", httpContext);
    }

    httpPost = new NUHttpPost("http://www.solidfiles.com/upload/process/0/");

    MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
    reqEntity.addPart("name", new StringBody(file.getName()));
    reqEntity.addPart("file", createMonitoredFileBody());

    httpPost.setEntity(reqEntity);
    uploading();
    NULogger.getLogger().info("Now uploading your file into solidfiles.com. Please wait...");
    httpResponse = httpclient.execute(httpPost, httpContext);
    HttpEntity resEntity = httpResponse.getEntity();

    String downloadCode;
    if (resEntity != null) {
      gettingLink();
      downloadCode = EntityUtils.toString(resEntity);
      NULogger.getLogger().log(Level.INFO, "Download code :{0}", downloadCode);
      downloadlink = String.format(downloadlink, downloadCode);
    }

    downURL = downloadlink;
    uploadFinished();
  }
}
/** @author MNidhal */
@SmallModule(
    exports = {Streamin.class, StreaminAccount.class},
    interfaces = {Uploader.class, Account.class},
    name = "Streamin.to")
public class Streamin extends AbstractUploader implements UploaderAccountNecessary {

  StreaminAccount streaminAccount =
      (StreaminAccount) getAccountsProvider().getAccount("Streamin.to");

  private final HttpClient httpclient = NUHttpClient.getHttpClient();
  private HttpContext httpContext = new BasicHttpContext();
  private HttpResponse httpResponse;
  private NUHttpPost httpPost;
  private String responseString;
  private Document doc;
  private String uploadURL;
  private String userType;
  private String sessionID = "";
  private String sv_id = "";
  private String disk_id = "";
  private ArrayList<String> allowedVideoExtensions = new ArrayList<String>();

  private String downloadlink = "";
  private String deletelink = "";

  public Streamin() {
    downURL = UploadStatus.PLEASEWAIT.getLocaleSpecificString();
    delURL = UploadStatus.PLEASEWAIT.getLocaleSpecificString();
    host = "Streamin.to";
    if (streaminAccount.loginsuccessful) {
      host = streaminAccount.username + " | Streamin.to";
    }
    maxFileSizeLimit = 2147483648l; // 2048MB (2GB)
  }

  private void initialize() throws Exception {
    responseString = NUHttpClientUtils.getData("http://streamin.to?op=upload", httpContext);

    doc = Jsoup.parse(responseString);
    uploadURL = doc.select("form[name=file").first().attr("action");
    sv_id = doc.select("input[name=srv_id").first().attr("value");
    disk_id = doc.select("input[name=disk_id").first().attr("value");
    String uploadId = StringUtils.uuid(12, 10);
    uploadURL += uploadId + "&utype=" + userType + "&disk_id=" + disk_id;
  }

  @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();
    }
  }

  private void addExtensions() {
    allowedVideoExtensions.add("avi");
    allowedVideoExtensions.add("mkv");
    allowedVideoExtensions.add("mpg");
    allowedVideoExtensions.add("mpeg");
    allowedVideoExtensions.add("vob");
    allowedVideoExtensions.add("wmv");
    allowedVideoExtensions.add("flv");
    allowedVideoExtensions.add("mp4");
    allowedVideoExtensions.add("mov");
    allowedVideoExtensions.add("m2v");
    allowedVideoExtensions.add("divx");
    allowedVideoExtensions.add("xvid");
    allowedVideoExtensions.add("3gp");
    allowedVideoExtensions.add("webm");
    allowedVideoExtensions.add("ogv");
    allowedVideoExtensions.add("ogg");

    // This gives problems
    // allowedVideoExtensions.add("srt");
  }
}
/**
 * @author dinesh
 * @author davidepastore
 */
@SmallModule(
    exports = {SlingFile.class, SlingFileAccount.class},
    interfaces = {Uploader.class, Account.class},
    name = "SlingFile.com",
    ignore = true)
public class SlingFile extends AbstractUploader {

  SlingFileAccount slingFileAccount =
      (SlingFileAccount) getAccountsProvider().getAccount("SlingFile.com");

  private HttpClient httpclient = NUHttpClient.getHttpClient();
  private HttpContext httpContext = new BasicHttpContext();
  private HttpResponse httpResponse;
  private NUHttpPost httpPost;
  private NUHttpGet httpGet;
  private CookieStore cookieStore;
  private String stringResponse;
  private String uploadURL;
  private String progressID;
  private String rauLink;
  private URI URILink;
  private JSONObject jSonObject;

  private String ssd = "";
  private String encUserID = "";
  private String postURL = "";
  private String downloadlink = "";
  private String deletelink = "";
  private long fileSizeLimit = 2147483648l; // 2 GB

  public SlingFile() {
    downURL = UploadStatus.PLEASEWAIT.getLocaleSpecificString();
    delURL = UploadStatus.PLEASEWAIT.getLocaleSpecificString();
    host = "SlingFile.com";
    if (slingFileAccount.loginsuccessful) {
      host = slingFileAccount.username + " | SlingFile.com";
    }
  }

  private void initialize() throws Exception {

    NULogger.getLogger().info("After login, geting the link again :)");
    httpGet = new NUHttpGet("http://www.slingfile.com/");
    httpResponse = httpclient.execute(httpGet, httpContext);
    stringResponse = EntityUtils.toString(httpResponse.getEntity());
    // FileUtils.saveInFile("SlingFile.com.html", stringResponse);

    // See here: http://www.slingfile.com/media/plupload.beauty.js
    // http://www.plupload.com/punbb/viewtopic.php?pid=5686
    jSonObject =
        new JSONObject(
            StringUtils.stringBetweenTwoStrings(stringResponse, "var uploaderSettings = ", ";"));

    uploadURL = jSonObject.getString("uploadURL");
    ssd = jSonObject.getString("ssd");

    if (jSonObject.has("encUserID")) {
      encUserID = jSonObject.getString("encUserID");
    }

    progressID = guid();
    postURL = uploadURL + progressID;
    rauLink =
        StringUtils.stringBetweenTwoStrings(stringResponse, "document.location.href = '", "'");
    NULogger.getLogger().log(Level.INFO, "progressID: " + progressID);

    URILink = URIUtils.createURI(rauLink);
  }

  @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();
    }
  }

  /**
   * Implementation of guid of <a
   * href="http://www.slingfile.com/media/plupload.beauty.js">plupload</a>.
   *
   * @return the guid string
   */
  private String guid() {
    int f = 0;
    Long number = new Long(new Date().getTime());
    String o = Long.toString(number, 32);
    for (int p = 0; p < 5; p++) {
      o += Long.toString((Math.round(Math.random() * 65535)), 32);
    }
    // return (g.guidPrefix || "p") + o + (f++).toString(32);
    return ("p") + o + Integer.toString(f++, 32);
  }
}
/**
 * If there is a problem, take a look to <a href="http://dfiles.eu/filemanager.html">Depositfiles
 * Filemanager</a>.
 *
 * @author dinesh
 * @author davidepastore
 * @author Paralytic
 */
@SmallModule(
    exports = {DepositFiles.class, DepositFilesAccount.class},
    interfaces = {Uploader.class, Account.class},
    name = "DepositFiles.com")
public class DepositFiles extends AbstractUploader {

  DepositFilesAccount depositFilesAccount =
      (DepositFilesAccount) getAccountsProvider().getAccount("DepositFiles.com");

  private final HttpClient httpclient = NUHttpClient.getHttpClient();
  private HttpContext httpContext = new BasicHttpContext();
  private NUHttpPost httpPost;

  private Document doc;
  private String postURL = "";
  private String uploadresponse = "";
  private String downloadlink = "";
  private String deletelink = "";
  private String MAX_FILE_SIZE = "";
  private String UPLOAD_IDENTIFIER = "";
  private String go = "";
  private final long logMaxFileSizeLimit = 10737418240L; // 10 GB
  private final long notLogMaxFileSizeLimit = 2147483648l; // 2 GB
  private final long minFileSizeLimit = 1l; // 1B

  public DepositFiles() {
    downURL = UploadStatus.PLEASEWAIT.getLocaleSpecificString();
    delURL = UploadStatus.PLEASEWAIT.getLocaleSpecificString();
    host = "DepositFiles.com";
    if (depositFilesAccount.loginsuccessful) {
      host = depositFilesAccount.username + " | DepositFiles.com";
    }
  }

  @Override
  public void run() {
    try {
      if (depositFilesAccount.loginsuccessful) {
        httpContext = depositFilesAccount.getHttpContext();
        host = depositFilesAccount.username + " | DepositFiles.com";
      } else {
        host = "DepositFiles.com";
        CookieStore cookieStore = new BasicCookieStore();
        httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
      }

      if (!depositFilesAccount.loginsuccessful) {
        if (file.length() > notLogMaxFileSizeLimit) {
          throw new NUMaxFileSizeException(
              notLogMaxFileSizeLimit, file.getName(), depositFilesAccount.getHOSTNAME());
        }
      } else {
        if (file.length() > logMaxFileSizeLimit) {
          throw new NUMaxFileSizeException(
              logMaxFileSizeLimit, file.getName(), depositFilesAccount.getHOSTNAME());
        }
      }

      if (file.length() == 0) {
        throw new NUMinFileSizeException(
            minFileSizeLimit, file.getName(), depositFilesAccount.getHOSTNAME());
      }

      uploadInitialising();
      NULogger.getLogger().info("Now getting deposifiles page post action value........");
      if (depositFilesAccount.loginsuccessful) {
        uploadresponse = NUHttpClientUtils.getData("http://depositfiles.com/en/", httpContext);
        doc = Jsoup.parse(uploadresponse);
        postURL = doc.select("form[id=upload_form]").first().attr("action");
        MAX_FILE_SIZE =
            doc.select("form[id=upload_form]")
                .first()
                .select("input[name=MAX_FILE_SIZE]")
                .attr("value");
        UPLOAD_IDENTIFIER =
            doc.select("form[id=upload_form]")
                .first()
                .select("input[name=UPLOAD_IDENTIFIER]")
                .attr("value");
        go = doc.select("form[id=upload_form]").first().select("input[name=go]").attr("value");
      } else {
        postURL =
            NUHttpClientUtils.getData(
                "http://depositfiles.com/api/get_upload_info.php", httpContext);
        postURL = Jsoup.parse(postURL, "", Parser.xmlParser()).select("http_upload_path").text();
      }

      NULogger.getLogger().log(Level.INFO, "Post URL  : {0}", postURL);
      fileUpload();

      uploadFinished();
    } catch (NUException ex) {
      ex.printError();

      uploadInvalid();
    } catch (Exception ex) {
      NULogger.getLogger().severe(ex.toString());

      uploadFailed();
    } finally {
      postURL = null;
      uploadresponse = null;
      downloadlink = null;
      deletelink = null;
    }
  }

  public void fileUpload() throws Exception {
    uploading();

    httpPost = new NUHttpPost(postURL);
    MultipartEntity mpEntity = new MultipartEntity();
    ContentBody cbFile = createMonitoredFileBody();

    mpEntity.addPart("MAX_FILE_SIZE", new StringBody(MAX_FILE_SIZE));
    mpEntity.addPart("UPLOAD_IDENTIFIER", new StringBody(UPLOAD_IDENTIFIER));
    mpEntity.addPart("go", new StringBody(go));
    mpEntity.addPart("files", cbFile);
    mpEntity.addPart("agree", new StringBody("1"));
    mpEntity.addPart("submit", new StringBody("Upload Now"));
    httpPost.setEntity(mpEntity);
    NULogger.getLogger()
        .info("Now uploading your file into depositfiles...........................");
    HttpResponse response = httpclient.execute(httpPost, httpContext);
    HttpEntity resEntity = response.getEntity();

    NULogger.getLogger().info(response.getStatusLine().toString());
    if (resEntity != null) {
      gettingLink();
      uploadresponse = EntityUtils.toString(resEntity);
      downloadlink =
          StringUtils.stringBetweenTwoStrings(uploadresponse, "ud_download_url = '", "'");
      deletelink = StringUtils.stringBetweenTwoStrings(uploadresponse, "ud_delete_url = '", "'");
      NULogger.getLogger().log(Level.INFO, "download link : {0}", downloadlink);
      NULogger.getLogger().log(Level.INFO, "delete link : {0}", deletelink);
      downURL = downloadlink;
      delURL = deletelink;
    } else {
      throw new Exception("Error in depositfiles!");
    }
  }
}
/** @author Paralytic */
public class ExLoadAccount extends AbstractAccount {

  private final HttpClient httpclient = NUHttpClient.getHttpClient();
  private HttpResponse httpResponse;
  private NUHttpPost httpPost;
  private CookieStore cookieStore;
  private String responseString;
  private Document doc;

  Map<Integer, Integer> assoc = new HashMap<Integer, Integer>();
  private String captcha = "";
  private String rand = "";

  public ExLoadAccount() {
    KEY_USERNAME = "******";
    KEY_PASSWORD = "******";
    HOSTNAME = "Ex-Load.com";
  }

  @Override
  public void disableLogin() {
    resetLogin();
    hostsAccountUI().hostUI(HOSTNAME).setEnabled(false);
    hostsAccountUI().hostUI(HOSTNAME).setSelected(false);
    updateSelectedHostsLabel();
    NULogger.getLogger().log(Level.INFO, "{0} account disabled", getHOSTNAME());
  }

  @Override
  public void login() {
    loginsuccessful = false;
    try {
      initialize();

      NULogger.getLogger().info("Trying to log in to Ex-Load.com");
      httpPost = new NUHttpPost("http://ex-load.com/");
      httpPost.setHeader("Referer", "http://ex-load.com/login.html");
      httpPost.setHeader("Host", "ex-load.com");
      httpPost.setHeader(
          "User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0");
      httpPost.setHeader("DNT", "1");

      List<NameValuePair> formparams = new ArrayList<NameValuePair>();
      formparams.add(new BasicNameValuePair("code", captcha));
      formparams.add(new BasicNameValuePair("op", "login"));
      formparams.add(new BasicNameValuePair("login", getUsername()));
      formparams.add(new BasicNameValuePair("password", getPassword()));
      formparams.add(new BasicNameValuePair("rand", rand));
      formparams.add(new BasicNameValuePair("redirect", "http://ex-load.com/"));

      UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8");
      httpPost.setEntity(entity);
      httpResponse = httpclient.execute(httpPost, httpContext);
      NULogger.getLogger().info(httpResponse.getStatusLine().toString());

      responseString = EntityUtils.toString(httpResponse.getEntity());
      if (responseString.contains("Wrong captcha code")) {
        NULogger.getLogger().info("** Ex-Load.com ** => Server reports the captcha as incorrect");
        throw new Exception("Server reports incorrect captcha");
      }

      if (!CookieUtils.getCookieValue(httpContext, "xfss").isEmpty()
          && !CookieUtils.getCookieValue(httpContext, "login").isEmpty()) {
        EntityUtils.consume(httpResponse.getEntity());
        loginsuccessful = true;
        username = getUsername();
        password = getPassword();
        hostsAccountUI().hostUI(HOSTNAME).setEnabled(true);
        NULogger.getLogger().info("Ex-Load.com login successful!");

      } else {
        // Get error message
        responseString = EntityUtils.toString(httpResponse.getEntity());
        // FileUtils.saveInFile("ExLoadAccount.html", responseString);
        Document doc = Jsoup.parse(responseString);
        String error = doc.select(".err").first().text();

        if ("Incorrect Login or Password".equals(error)) {
          throw new NUInvalidLoginException(getUsername(), HOSTNAME);
        }

        // Generic exception
        throw new Exception("Login error: " + error);
      }
    } catch (NUException ex) {
      resetLogin();
      ex.printError();
      accountUIShow().setVisible(true);
    } catch (Exception e) {
      resetLogin();
      NULogger.getLogger().log(Level.SEVERE, "{0}: {1}", new Object[] {getClass().getName(), e});
      showWarningMessage(Translation.T().loginerror(), HOSTNAME);
      accountUIShow().setVisible(true);
    }
  }

  private void initialize() throws Exception {
    httpContext = new BasicHttpContext();
    cookieStore = new BasicCookieStore();
    httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);

    NULogger.getLogger().info("** Ex-Load.com ** => Attempting to log-out before logging in.");
    responseString = NUHttpClientUtils.getData("http://ex-load.com/?op=logout", httpContext);
    Thread.sleep(2000);
    NULogger.getLogger().info("** Ex-Load.com ** => Retrieving login page");
    responseString = NUHttpClientUtils.getData("http://ex-load.com/login.html", httpContext);
    doc = Jsoup.parse(responseString);
    captcha = captchaSolver();
    NULogger.getLogger().info("** Ex-Load.com ** => FINAL captcha value: [" + captcha + "]");
    rand = doc.select("input[name=rand]").attr("value");
    Thread.sleep(2000);
  }

  private void resetLogin() {
    loginsuccessful = false;
    username = "";
    password = "";
  }

  private String captchaSolver() {
    NULogger.getLogger().info("** Ex-Load.com ** => Solving the captcha ...");
    int i = 0;
    String pd_lft = "", capt_digit = "", captcha_code = "";
    for (i = 0; i < 4; i++) {
      pd_lft =
          doc.select("input[name=code]")
              .first()
              .parent()
              .previousElementSibling()
              .select("div")
              .select("span")
              .eq(i)
              .toString();
      pd_lft = StringUtils.stringBetweenTwoStrings(pd_lft, "padding-left:", "px;");

      capt_digit =
          doc.select("input[name=code]")
              .first()
              .parent()
              .previousElementSibling()
              .select("div")
              .select("span")
              .eq(i)
              .text();
      assoc.put(Integer.parseInt(pd_lft), Integer.parseInt(capt_digit));
    }
    NULogger.getLogger().info("** Ex-Load.com ** => Appeared sequence " + assoc.toString());
    Map<Integer, Integer> treeMap = new TreeMap<Integer, Integer>(assoc);
    NULogger.getLogger().info("** Ex-Load.com ** => REAL sequence " + treeMap.toString());

    // iterating over values only
    for (Integer value : treeMap.values()) {
      captcha_code += value.toString();
    }
    return captcha_code;
  }
}
/** @author Paralytic */
@SmallModule(
    exports = {PrivateFiles.class, PrivateFilesAccount.class},
    interfaces = {Uploader.class, Account.class},
    name = "PrivateFiles.com",
    ignore = true)
public class PrivateFiles extends AbstractUploader implements UploaderAccountNecessary {

  PrivateFilesAccount privateFilesAccount =
      (PrivateFilesAccount) getAccountsProvider().getAccount("PrivateFiles.com");

  private final HttpClient httpclient = NUHttpClient.getHttpClient();
  private HttpContext httpContext = new BasicHttpContext();
  private HttpResponse httpResponse;
  private NUHttpPost httpPost;
  private CookieStore cookieStore;
  private String responseString;
  private Document doc;
  private String uploadURL;
  private String userType;
  private String sessionID = "";
  private String sess_id = "";
  private String uploadid_s = "";
  private String upload_fn = "";
  private String srv_tmp_url = "";

  private String downloadlink = "";
  private String deletelink = "";

  public PrivateFiles() {
    downURL = UploadStatus.PLEASEWAIT.getLocaleSpecificString();
    delURL = UploadStatus.PLEASEWAIT.getLocaleSpecificString();
    host = "PrivateFiles.com";
    if (privateFilesAccount.loginsuccessful) {
      host = privateFilesAccount.username + " | PrivateFiles.com";
    }
    maxFileSizeLimit = 2147483648L; // 2 GB (default)
  }

  private void initialize() throws Exception {
    responseString = NUHttpClientUtils.getData("http://privatefiles.com", httpContext);
    doc = Jsoup.parse(responseString);
    uploadURL =
        StringUtils.stringBetweenTwoStrings(responseString, "name=\"srv_tmp_url\" value=\"", "\"");
  }

  @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();
    }
  }
}
/** @author Paralytic */
public class FileHootAccount extends AbstractAccount {

  private final HttpClient httpclient = NUHttpClient.getHttpClient();
  private HttpResponse httpResponse;
  private NUHttpPost httpPost;
  private CookieStore cookieStore;
  private String responseString;

  public FileHootAccount() {
    KEY_USERNAME = "******";
    KEY_PASSWORD = "******";
    HOSTNAME = "FileHoot.com";
  }

  @Override
  public void disableLogin() {
    resetLogin();
    NULogger.getLogger().log(Level.INFO, "{0} account disabled", getHOSTNAME());
  }

  @Override
  public void login() {
    loginsuccessful = false;
    try {
      initialize();

      NULogger.getLogger().info("Trying to log in to FileHoot.com");
      httpPost = new NUHttpPost("http://filehoot.com/");

      List<NameValuePair> formparams = new ArrayList<NameValuePair>();
      formparams.add(new BasicNameValuePair("op", "login"));
      formparams.add(new BasicNameValuePair("redirect", ""));
      formparams.add(new BasicNameValuePair("login", getUsername()));
      formparams.add(new BasicNameValuePair("password", getPassword()));

      UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8");
      httpPost.setEntity(entity);
      httpResponse = httpclient.execute(httpPost, httpContext);
      NULogger.getLogger().info(httpResponse.getStatusLine().toString());
      Header lastHeader = httpResponse.getLastHeader("Location");

      if (httpResponse != null && httpResponse.toString().contains("xfss=")) {
        EntityUtils.consume(httpResponse.getEntity());
        loginsuccessful = true;
        username = getUsername();
        password = getPassword();
        NULogger.getLogger().info("FileHoot.com login successful!");

      } else {
        // Get error message
        responseString = EntityUtils.toString(httpResponse.getEntity());
        // FileUtils.saveInFile("FileHootAccount.html", responseString);
        Document doc = Jsoup.parse(responseString);
        String error = doc.select("div.alert-danger").first().text();

        if ("Incorrect Login or Password".equals(error)) {
          throw new NUInvalidLoginException(getUsername(), HOSTNAME);
        }

        // Generic exception
        throw new Exception("Login error: " + "Login Failed");
      }
    } catch (NUException ex) {
      resetLogin();
      ex.printError();
      accountUIShow().setVisible(true);
    } catch (Exception e) {
      resetLogin();
      NULogger.getLogger().log(Level.SEVERE, "{0}: {1}", new Object[] {getClass().getName(), e});
      showWarningMessage(Translation.T().loginerror(), HOSTNAME);
      accountUIShow().setVisible(true);
    }
  }

  private void initialize() throws Exception {
    httpContext = new BasicHttpContext();
    cookieStore = new BasicCookieStore();
    httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);

    // NULogger.getLogger().info("Getting startup cookies & link from FileHoot.com");
    // responseString = NUHttpClientUtils.getData("http://filehoot.com", httpContext);
  }

  private void resetLogin() {
    loginsuccessful = false;
    username = "";
    password = "";
  }
}
/** @author Paralytic */
public class TopUploadOneAccount extends AbstractAccount {

  private final HttpClient httpclient = NUHttpClient.getHttpClient();
  private HttpResponse httpResponse;
  private NUHttpPost httpPost;
  private CookieStore cookieStore;
  private String responseString;

  public TopUploadOneAccount() {
    KEY_USERNAME = "******";
    KEY_PASSWORD = "******";
    HOSTNAME = "TopUpload1.com";
  }

  @Override
  public void disableLogin() {
    resetLogin();
    NULogger.getLogger().log(Level.INFO, "{0} account disabled", getHOSTNAME());
  }

  @Override
  public void login() {
    loginsuccessful = false;
    try {
      initialize();

      NULogger.getLogger().info("Trying to log in to TopUpload1.com");
      httpPost = new NUHttpPost("http://topupload1.com/ajax/_account_login.ajax.php");

      List<NameValuePair> formparams = new ArrayList<NameValuePair>();
      formparams.add(new BasicNameValuePair("username", getUsername()));
      formparams.add(new BasicNameValuePair("password", getPassword()));

      UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8");
      httpPost.setEntity(entity);
      httpResponse = httpclient.execute(httpPost, httpContext);
      NULogger.getLogger().info(httpResponse.getStatusLine().toString());
      responseString = EntityUtils.toString(httpResponse.getEntity());

      if (StringUtils.stringBetweenTwoStrings(responseString, "\"login_status\":\"", "\"")
          .equals("success")) {
        EntityUtils.consume(httpResponse.getEntity());
        loginsuccessful = true;
        username = getUsername();
        password = getPassword();
        NULogger.getLogger().info("TopUpload1.com login successful!");

      } else {
        // Get error message
        responseString = EntityUtils.toString(httpResponse.getEntity());
        // FileUtils.saveInFile("TopUploadOneAccount.html", responseString);
        Document doc = Jsoup.parse(responseString);
        String error = doc.select(".err").first().text();

        if ("Incorrect Login or Password".equals(error)) {
          throw new NUInvalidLoginException(getUsername(), HOSTNAME);
        }

        // Generic exception
        throw new Exception("Login error: " + error);
      }
    } catch (NUException ex) {
      resetLogin();
      ex.printError();
      accountUIShow().setVisible(true);
    } catch (Exception e) {
      resetLogin();
      NULogger.getLogger().log(Level.SEVERE, "{0}: {1}", new Object[] {getClass().getName(), e});
      showWarningMessage(Translation.T().loginerror(), HOSTNAME);
      accountUIShow().setVisible(true);
    }
  }

  private void initialize() throws Exception {
    httpContext = new BasicHttpContext();
    cookieStore = new BasicCookieStore();
    httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);

    NULogger.getLogger().info("Getting startup cookies & link from TopUpload1.com");
    responseString = NUHttpClientUtils.getData("http://topupload1.com/login.html", httpContext);
  }

  private void resetLogin() {
    loginsuccessful = false;
    username = "";
    password = "";
  }
}
/** @author vigneshwaran */
@SmallModule(
    exports = {HotFile.class, HotFileAccount.class},
    interfaces = {Uploader.class, Account.class},
    name = "HotFile.com",
    ignore = true)
public class HotFile extends AbstractUploader implements UploaderAccountNecessary {

  HotFileAccount hotFileAccount = (HotFileAccount) getAccountsProvider().getAccount("HotFile.com");

  HttpClient httpclient = NUHttpClient.getHttpClient();
  HttpContext httpContext;
  HttpResponse httpresponse;
  NUHttpGet httpget;
  NUHttpPost httppost;

  String strResponse, link;
  String start;
  String manageURL;

  public HotFile() {
    downURL = UploadStatus.PLEASEWAIT.getLocaleSpecificString();
    delURL = UploadStatus.PLEASEWAIT.getLocaleSpecificString();
    host = "HotFile.com";

    if (hotFileAccount.loginsuccessful) {
      host = hotFileAccount.username + " | HotFile.com";
    }
  }

  @Override
  public void run() {
    // Checking once again as user may disable account while this upload thread is waiting in queue

    if (hotFileAccount.loginsuccessful) {
      host = hotFileAccount.username + " | HotFile.com";
    } else {
      host = "HotFile.com";

      uploadInvalid();
      return;
    }

    uploadLogin();
  }

  private void uploadLogin() {
    try {
      uploadInitialising();
      // -------------------------------------------------------------
      if (file.length() > hotFileAccount.getMaxFileSizeLimit()) {
        throw new NUMaxFileSizeException(
            hotFileAccount.getMaxFileSizeLimit(), file.getName(), hotFileAccount.getHOSTNAME());
      }

      httpContext = hotFileAccount.getHttpContext();

      status = UploadStatus.GETTINGCOOKIE;
      httpget = new NUHttpGet("http://hotfile.com/?cookiecheck=1");
      httpresponse = httpclient.execute(httpget, httpContext);

      strResponse = EntityUtils.toString(httpresponse.getEntity());
      start = "<form action=\"";
      link = strResponse.substring(strResponse.indexOf(start + "http://") + start.length());
      link = link.substring(0, link.indexOf("\""));
      NULogger.getLogger().info(link);
      // ------------------------------------------------------------

      httppost = new NUHttpPost(link);
      MultipartEntity requestEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);

      requestEntity.addPart("uploads[]", createMonitoredFileBody());
      requestEntity.addPart("iagree", new StringBody("on"));
      requestEntity.addPart("", new StringBody("Upload"));

      httppost.setEntity(requestEntity);
      // -------------------------------------------------------------
      uploading();
      // -------------------------------------------------------------
      httpresponse = httpclient.execute(httppost, httpContext);
      manageURL = httpresponse.getHeaders("Location")[0].getValue();
      strResponse = EntityUtils.toString(httpresponse.getEntity());
      NULogger.getLogger().log(Level.INFO, "HotFile Manage URL{0}", manageURL);

      NULogger.getLogger().info("Getting links from Manage URL");

      gettingLink();

      // -------------------------------------------------------------
      httpget = new NUHttpGet(manageURL);
      httpresponse = httpclient.execute(httpget, httpContext);
      strResponse = EntityUtils.toString(httpresponse.getEntity());

      start = "<input type=\"text\" name=\"url\" id=\"url\" class=\"textfield\" value=\"";
      downURL = strResponse.substring(strResponse.indexOf(start) + start.length());
      downURL = downURL.substring(0, downURL.indexOf("\""));

      start = "<input type=\"text\" name=\"delete\" id=\"delete\" class=\"textfield\" value=\"";
      delURL = strResponse.substring(strResponse.indexOf(start) + start.length());
      delURL = delURL.substring(0, delURL.indexOf("\""));
      // --------------------------------------------------------------

      NULogger.getLogger().log(Level.INFO, "Download Link: {0}", downURL);
      NULogger.getLogger().log(Level.INFO, "Delete link: {0}", delURL);

      uploadFinished();
    } catch (NUException ex) {
      ex.printError();
      uploadInvalid();
    } catch (Exception ex) {
      Logger.getLogger(HotFile.class.getName()).log(Level.SEVERE, null, ex);
      uploadFailed();
    }
  }
  /*
  private void uploadWithoutLogin() {
  try {
  //-------------------------------------------------------------
  if (file.length() > notLogFileSizeLimit) {
  showWarningMessage( "<html><b>" + getClass().getSimpleName() + "</b> " + Translation.T().maxfilesize() + ": <b>400MB</b></html>", getClass().getSimpleName());

  uploadFailed();
  return;
  }
  uploadInitialising();
  HttpParams params = new BasicHttpParams();
  params.setParameter(
  "http.useragent",
  "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2) Gecko/20100115 Firefox/3.6");
  DefaultHttpClient httpclient = new DefaultHttpClient(params);
  NUHttpGet httpget = new NUHttpGet("http://www.hotfile.com");
  HttpResponse httpresponse = httpclient.execute(httpget);

  strResponse = EntityUtils.toString(httpresponse.getEntity());
  start = "<form action=\"";
  link = strResponse.substring(strResponse.indexOf(start + "http://") + start.length());
  link = link.substring(0, link.indexOf("\""));
  NULogger.getLogger().info(link);
  //------------------------------------------------------------
  httppost = new NUHttpPost(link);
  httppost.setHeader("Referer", "http://www.hotfile.com/");
  httppost.setHeader("Cache-Control", "max-age=0");
  httppost.setHeader("Origin", "http://www.hotfile.com/");
  httppost.setHeader("Accept", "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png;q=0.5");

  MultipartEntity requestEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);

  requestEntity.addPart("uploads[]", createMonitoredFileBody());
  requestEntity.addPart("iagree", new StringBody("on"));
  requestEntity.addPart("", new StringBody("Upload"));

  httppost.setEntity(requestEntity);
  //-------------------------------------------------------------
  uploading();

  //-------------------------------------------------------------
  httpresponse = httpclient.execute(httppost);
  manageURL = httpresponse.getHeaders("Location")[0].getValue();
  NULogger.getLogger().log(Level.INFO, "HotFile Manage URL{0}", manageURL);

  status = UploadStatus.GETTINGLINK;

  NULogger.getLogger().info("Getting links from Manage URL");


  //-------------------------------------------------------------
  httpget = new HttpGet(manageURL);
  httpclient = new DefaultHttpClient(params);
  httpresponse = httpclient.execute(httpget);
  strResponse = EntityUtils.toString(httpresponse.getEntity());

  start = "<input type=\"text\" name=\"url\" id=\"url\" class=\"textfield\" value=\"";
  downURL = strResponse.substring(strResponse.indexOf(start) + start.length());
  downURL = downURL.substring(0, downURL.indexOf("\""));

  start = "<input type=\"text\" name=\"delete\" id=\"delete\" class=\"textfield\" value=\"";
  delURL = strResponse.substring(strResponse.indexOf(start) + start.length());
  delURL = delURL.substring(0, delURL.indexOf("\""));
  //--------------------------------------------------------------





  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();
  }
  }
   */
}
/** @author Paralytic */
public class OpenLoadAccount extends AbstractAccount {

  private final HttpClient httpclient = NUHttpClient.getHttpClient();
  private HttpResponse httpResponse;
  private NUHttpPost httpPost;
  private CookieStore cookieStore;
  private String responseString;

  private Document doc;
  private String csrfToken = "";

  public OpenLoadAccount() {
    KEY_USERNAME = "******";
    KEY_PASSWORD = "******";
    HOSTNAME = "OpenLoad.co";

    setupSsl();
  }

  @Override
  public void disableLogin() {
    resetLogin();
    NULogger.getLogger().log(Level.INFO, "{0} account disabled", getHOSTNAME());
  }

  @Override
  public void login() {
    loginsuccessful = false;
    try {
      initialize();

      NULogger.getLogger().info("Trying to log in to OpenLoad.co");
      httpPost = new NUHttpPost("https://openload.co/login");

      List<NameValuePair> formparams = new ArrayList<NameValuePair>();
      formparams.add(new BasicNameValuePair("_csrf", csrfToken));
      formparams.add(new BasicNameValuePair("LoginForm[rememberMe]", "1"));
      formparams.add(new BasicNameValuePair("LoginForm[email]", getUsername()));
      formparams.add(new BasicNameValuePair("LoginForm[password]", getPassword()));

      UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8");
      httpPost.setEntity(entity);
      httpResponse = httpclient.execute(httpPost, httpContext);
      NULogger.getLogger().info(httpResponse.getStatusLine().toString());

      responseString = NUHttpClientUtils.getData("https://openload.co/upload", httpContext);

      if (responseString.contains("logout")) {
        EntityUtils.consume(httpResponse.getEntity());
        loginsuccessful = true;
        username = getUsername();
        password = getPassword();
        NULogger.getLogger().info("OpenLoad.co login successful!");

      } else {
        // Get error message
        responseString = EntityUtils.toString(httpResponse.getEntity());
        Document doc = Jsoup.parse(responseString);
        String error = doc.select(".err").first().text();

        if ("Incorrect Login or Password".equals(error)) {
          throw new NUInvalidLoginException(getUsername(), HOSTNAME);
        }

        // Generic exception
        throw new Exception("Login error: " + error);
      }
    } catch (NUException ex) {
      resetLogin();
      ex.printError();
      accountUIShow().setVisible(true);
    } catch (Exception e) {
      resetLogin();
      NULogger.getLogger().log(Level.SEVERE, "{0}: {1}", new Object[] {getClass().getName(), e});
      showWarningMessage(Translation.T().loginerror(), HOSTNAME);
      accountUIShow().setVisible(true);
    }
  }

  private void initialize() throws Exception {
    httpContext = new BasicHttpContext();
    cookieStore = new BasicCookieStore();
    httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);

    NULogger.getLogger().info("Getting startup cookies & link from OpenLoad.co");
    responseString = NUHttpClientUtils.getData("https://openload.co/login", httpContext);
    doc = Jsoup.parse(responseString);

    csrfToken = doc.select("form[id=login-form]").first().select("input[name=_csrf]").attr("value");
  }

  private void resetLogin() {
    loginsuccessful = false;
    username = "";
    password = "";
  }

  private void setupSsl() {
    SSLSocketFactory sf = null;
    SSLContext sslContext = null;

    try {
      sslContext = SSLContext.getInstance("TLS");
      sslContext.init(null, null, null);
    } catch (NoSuchAlgorithmException e) {
      NULogger.getLogger().log(Level.SEVERE, "OpenLoad.co -> SSL error", e);
    } catch (KeyManagementException e) {
      NULogger.getLogger().log(Level.SEVERE, "OpenLoad.co -> SSL error", e);
    }

    try {
      sf = new SSLSocketFactory(sslContext, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);

    } catch (Exception e) {
      NULogger.getLogger().log(Level.SEVERE, "OpenLoad.co -> SSL error", e);
    }

    Scheme scheme = new Scheme("https", 443, sf);
    httpclient.getConnectionManager().getSchemeRegistry().register(scheme);
  }
}