예제 #1
0
 private void getDllink(final String linkPart) throws IOException {
   final String vkey = new Regex(Encoding.htmlDecode(linkPart), "vkey=([0-9a-f]+)").getMatch(0);
   br.getPage(
       "http://www.nuvid.com"
           + Encoding.htmlDecode(linkPart)
           + "&pkey="
           + JDHash.getMD5(vkey + Encoding.Base64Decode("aHlyMTRUaTFBYVB0OHhS")));
   dllink = br.getRegex("<video_file>(http://.*?)</video_file>").getMatch(0);
   if (dllink == null) {
     dllink =
         br.getRegex("<video_file><\\!\\[CDATA\\[(http://.*?)\\]\\]></video_file>").getMatch(0);
   }
 }
예제 #2
0
 private String convertToMediaVaultUrl(String url) {
   final Browser getTime = br.cloneBrowser();
   String time = null;
   try {
     getTime.getPage("http://assets.delvenetworks.com/time.php");
     time = getTime.getRegex("(\\d+)").getMatch(0);
   } catch (final Throwable e) {
   }
   if (time == null) {
     return null;
   }
   final int e = (int) Math.floor(Double.parseDouble(time) + 1500);
   url = url + "?e=" + e;
   final String h =
       JDHash.getMD5(Encoding.Base64Decode("Z0RuU1lzQ0pTUkpOaVdIUGh6dkhGU0RqTFBoMTRtUWc=") + url);
   url = url + "&h=" + h;
   return url;
 }
예제 #3
0
 private HashMap<String, String> callAPI(
     final Browser brr,
     final String action,
     final Account account,
     final HashMap<String, String> addParams)
     throws Exception {
   if (action == null || action.length() == 0) {
     return null;
   }
   Browser tbr = brr;
   if (tbr == null) {
     tbr = new Browser();
   }
   tbr.setDebug(true);
   final LinkedHashMap<String, String> post = new LinkedHashMap<String, String>();
   post.put("action", action);
   if (account != null) {
     /* do not remove */
     if (account.getPass() == null || account.getUser() == null)
       throw new PluginException(
           LinkStatus.ERROR_PREMIUM, PluginException.VALUE_ID_PREMIUM_DISABLE);
     final String pwMD5 = JDHash.getMD5(account.getPass().trim());
     post.put("passwordmd5", pwMD5);
     post.put("username", Encoding.urlEncode(account.getUser().trim()));
     // post.put("password",
     // Encoding.urlEncode(account.getPass().trim()));
   }
   if (addParams != null) {
     for (final String param : addParams.keySet()) {
       post.put(param, addParams.get(param));
     }
   }
   tbr.postPage("http://api.hotfile.com", post);
   final HashMap<String, String> ret = new HashMap<String, String>();
   ret.put("httpresponse", tbr.toString());
   final String vars[][] = tbr.getRegex("([^\r\n]*?)=([^\r\n]*?)(&|$)").getMatches();
   for (final String var[] : vars) {
     ret.put(var[0] != null ? var[0].trim() : null, var[1]);
   }
   return ret;
 }
예제 #4
0
 private void login(final Account account) throws PluginException, IOException {
   String username = Encoding.urlEncode(account.getUser());
   br.postPage(
       "http://crypt.twojlimit.pl",
       "username="******"&password="******"&info=1&site=twojlimit");
   String adres = br.toString();
   br.getPage(adres);
   adres = br.getRedirectLocation();
   br.getPage(adres);
   if (br.containsHTML("0=Nieprawidlowa nazwa uzytkownika/haslo")) {
     if ("de".equalsIgnoreCase(System.getProperty("user.language"))) {
       throw new PluginException(
           LinkStatus.ERROR_PREMIUM,
           "\r\nUngültiger Benutzername oder ungültiges Passwort!\r\nDu bist dir sicher, dass dein eingegebener Benutzername und Passwort stimmen? Versuche folgendes:\r\n1. Falls dein Passwort Sonderzeichen enthält, ändere es (entferne diese) und versuche es erneut!\r\n2. Gib deine Zugangsdaten per Hand (ohne kopieren/einfügen) ein.",
           PluginException.VALUE_ID_PREMIUM_DISABLE);
     } else {
       throw new PluginException(
           LinkStatus.ERROR_PREMIUM,
           "\r\nInvalid username/password!\r\nYou're sure that the username and password you entered are correct? Some hints:\r\n1. If your password contains special characters, change it (remove them) and try again!\r\n2. Type in your username/password by hand without copy & paste.",
           PluginException.VALUE_ID_PREMIUM_DISABLE);
     }
   }
   if (this.br.containsHTML("balance")) {
     Info = br.toString();
   }
   if (this.br.containsHTML("expire")) {
     char temp = Info.charAt(Info.length() - 11);
     validUntil = Info.substring(Info.length() - 10);
     expired = temp != '1';
   } else {
     expired = false;
   }
   if (GetTrasferLeft(br.toString()) > 10) {
     expired = false;
   }
 }
예제 #5
0
 private String checkMD2(final String time) {
   return JDHash.getMD5(time + Encoding.Base64Decode(AHV));
 }
예제 #6
0
 private String checkMD(final String videoUrl, final String time) {
   return JDHash.getMD5(videoUrl + time + Encoding.Base64Decode(AHV));
 }
예제 #7
0
  /** no override to keep plugin compatible to old stable */
  public void handleMultiHost(final DownloadLink link, final Account account) throws Exception {

    synchronized (hostUnavailableMap) {
      HashMap<String, Long> unavailableMap = hostUnavailableMap.get(account);
      if (unavailableMap != null) {
        Long lastUnavailable = unavailableMap.get(link.getHost());
        if (lastUnavailable != null && System.currentTimeMillis() < lastUnavailable) {
          final long wait = lastUnavailable - System.currentTimeMillis();
          throw new PluginException(
              LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE,
              "Host is temporarily unavailable via " + this.getHost(),
              wait);
        } else if (lastUnavailable != null) {
          unavailableMap.remove(link.getHost());
          if (unavailableMap.size() == 0) {
            hostUnavailableMap.remove(account);
          }
        }
      }
    }

    showMessage(link, "Phase 1/3: Login");
    login(account);
    if (expired) {
      account.setValid(false);
      throw new PluginException(LinkStatus.ERROR_RETRY);
    }
    br.setConnectTimeout(90 * 1000);
    br.setReadTimeout(90 * 1000);
    br.setDebug(true);
    dl = null;
    /* generate new downloadlink */
    String username = Encoding.urlEncode(account.getUser());
    String url = Encoding.urlEncode(link.getDownloadURL());
    String postData =
        "username="******"&password="******"&info=0&url="
            + url
            + "&site=twojlimit";
    showMessage(link, "Phase 2/3: Generating Link");
    String genlink = br.postPage("http://crypt.twojlimit.pl", postData);

    // link.setProperty("apilink", response);
    if (!(genlink.startsWith("http://") || genlink.startsWith("https://"))) {
      logger.severe("Twojlimit.pl(Error): " + genlink);
      /*
       * after x retries we disable this host and retry with normal plugin
       */
      if (link.getLinkStatus().getRetryCount() >= 3) {
        try {
          // disable hoster for 30min
          tempUnavailableHoster(account, link, 30 * 60 * 1000l);
        } catch (Exception e) {
        }
        /* reset retrycounter */
        link.getLinkStatus().setRetryCount(0);
        throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE);
      }
      String msg = "(" + link.getLinkStatus().getRetryCount() + 1 + "/" + 3 + ")";

      throw new PluginException(
          LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Retry in few secs" + msg, 20 * 1000l);
    }
    br.setFollowRedirects(true);
    // wait, workaround
    sleep(1 * 1000l, link);
    dl = jd.plugins.BrowserAdapter.openDownload(br, link, genlink, true, 1);
    /*
     * I realy wanted to use Content Disposition below, but it just don't work for resume at hotfile -> Doesn't matter anymore, hotfile
     * is offline
     */
    if (dl.getConnection().getContentType().equalsIgnoreCase("text/html")) // unknown
    // error
    {
      br.followConnection();
      if (br.getBaseURL().contains("notransfer")) {
        /* No transfer left */
        account.setValid(false);
        throw new PluginException(LinkStatus.ERROR_RETRY);
      }
      if (br.getBaseURL().contains("serviceunavailable")) {
        tempUnavailableHoster(account, link, 60 * 60 * 1000l);
      }
      if (br.getBaseURL().contains("connecterror")) {
        tempUnavailableHoster(account, link, 60 * 60 * 1000l);
      }
      if (br.getBaseURL().contains("invaliduserpass")) {
        account.setValid(false);
        throw new PluginException(LinkStatus.ERROR_RETRY, "Invalid username or password.");
      }
      if (br.getBaseURL().contains("notfound")) {
        throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND, "File not found.");
      }
      if (br.containsHTML("15=Hosting nie obslugiwany")) {
        /* Unsupported host */
        tempUnavailableHoster(account, link, 3 * 60 * 60 * 1000l);
      }
    }

    if (dl.getConnection().getResponseCode() == 404) {
      /* file offline (?) */
      dl.getConnection().disconnect();
      tempUnavailableHoster(account, link, 20 * 60 * 1000l);
    }
    showMessage(link, "Phase 3/3: Begin download");
    dl.startDownload();
  }