Пример #1
0
 private void checkShowFreeDialog() {
   SubConfiguration config = null;
   try {
     config = getPluginConfig();
     if (config.getBooleanProperty("premAdShown", Boolean.FALSE) == false) {
       if (config.getProperty("premAdShown2") == null) {
         File checkFile = JDUtilities.getResourceFile("tmp/cldzn");
         if (!checkFile.exists()) {
           checkFile.mkdirs();
           showFreeDialog("cloudzer.net");
         }
       } else {
         config = null;
       }
     } else {
       config = null;
     }
   } catch (final Throwable e) {
   } finally {
     if (config != null) {
       config.setProperty("premAdShown", Boolean.TRUE);
       config.setProperty("premAdShown2", "shown");
       config.save();
     }
   }
 }
  public JDSimpleWebserver() {
    SubConfiguration subConfig = SubConfiguration.getConfig("WEBINTERFACE");
    Boolean https = subConfig.getBooleanProperty(JDWebinterface.PROPERTY_HTTPS, false);
    AuthUser =
        "******"
            + Encoding.Base64Encode(
                subConfig.getStringProperty(JDWebinterface.PROPERTY_USER, "JD")
                    + ":"
                    + subConfig.getStringProperty(JDWebinterface.PROPERTY_PASS, "JD"));
    NeedAuth = subConfig.getBooleanProperty(JDWebinterface.PROPERTY_LOGIN, true);
    boolean localhostonly =
        subConfig.getBooleanProperty(JDWebinterface.PROPERTY_LOCALHOST_ONLY, false);
    int port = subConfig.getIntegerProperty(JDWebinterface.PROPERTY_PORT, 8765);
    try {
      if (!https) {
        if (localhostonly) {
          Server_Socket = new ServerSocket(port, -1, HttpServer.getLocalHost());
        } else {
          Server_Socket = new ServerSocket(port);
        }
      } else {
        try {
          ServerSocketFactory ssocketFactory = setupSSL();

          if (localhostonly) {
            Server_Socket = ssocketFactory.createServerSocket(port, -1, HttpServer.getLocalHost());
          } else {
            Server_Socket = ssocketFactory.createServerSocket(port);
          }
        } catch (Exception e) {
          logger.severe("WebInterface: Server failed to start (SSL Setup Failed)!");
          return;
        }
      }
      logger.info("Webinterface: Server started");
      start();
    } catch (IOException e) {
      logger.severe("WebInterface: Server failed to start!");
    }
  }
Пример #3
0
  public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress)
      throws Exception {
    ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
    final String parameter = param.toString();
    JDUtilities.getPluginForHost("sta.sh");
    final SubConfiguration cfg = SubConfiguration.getConfig("sta.sh");
    final boolean force_html_dl = cfg.getBooleanProperty(FORCEHTMLDOWNLOAD, false);
    final boolean linkid_as_filename = cfg.getBooleanProperty(USE_LINKID_AS_FILENAME, false);
    final String main_linkid = new Regex(parameter, "sta\\.sh/(.+)").getMatch(0);
    final DownloadLink main = createDownloadlink(parameter.replace("sta.sh/", "stadecrypted.sh/"));
    if (parameter.matches(INVALIDLINKS)) {
      main.setAvailable(false);
      decryptedLinks.add(main);
      return decryptedLinks;
    }
    try {
      br.getPage(parameter);
    } catch (final BrowserException e) {
      main.setAvailable(false);
      decryptedLinks.add(main);
      return decryptedLinks;
    }
    final String[][] picdata =
        br.getRegex(
                "class=\"thumb\" href=\"(https?://(www\\.)?sta\\.sh/[a-z0-9]+)\" title=\"([^<>\"]*?)\"")
            .getMatches();
    if (picdata == null || picdata.length == 0) {
      decryptedLinks.add(main);
      return decryptedLinks;
    }

    String fpName = br.getRegex("name=\"og:title\" content=\"([^<>\"]*?)\"").getMatch(0);
    if (fpName == null) {
      fpName = new Regex(parameter, "([a-z0-9]+)$").getMatch(0);
    }
    fpName = Encoding.htmlDecode(fpName.trim());

    for (final String singleLinkData[] : picdata) {
      final String url = singleLinkData[0];
      final String linkid = new Regex(url, "sta\\.sh/(.+)").getMatch(0);
      String name = Encoding.htmlDecode(singleLinkData[2]);
      final DownloadLink dl = createDownloadlink(url.replace("sta.sh/", "stadecrypted.sh/"));
      /* Obey user setting */
      if (linkid_as_filename) {
        name = linkid;
      }
      if (force_html_dl) {
        dl.setName(name + ".html");
        dl.setAvailable(true);
      } else {
        /* No ext found --> Don't set available, let host plugin perform a full check to find the correct name */
        final String ext = jd.plugins.hoster.StaSh.getFileExt(this.br);
        if (ext != null) {
          dl.setName(name + "." + ext);
          dl.setAvailable(true);
        } else {
          dl.setName(name);
        }
      }
      decryptedLinks.add(dl);
    }
    final String zipLink = br.getRegex("\"(/zip/[a-z0-9]+)\"").getMatch(0);
    if (cfg.getBooleanProperty(DOWNLOAD_ZIP, false) && zipLink != null) {
      final DownloadLink zip = createDownloadlink(parameter.replace("sta.sh/", "stadecrypted.sh/"));
      zip.setProperty("iszip", true);
      zip.setProperty("directlink", zipLink);
      String zip_filename;
      if (linkid_as_filename) {
        zip_filename = main_linkid;
      } else {
        zip_filename = fpName;
      }
      if (force_html_dl) {
        zip.setName(zip_filename + ".html");
      } else {
        zip.setName(zip_filename + ".zip");
      }
      zip.setAvailable(true);
      decryptedLinks.add(zip);
    }
    final FilePackage fp = FilePackage.getInstance();
    fp.setName(fpName);
    fp.addLinks(decryptedLinks);
    return decryptedLinks;
  }
Пример #4
0
  /** TODO: Fix/implement subtitle support */
  @SuppressWarnings({"deprecation", "unchecked", "rawtypes"})
  public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress)
      throws Exception {
    final String parameter = param.toString();
    String contentID = null;
    String thisvideoID = null;
    String show = null;
    String json = null;
    String videoplayerkey = null;
    String referenceID = null;
    String bitrate = null;
    LinkedHashMap<String, Object> entries = null;
    ArrayList<Object> ressourcelist = null;
    ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
    final LinkedHashMap<String, String[]> formats = jd.plugins.hoster.DiscoveryCom.formats;
    final String host_nice = new Regex(parameter, "http://(?:www\\.)?([^/]+)").getMatch(0);
    final String host_plain = host_nice.replace(".com", "");
    final String decryptedhost = "http://" + host_nice + "decrypted";
    final SubConfiguration cfg = SubConfiguration.getConfig(DOMAIN);
    final boolean grabSubtitle = cfg.getBooleanProperty(GRAB_SUBTITLE, false);
    final boolean fastLinkcheck = cfg.getBooleanProperty(FAST_LINKCHECK, false);
    br.setFollowRedirects(true);
    br.getPage(parameter);
    if (br.getRequest().getHttpConnection().getResponseCode() == 404) {
      final DownloadLink dl = this.createOfflinelink(parameter);
      decryptedLinks.add(dl);
      return decryptedLinks;
    }
    json = this.br.cloneBrowser().getPage(this.br.getURL() + "?flat=1");
    if (json == null) {
      logger.warning("Decrypter broken for link: " + parameter);
      return null;
    }
    entries =
        (LinkedHashMap<String, Object>)
            jd.plugins.hoster.DummyScriptEnginePlugin.jsonToJavaObject(json);
    videoplayerkey = (String) entries.get("video_player_key");
    if (videoplayerkey == null) {
      videoplayerkey = playerKey;
    }
    ressourcelist = (ArrayList) entries.get("playlist");
    for (final Object plo : ressourcelist) {
      final LinkedHashMap<String, Object> playlist_entry = (LinkedHashMap<String, Object>) plo;
      final String thumbnail = (String) playlist_entry.get("thumbnailURL");
      final Object thisvideoIDo = playlist_entry.get("_id");
      String entryname = (String) playlist_entry.get("name");
      String description = (String) playlist_entry.get("description");
      contentID = (String) playlist_entry.get("contentId");
      if (thisvideoIDo instanceof Integer) {
        thisvideoID = Integer.toString(((Number) thisvideoIDo).intValue());
      } else {
        thisvideoID = (String) thisvideoIDo;
      }
      show = (String) playlist_entry.get("show");
      referenceID = (String) playlist_entry.get("referenceId");
      if (thisvideoID == null
          || show == null
          || entryname == null
          || thumbnail == null
          || referenceID == null) {
        logger.warning("Decrypter broken for link: " + parameter);
        return null;
      }
      show = encodeUnicode(show);
      entryname = encodeUnicode(entryname);
      if (contentID != null && !contentID.equals("")) {
        /* contentID available --> Easy parsing */
        br.getPage(
            "http://snagplayer.video.dp."
                + host_plain
                + ".com/"
                + contentID
                + "/snag-it-player.htm?auto=yes&_fwEnv=prod");
        json = br.getRegex("var videoListJSON = (\\{.*?\\});\n").getMatch(0);
        if (json == null) {
          logger.warning("Decrypter broken for link: " + parameter);
          return null;
        }
        final HashMap<String, Object> videomap =
            (HashMap<String, Object>)
                jd.plugins.hoster.DummyScriptEnginePlugin.jsonToJavaObject(json);
        final long videosCount =
            jd.plugins.hoster.DummyScriptEnginePlugin.toLong(videomap.get("count"), 0);
        if (videosCount <= 0) {
          logger.info("Found no videos for contentID: " + contentID);
          continue;
        }
        final ArrayList<Object> episodelist = (ArrayList) videomap.get("clips");
        for (final Object o : episodelist) {
          String dllink = null;
          final HashMap<String, Object> vinfo = (HashMap<String, Object>) o;
          final ArrayList<Object> vurls = (ArrayList) vinfo.get("mp4");
          String titleseries = (String) vinfo.get("programTitle");
          String titleepisode = (String) vinfo.get("episodeTitle");
          description = (String) vinfo.get("videoCaption");
          final String subtitle = (String) vinfo.get("srtUrl");
          if (titleseries == null || titleepisode == null) {
            return null;
          }
          titleseries = encodeUnicode(titleseries);
          titleepisode = encodeUnicode(titleepisode);
          final String filenamepart = titleseries + " - " + titleepisode;
          final FilePackage fp = FilePackage.getInstance();
          fp.setName(filenamepart);
          DownloadLink dl = null;
          for (final Object urlo : vurls) {
            dl =
                createDownloadlink(
                    decryptedhost + System.currentTimeMillis() + new Random().nextInt(1000000000));
            final HashMap<String, Object> urlinfo = (HashMap<String, Object>) urlo;
            bitrate = (String) urlinfo.get("bitrate");
            dllink = (String) urlinfo.get("href");
            try {
              getFormatString(formats.get(bitrate));
            } catch (final Throwable e) {
              logger.info("currentBITRATE:" + bitrate);
            }
            final String filenamepart_two =
                filenamepart + "_" + getFormatString(formats.get(bitrate));
            try {
              dl.setContentUrl(parameter);
              if (description != null) {
                dl.setComment(description);
              }
            } catch (final Throwable e) {
              /* Not available in old 0.9.581 Stable */
            }
            dl._setFilePackage(fp);
            dl.setProperty("bitrate", bitrate);
            dl.setProperty("mainlink", parameter);
            final String filenamevideo = filenamepart_two + ".mp4";
            /* Video */
            dl.setFinalFileName(filenamevideo);
            dl.setProperty("directlink", dllink);
            dl.setProperty("directfilename", filenamevideo);
            dl.setLinkID(filenamevideo);
            if (fastLinkcheck) {
              dl.setAvailable(true);
            }
            if (cfg.getBooleanProperty(bitrate, false)) {
              decryptedLinks.add(dl);
            }

            // final String filenameaudio = filenamepart_two + ".srt";
            // /* Subtitle */
            // dl.setUrlDownload(decryptedhost + System.currentTimeMillis() + new
            // Random().nextInt(1000000000));
            // dl.setFinalFileName(filenameaudio);
            // dl.setProperty("directlink", subtitle);
            // dl.setProperty("directfilename", filenameaudio);
            // dl.setLinkID(filenameaudio);
            // if (fastLinkcheck) {
            // dl.setAvailable(true);
            // }
            // if (grabSubtitle && !inValidate(subtitle)) {
            // decryptedLinks.add(dl);
            // }
          }
        }
      } else {
        /* contentID NOT available --> Brightcove handling needed --> Nope we can easily avoid this :) */
        /* AMF-Request */
        this.br.getHeaders().put("Content-Type", "application/x-amf");
        getAMFRequest(
            this.br,
            createAMFMessage(
                "ca38f4f2cff16b53daa67436490b7d344d4f222c",
                playerID,
                referenceID,
                video_player_brightcove_id),
            videoplayerkey);
        final String filenamepart = show + " - " + entryname;
        final FilePackage fp = FilePackage.getInstance();
        fp.setName(filenamepart);
        final String[] urls =
            br.getRegex(
                    "(http://discsmil\\.edgesuite\\.net/digmed/dsc/\\d+/[A-Za-z0-9\\-_\\.]+\\-\\d+k\\.mp4)")
                .getColumn(0);
        for (final String dllink : urls) {
          final DownloadLink dl =
              createDownloadlink(
                  decryptedhost + System.currentTimeMillis() + new Random().nextInt(1000000000));
          bitrate = new Regex(dllink, "(\\d+k)\\.mp4$").getMatch(0);
          final String filenamepart_two =
              filenamepart + "_" + getFormatString(formats.get(bitrate));
          try {
            dl.setContentUrl(parameter);
            if (description != null) {
              dl.setComment(description);
            }
          } catch (final Throwable e) {
            /* Not available in old 0.9.581 Stable */
          }
          dl._setFilePackage(fp);
          dl.setProperty("bitrate", bitrate);
          dl.setProperty("mainlink", parameter);
          final String filenamevideo = filenamepart_two + ".mp4";
          /* Video */
          dl.setFinalFileName(filenamevideo);
          dl.setProperty("directlink", dllink);
          dl.setProperty("directfilename", filenamevideo);
          dl.setLinkID(filenamevideo);
          if (fastLinkcheck) {
            dl.setAvailable(true);
          }
          if (cfg.getBooleanProperty(bitrate, false)) {
            decryptedLinks.add(dl);
          }
        }
      }
    }
    if (decryptedLinks.size() == 0) {
      logger.info(
          DOMAIN
              + ": None of the selected formats were found or none were selected, decrypting done...");
      return decryptedLinks;
    }
    return decryptedLinks;
  }