@SuppressWarnings({"unchecked", "deprecation"})
  public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress)
      throws Exception {
    ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
    final String parameter = param.toString();
    jd.plugins.hoster.AmpyaCom.initializeSession(this.br);

    br.getPage(jd.plugins.hoster.AmpyaCom.getApiUrl(parameter));
    if (br.getHttpConnection().getResponseCode() == 404) {
      decryptedLinks.add(this.createOfflinelink(parameter));
      return decryptedLinks;
    }

    String fpName = null;
    LinkedHashMap<String, Object> entries =
        (LinkedHashMap<String, Object>) JavaScriptEngineFactory.jsonToJavaObject(br.toString());
    final ArrayList<Object> ressourcelist = (ArrayList<Object>) entries.get("clips");
    for (final Object clipo : ressourcelist) {
      entries = (LinkedHashMap<String, Object>) clipo;
      final String title = (String) entries.get("title");
      final String artist = (String) entries.get("artist_name");
      final String video_id =
          Long.toString(JavaScriptEngineFactory.toLong(entries.get("video_id"), 0));
      if (fpName == null) {
        fpName = (String) entries.get("container_title");
      }
      if (title == null || artist == null || "0".equals(video_id)) {
        continue;
      }
      final DownloadLink dl =
          this.createDownloadlink(
              "http://ampyadecrypted.com/"
                  + System.currentTimeMillis()
                  + new Random().nextInt(1000000000));
      String filename = artist + " - " + title + ".mp4";
      filename = encodeUnicode(filename);
      dl.setFinalFileName(filename);
      dl.setAvailable(true);
      dl.setContentUrl(parameter);
      dl.setProperty("mainlink", parameter);
      dl.setProperty("videoid", video_id);
      decryptedLinks.add(dl);
    }

    if (fpName != null) {
      final FilePackage fp = FilePackage.getInstance();
      fp.setName(Encoding.htmlDecode(fpName.trim()));
      fp.addLinks(decryptedLinks);
    }

    return decryptedLinks;
  }
Exemple #2
0
  @SuppressWarnings({"unchecked", "rawtypes"})
  public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress)
      throws Exception {
    final ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
    final String parameter = param.toString().replace("http://", "https://");
    final String fid = new Regex(parameter, "/p/([A-Za-z0-9\\-_]+)").getMatch(0);
    String subfolder = new Regex(parameter, "#dir=(.+)").getMatch(0);
    if (subfolder == null) {
      subfolder = "/";
    } else {
      subfolder = Encoding.htmlDecode(subfolder);
    }
    subfolder = Encoding.urlEncode(subfolder);
    if (fid == null) {
      decryptedLinks.add(createOfflinelink(parameter));
      return decryptedLinks;
    }
    this.br.getPage(parameter);
    final String pageJson = jd.plugins.hoster.JianguoyunCom.getWebsiteJson(this.br);
    DownloadLink dl = null;
    final String isdir =
        new Regex(pageJson, "isdir[\t\n\r ]*?:[\t\n\r ]*?(true|false)").getMatch(0);
    if ("false".equals(isdir)) {
      /* Single file */
      dl =
          createDownloadlink(
              "http://jianguoyundecrypted.com/"
                  + System.currentTimeMillis()
                  + new Random().nextInt(100000));
      dl.setProperty("singlefile", true);
      dl.setProperty("folderid", fid);
      dl.setProperty("relPath", subfolder);
      dl.setProperty("mainlink", parameter);
      jd.plugins.hoster.JianguoyunCom.scanFileinfoFromWebsite(this.br, dl);
      decryptedLinks.add(dl);
      return decryptedLinks;
    }

    this.br.getPage(
        "https://www.jianguoyun.com/d/ajax/dirops/pubDIRBrowse?hash="
            + fid
            + "&relPath="
            + subfolder
            + "&_="
            + System.currentTimeMillis());
    LinkedHashMap<String, Object> entries =
        (LinkedHashMap<String, Object>) JavaScriptEngineFactory.jsonToJavaObject(br.toString());
    final ArrayList<Object> ressourcelist = (ArrayList) entries.get("objects");
    for (final Object foldero : ressourcelist) {
      entries = (LinkedHashMap<String, Object>) foldero;
      final String type = (String) entries.get("type");
      final String relPath = (String) entries.get("relPath");
      final long filesize = JavaScriptEngineFactory.toLong(entries.get("size"), 0);
      if (type == null || relPath == null) {
        continue;
      }
      if (type.equals("directory")) {
        dl =
            createDownloadlink(
                "https://www.jianguoyun.com/p/" + fid + "#dir=" + Encoding.urlEncode(relPath));
      } else {
        dl =
            createDownloadlink(
                "http://jianguoyundecrypted.com/"
                    + System.currentTimeMillis()
                    + new Random().nextInt(100000));
        final Regex pathregex = new Regex(relPath, "^(/.*?)([^/]+)$");
        final String contenturl =
            "https://www.jianguoyun.com/p/"
                + fid
                + "#dir="
                + Encoding.urlEncode(pathregex.getMatch(0));
        final String filename = pathregex.getMatch(1);
        if (filesize > 0) {
          dl.setDownloadSize(filesize);
          dl.setAvailable(true);
        }
        if (filename != null) {
          dl.setName(filename);
        }
        dl.setProperty("folderid", fid);
        dl.setProperty("relPath", relPath);
        dl.setProperty("mainlink", parameter);
        dl.setContentUrl(contenturl);
        dl.setLinkID(fid + relPath);
        dl.setProperty(DownloadLink.RELATIVE_DOWNLOAD_FOLDER_PATH, relPath);
      }
      decryptedLinks.add(dl);
    }

    return decryptedLinks;
  }
  public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress)
      throws Exception {
    final ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
    br.setFollowRedirects(true);
    final String parameter = param.toString().replace("#", "");

    if (parameter.matches(
        "https?://(?:www\\.)?ge\\.tt/(?:developers|press|tools|notifications|blog|about|javascript|button|contact|terms|api|m).*?")) {
      decryptedLinks.add(this.createOfflinelink(parameter));
      return decryptedLinks;
    }

    br.setAllowedResponseCodes(410);
    br.getPage(parameter);

    if (this.br.getHttpConnection().getResponseCode() == 404
        || this.br.getHttpConnection().getResponseCode() == 410
        || br.containsHTML(
            "Page not found|The page you were looking for was not found|Files removed|These files have been removed by the owner")) {
      decryptedLinks.add(this.createOfflinelink(parameter));
      return decryptedLinks;
    }

    // final String singleFile = new Regex(parameter, "/v/(\\d+)").getMatch(0);
    final String folderid = new Regex(parameter, "ge\\.tt/([A-Za-z0-9]+)(/v/\\d+)?").getMatch(0);
    br.getHeaders().put("Accept", "application/json, text/plain, */*");
    br.getPage("//api.ge.tt/1/shares/" + folderid);

    LinkedHashMap<String, Object> entries =
        (LinkedHashMap<String, Object>) JavaScriptEngineFactory.jsonToJavaMap(br.toString());
    final String error = (String) entries.get("error");

    if (error != null || br.containsHTML(">404 Not Found<")) {
      final DownloadLink dlink = this.createOfflinelink(parameter);
      decryptedLinks.add(dlink);
      return decryptedLinks;
    }

    final ArrayList<Object> files = (ArrayList<Object>) entries.get("files");

    for (final Object fileo : files) {
      entries = (LinkedHashMap<String, Object>) fileo;
      final String filename = (String) entries.get("filename");
      final String fileid = (String) entries.get("fileid");
      final long filesize = JavaScriptEngineFactory.toLong(entries.get("size"), 0);
      final DownloadLink dl =
          createDownloadlink(
              "http://proxy.ge.tt/1/files/" + folderid + "/" + fileid + "/blob?download");
      dl.setContentUrl("http://ge.tt/" + folderid);
      dl.setName(filename);
      dl.setDownloadSize(filesize);
      dl.setAvailable(true);
      decryptedLinks.add(dl);
    }

    if (decryptedLinks == null || decryptedLinks.size() == 0) {
      logger.info("ge.tt: Folder is empty! Link: " + parameter);
      final DownloadLink dlink = this.createOfflinelink(parameter);
      decryptedLinks.add(dlink);
      return decryptedLinks;
    }
    return decryptedLinks;
  }
Exemple #4
0
  @SuppressWarnings({"deprecation", "unchecked"})
  @Override
  public boolean checkLinks(final DownloadLink[] urls) {
    if (urls == null || urls.length == 0) {
      return false;
    }
    try {
      br.setCookiesExclusive(true);
      final StringBuilder sb = new StringBuilder();
      final ArrayList<DownloadLink> links = new ArrayList<DownloadLink>();
      int index = 0;
      int tempcounter = 0;
      while (true) {
        /* Reset tempcounter */
        tempcounter = 0;
        links.clear();
        while (true) {
          /* we test 10 links at once (max = 10) */
          if (index == urls.length || links.size() > 9) {
            break;
          }
          links.add(urls[index]);
          index++;
        }
        sb.delete(0, sb.capacity());
        sb.append("links=");
        for (final DownloadLink dl : links) {
          sb.append(Encoding.urlEncode(dl.getDownloadURL()));
          if (tempcounter < links.size() - 1) {
            sb.append(Encoding.urlEncode("\n"));
          }
          tempcounter++;
        }
        /* Reset tempcounter */
        tempcounter = 0;

        postPage(getAPIProtocol() + this.getHost() + "/download/json_check", sb.toString());
        LinkedHashMap<String, Object> entries = null;
        final ArrayList<Object> ressourcelist =
            (ArrayList<Object>) JavaScriptEngineFactory.jsonToJavaObject(br.toString());
        final String[] json_workaround_array = br.toString().split("\\},\\{");
        for (final DownloadLink dl : links) {
          final String state;
          final String filename;
          final long filesize;
          if (tempcounter <= json_workaround_array.length - 1) {
            entries = (LinkedHashMap<String, Object>) ressourcelist.get(tempcounter);
            state = (String) entries.get("status");
            filename = (String) entries.get("filename");
            filesize = JavaScriptEngineFactory.toLong(entries.get("filesize"), 0);
          } else {
            state = null;
            filename = null;
            filesize = 0;
          }
          if ("offline".equals(state) || state == null) {
            dl.setAvailable(false);
          } else {
            dl.setAvailable(true);
          }
          /* Trust API - offline urls can still have their filename- and size information available */
          if (filename != null) {
            dl.setFinalFileName(filename);
          }
          dl.setDownloadSize(filesize);

          tempcounter++;
        }
        if (index == urls.length) {
          break;
        }
      }
    } catch (final Exception e) {
      return false;
    }
    return true;
  }