public static final HashSet<String> handleBase64Decode(final String b64) {
   if (b64 == null) {
     return null;
   }
   final HashSet<String> results = new HashSet<String>();
   String finallink = b64;
   int i = 0;
   // this covers nested encoding.
   while (i < 20 && finallink != null && !new Regex(finallink, "(?:ftp|https?)://.+").matches()) {
     i++;
     // cleanup crap after padding. this can break subsequent tries
     finallink = Encoding.Base64Decode(finallink.replaceFirst("(={1,2})[\\w\\+]+$", "$1"));
     // urldecode
     if (finallink != null && new Regex(finallink, "%[0-9A-Fa-f]{2}").matches()) {
       finallink = Encoding.urlDecode(finallink, false);
     }
     // whitespace cleanup
     finallink = StringUtils.trim(finallink);
   }
   // determine multi or single result?
   final String[] multi = new Regex(finallink, "(?:https?|ftp)://").getColumn(-1);
   if (multi != null && multi.length > 1) {
     // because links might not be separated or deliminated, its best to use htmlparser
     final String[] links = HTMLParser.getHttpLinks(finallink, "");
     if (links != null) {
       for (final String link : links) {
         results.add(link);
       }
     }
   } else {
     results.add(finallink);
   }
   return results;
 }
示例#2
0
 /** Other way to get direct downloadlinks: http://www.moviesand.com/emconfig/ +videoID */
 @SuppressWarnings("deprecation")
 @Override
 public AvailableStatus requestFileInformation(final DownloadLink downloadLink)
     throws IOException, PluginException {
   this.setBrowserExclusive();
   br.setFollowRedirects(true);
   br.getPage(downloadLink.getDownloadURL());
   if (br.getURL().equals("http://www.moviesand.com/404.php")
       || br.containsHTML("Page Not Found<")) {
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   }
   String filename =
       br.getRegex("<title>MoviesAnd \\- ([^<>\"]*?) \\- Better than YouPorn and RedTube</title>")
           .getMatch(0);
   if (filename == null) {
     filename =
         br.getRegex("itemprop=\"title\" style=\"color: #46A5F1;\">([^<>\"]*?)</span>")
             .getMatch(0);
   }
   DLLINK =
       br.getRegex("\\'(?:file|video)\\'[\t\n\r ]*?:[\t\n\r ]*?\\'(http[^<>\"]*?)\\'").getMatch(0);
   if (DLLINK == null) {
     DLLINK =
         br.getRegex("(?:file|url):[\t\n\r ]*?(?:\"|\\')(http[^<>\"]*?)(?:\"|\\')").getMatch(0);
   }
   if (DLLINK == null) {
     DLLINK =
         br.getRegex(
                 "<source src=\"(https?://[^<>\"]*?)\" type=(?:\"|\\')video/(?:mp4|flv)(?:\"|\\')")
             .getMatch(0);
   }
   if (filename == null || DLLINK == null) {
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   DLLINK = Encoding.htmlDecode(DLLINK);
   filename = filename.trim();
   String ext = DLLINK.substring(DLLINK.lastIndexOf("."));
   if (ext == null || ext.length() > 5) {
     ext = ".flv";
   }
   downloadLink.setFinalFileName(Encoding.htmlDecode(filename) + ext);
   Browser br2 = br.cloneBrowser();
   // In case the link redirects to the finallink
   br2.setFollowRedirects(true);
   URLConnectionAdapter con = null;
   try {
     con = br2.openGetConnection(DLLINK);
     if (!con.getContentType().contains("html")) {
       downloadLink.setDownloadSize(con.getLongContentLength());
     } else {
       throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
     }
     return AvailableStatus.TRUE;
   } finally {
     try {
       con.disconnect();
     } catch (Throwable e) {
     }
   }
 }
示例#3
0
 @Override
 public AvailableStatus requestFileInformation(final DownloadLink downloadLink)
     throws IOException, PluginException {
   this.setBrowserExclusive();
   br.setFollowRedirects(true);
   br.getPage(downloadLink.getDownloadURL());
   if (br.getURL().contains("errorid="))
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   String filename = br.getRegex("property=\"og:title\" content=\"([^<>\"]*?)\"").getMatch(0);
   if (filename == null)
     filename =
         br.getRegex("<title>([^<>\"]*?) Listen \\& Download \\- ZippyTune</title>").getMatch(0);
   DLLINK = "https://www.zippytune.com/audiostream/" + getFid(downloadLink) + ".mp3";
   if (filename == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   DLLINK = Encoding.htmlDecode(DLLINK);
   filename = filename.trim();
   final String ext = ".mp3";
   downloadLink.setFinalFileName(Encoding.htmlDecode(filename) + ext);
   final Browser br2 = br.cloneBrowser();
   // In case the link redirects to the finallink
   br2.setFollowRedirects(true);
   URLConnectionAdapter con = null;
   try {
     con = br2.openGetConnection(DLLINK);
     if (!con.getContentType().contains("html"))
       downloadLink.setDownloadSize(con.getLongContentLength());
     else throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
     return AvailableStatus.TRUE;
   } finally {
     try {
       con.disconnect();
     } catch (Throwable e) {
     }
   }
 }
示例#4
0
 @Override
 public AvailableStatus requestFileInformation(final DownloadLink downloadLink)
     throws IOException, PluginException {
   this.setBrowserExclusive();
   br.setFollowRedirects(true);
   br.getPage(downloadLink.getDownloadURL() + "?hd");
   if (br.getHttpConnection().getResponseCode() == 404 || !br.containsHTML("new SWFObject")) {
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   }
   final String date = br.getRegex("<div class=\"sub\">[\t\n\r ]+([^<>\"/]*?) /").getMatch(0);
   final String xml = br.getRegex("\"(/video/playlist/\\d+(/(hd|sd))?\\.xml)\"").getMatch(0);
   if (xml == null || date == null) {
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   br.getPage("http://www.gamer.nl" + xml);
   String filename = br.getRegex("<title>([^<>]*?)</title>").getMatch(0);
   DLLINK = br.getRegex("<media:content url=\"(https?://[^<>\"]*?)\" />").getMatch(0);
   if (filename == null || DLLINK == null) {
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   DLLINK = Encoding.htmlDecode(DLLINK);
   filename = Encoding.htmlDecode(filename);
   filename = filename.trim();
   filename = encodeUnicode(filename);
   String ext = DLLINK.substring(DLLINK.lastIndexOf("."));
   if (ext == null || ext.length() > 5) {
     ext = ".mp4";
   }
   if (this.getPluginConfig().getBooleanProperty(DATE_IN_FILENAME, false)) {
     filename = encodeUnicode(date) + "_" + filename + ext;
   } else {
     filename = filename + ext;
   }
   if (this.getPluginConfig().getBooleanProperty(FID_IN_FILENAME, false)) {
     filename = new Regex(downloadLink.getDownloadURL(), "(\\d+)$").getMatch(0) + "_" + filename;
   }
   downloadLink.setFinalFileName(filename);
   final Browser br2 = br.cloneBrowser();
   // In case the link redirects to the finallink
   br2.setFollowRedirects(true);
   URLConnectionAdapter con = null;
   try {
     try {
       con = br2.openGetConnection(DLLINK);
     } catch (final BrowserException e) {
       throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
     }
     if (!con.getContentType().contains("html")) {
       downloadLink.setDownloadSize(con.getLongContentLength());
     } else {
       throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
     }
     return AvailableStatus.TRUE;
   } finally {
     try {
       con.disconnect();
     } catch (final Throwable e) {
     }
   }
 }
示例#5
0
 public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress)
     throws Exception {
   ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
   String parameter = param.toString();
   br.setFollowRedirects(true);
   br.getPage(parameter);
   final String artist =
       br.getRegex("<title>Автор ([^<>\"/]*?) и его композиции</title>").getMatch(0);
   String[][] fileInfo =
       br.getRegex(
               "class=\"track artist_img_left\"><a href=\"(/pages/\\d+/\\d+\\.shtml)\">([^<>/\"]*?)</a></td><td class=\"date\">\\d{2}\\.\\d{2}\\.\\d{2}</td><td class=\"bitrate\">[0-9\t\n\r ]+</td><td class=\"size\">(\\d+(\\.\\d+)?)</td>")
           .getMatches();
   if (fileInfo == null || fileInfo.length == 0) {
     if (br.containsHTML(">Нет информации<")) {
       logger.info("Link offline: " + parameter);
       return decryptedLinks;
     }
     logger.warning("Decrypter broken for link: " + parameter);
     return null;
   }
   for (String[] file : fileInfo) {
     final DownloadLink dl = createDownloadlink("http://zaycev.net" + file[0]);
     dl.setFinalFileName(Encoding.htmlDecode(file[1].trim()) + ".mp3");
     dl.setDownloadSize(SizeFormatter.getSize(file[2] + " MB"));
     dl.setAvailable(true);
     decryptedLinks.add(dl);
   }
   if (artist != null) {
     FilePackage fp = FilePackage.getInstance();
     fp.setName(Encoding.htmlDecode(artist.trim()));
     fp.addLinks(decryptedLinks);
   }
   return decryptedLinks;
 }
 @Override
 public AvailableStatus requestFileInformation(final DownloadLink link)
     throws IOException, PluginException {
   this.setBrowserExclusive();
   br.setFollowRedirects(false);
   br.getPage(link.getDownloadURL());
   if (br.containsHTML(ONLYREGISTEREDUSERTEXT)) {
     link.getLinkStatus()
         .setStatusText(JDL.L("plugins.hoster.datpiffcom.only4premium", ONLYREGISTEREDUSERTEXT));
     return AvailableStatus.TRUE;
   }
   if (br.containsHTML(
       "(>Download Unavailable<|>A zip file has not yet been generated<|>Mixtape Not Found<|has been removed<)"))
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   String filename = null;
   if (br.containsHTML(CURRENTLYUNAVAILABLE)) {
     filename = br.getRegex("<title>([^<>\"]*?) \\- Mixtapes @ DatPiff\\.com</title>").getMatch(0);
     if (filename == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
     link.setName(Encoding.htmlDecode(filename.trim()));
     link.getLinkStatus().setStatusText(CURRENTLYUNAVAILABLETEXT);
     return AvailableStatus.TRUE;
   }
   filename = br.getRegex("<title>Download Mixtape \\&quot;(.*?)\\&quot;</title>").getMatch(0);
   if (filename == null)
     filename = br.getRegex("<span>Download Mixtape<em>(.*?)</em></span>").getMatch(0);
   if (filename == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   if (!link.getDownloadURL().contains(".php?id=")) {
     logger.warning("downID not found, link is broken!");
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   link.setName(Encoding.htmlDecode(filename.trim()));
   return AvailableStatus.TRUE;
 }
示例#7
0
 @Override
 public AvailableStatus requestFileInformation(final DownloadLink link)
     throws IOException, PluginException {
   this.setBrowserExclusive();
   br.setFollowRedirects(true);
   br.getPage(link.getDownloadURL());
   if (br.getURL().contains("FileNotFind") || br.getURL().contains("5sing.com/404.htm")) {
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   }
   String extension = br.getRegex("(<em>)?格式:(</em>)?([^<>\"]*?)(<|&)").getMatch(2);
   if (extension == null && br.containsHTML("<em>演唱:</em>")) {
     extension = "mp3";
   }
   final String filename = br.getRegex("var SongName[^<>\"\t\n\r]*= \"([^<>\"]*?)\"").getMatch(0);
   final String fileid = br.getRegex("var SongID[^<>\"\t\n\r]*= ([^<>\"]*?);").getMatch(0);
   final String stype = br.getRegex("var SongType[^<>\"\t\n\r]*= \"([^<>\"]*?)\";").getMatch(0);
   String filesize = br.getRegex("(<em>)?大小:(</em>)?([^<>\"]*?)(<|\")").getMatch(2);
   if (filename == null || extension == null) {
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   link.setFinalFileName(
       stype
           + "-"
           + Encoding.htmlDecode(filename.trim())
           + "-"
           + fileid
           + "."
           + Encoding.htmlDecode(extension.trim()));
   if (filesize != null) {
     link.setDownloadSize(SizeFormatter.getSize(filesize + "b"));
   }
   return AvailableStatus.TRUE;
 }
示例#8
0
 @Override
 public AvailableStatus requestFileInformation(final DownloadLink downloadLink)
     throws IOException, PluginException {
   setBrowserExclusive();
   br.setFollowRedirects(true);
   br.getPage(downloadLink.getDownloadURL());
   // Offline1
   if (br.containsHTML(
       "(This page cannot be found|Are you sure you typed in the correct url|<title>Most Recent Videos \\- Free Sex Adult Videos \\- NuVid\\.com</title>|This video was not found)")) {
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   }
   // Offline2
   if (br.containsHTML("This video was deleted\\.")) {
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   }
   String filename = br.getRegex("<h3>([^<>\"]*?)</h3>").getMatch(0);
   if (filename == null) {
     filename = br.getRegex("<title>([^<>\"]*?) - Free P**n \\& Sex Video").getMatch(0);
   }
   final String linkPart =
       br.getRegex(
               "\\'http://www\\.nuvid\\.com(/player_config/\\?(check_speed=.%26)?t=.*?)\\'\\);")
           .getMatch(0);
   if (filename == null || linkPart == null) {
     logger.info("filename = " + filename + "; linkPart = " + linkPart);
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   getDllink(linkPart);
   if (dllink == null && br.containsHTML("Invalid video key")) {
     throw new PluginException(LinkStatus.ERROR_FATAL, "Plugin outdated, key has changed!");
   }
   if (filename == null || dllink == null) {
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   dllink = Encoding.htmlDecode(dllink);
   filename = filename.trim();
   final String ext = getFileNameExtensionFromString(dllink, ".flv");
   downloadLink.setFinalFileName(Encoding.htmlDecode(filename) + ext);
   final Browser br2 = br.cloneBrowser();
   // In case the link redirects to the finallink
   br2.setFollowRedirects(true);
   URLConnectionAdapter con = null;
   try {
     con = br2.openGetConnection(dllink);
     if (!con.getContentType().contains("html")) {
       downloadLink.setDownloadSize(con.getLongContentLength());
     } else {
       throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
     }
     return AvailableStatus.TRUE;
   } finally {
     try {
       con.disconnect();
     } catch (final Throwable e) {
     }
   }
 }
 public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress)
     throws Exception {
   ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
   String parameter = param.toString();
   br.setFollowRedirects(true);
   // Test if we already hav a direct link here
   URLConnectionAdapter con = br.openGetConnection(parameter);
   if (con.getContentType().contains("html")) {
     br.followConnection();
     if (br.containsHTML(
         "(Error 404|The page you were looking for cannot be found|could not be found or is not available)"))
       throw new DecrypterException(
           JDL.L(
               "plugins.decrypt.errormsg.unavailable",
               "Perhaps wrong URL or the download is not available anymore."));
     String link = null;
     if (parameter.contains("/files/extras/")
         || parameter.contains("prdownloads.sourceforge.net")) {
       link = br.getRegex("Please use this <a href=\"(.*?)\"").getMatch(0);
       if (link == null)
         link =
             br.getRegex(
                     "\"(http://downloads\\.sourceforge\\.net/project/.*?/extras/.*?/.*?use_mirror=.*?)\"")
                 .getMatch(0);
     } else {
       link = br.getRegex("Please use this <a href=\"(http://.*?)\"").getMatch(0);
       if (link == null)
         link =
             br.getRegex("\"(http://downloads\\.sourceforge.net/project/.*?\\?use_mirror=.*?)\"")
                 .getMatch(0);
     }
     if (link == null) return null;
     br.setFollowRedirects(false);
     br.getPage(Encoding.htmlDecode(link));
     String finallink = null;
     boolean failed = true;
     for (int i = 0; i <= 5; i++) {
       br.getPage(Encoding.htmlDecode(link));
       finallink = br.getRedirectLocation();
       if (finallink == null) return null;
       con = br.openGetConnection(finallink);
       if (con.getContentType().contains("html")) {
         logger.info("finallink is no file, continuing...");
         continue;
       }
       failed = false;
       break;
     }
     if (failed) logger.warning("The finallink is no file!!");
     decryptedLinks.add(createDownloadlink("directhttp://" + finallink));
     con.disconnect();
   } else {
     con.disconnect();
     decryptedLinks.add(createDownloadlink("directhttp://" + parameter));
   }
   return decryptedLinks;
 }
示例#10
0
 @Override
 public void handleFree(final DownloadLink downloadLink) throws Exception, PluginException {
   requestFileInformation(downloadLink);
   String dllink = checkDirectLink(downloadLink, "directlink");
   if (dllink == null) {
     dllink = this.br.getRegex("(https?://[^<>\"]+/get/[^<>\"]+)").getMatch(0);
     if (dllink == null) {
       /* 2016-10-24 */
       dllink = this.br.getRegex("Core\\.InitializeStream\\s*?\\(\\'([^<>\"]+)\\'").getMatch(0);
       if (dllink != null) {
         dllink = Encoding.Base64Decode(dllink);
         dllink = Encoding.unescape(dllink);
         dllink = new Regex(dllink, "(https?://[^<>\"]+/get/[^<>\"]+)").getMatch(0);
       }
     }
     if (dllink == null) {
       final String hash =
           br.getRegex("type=\"hidden\" name=\"hash\" value=\"([^<>\"]*?)\"").getMatch(0);
       final String expires =
           br.getRegex("type=\"hidden\" name=\"expires\" value=\"([^<>\"]*?)\"").getMatch(0);
       final String timestamp =
           br.getRegex("type=\"hidden\" name=\"timestamp\" value=\"([^<>\"]*?)\"").getMatch(0);
       if (hash == null || timestamp == null) {
         throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
       }
       String postData = "hash=" + hash + "&timestamp=" + timestamp;
       if (expires != null) {
         postData += "&expires=" + expires;
       }
       br.postPage(br.getURL(), postData);
       dllink =
           br.getRegex("class=\"stream\\-content\" data\\-url=\"(http[^<>\"]*?)\"").getMatch(0);
       if (dllink == null) {
         throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
       }
     }
   }
   try {
     final Browser brc = br.cloneBrowser();
     brc.getHeaders().put("Accept", "*/*");
     brc.getHeaders().put("X-Requested-With", "XMLHttpRequest");
     brc.getHeaders().put("", "");
     brc.postPage(
         "http://" + domain + "/request",
         "action=view&abs=false&hash="
             + new Regex(downloadLink.getDownloadURL(), "([a-z0-9]+)$").getMatch(0));
   } catch (final Throwable e) {
   }
   dl = jd.plugins.BrowserAdapter.openDownload(br, downloadLink, dllink, true, 1);
   if (dl.getConnection().getContentType().contains("html")) {
     br.followConnection();
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   downloadLink.setProperty("directlink", dllink);
   dl.startDownload();
 }
示例#11
0
 @Override
 public AvailableStatus requestFileInformation(final DownloadLink downloadLink) throws Exception {
   if (downloadLink.getBooleanProperty("offline", false)) {
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   }
   downloadLink.setName(new Regex(downloadLink.getDownloadURL(), "(\\d+)$").getMatch(0));
   setBrowserExclusive();
   br.setFollowRedirects(true);
   br.getPage(downloadLink.getDownloadURL());
   if (br.containsHTML("http://www\\.vidobu\\.com/uyari_ip\\.php")
       || br.getHttpConnection().getResponseCode() == 404) {
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   }
   final String nextUrl = br.getRegex("<iframe src=\"(http://[^<>]+)\"").getMatch(0);
   clipData = br.getPage(Encoding.htmlDecode(nextUrl));
   String title = br.getRegex("<title>(.*?)</title>").getMatch(0);
   title =
       title == null
           ? "Vimeo_private_video_" + getClipData("id") + "_" + System.currentTimeMillis()
           : title;
   final String dlURL =
       "/play_redirect?clip_id="
           + getClipData("id")
           + "&sig="
           + getClipData("signature")
           + "&time="
           + getClipData("timestamp")
           + "&quality="
           + (getClipData("hd").equals("1") ? "hd" : "sd")
           + "&codecs=H264,VP8,VP6&type=moogaloop&embed_location="
           + Encoding.htmlDecode(getClipData("referrer"));
   br.setFollowRedirects(false);
   br.getPage(dlURL);
   finalURL = br.getRedirectLocation();
   if (finalURL == null) {
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   title = Encoding.htmlDecode(title);
   URLConnectionAdapter con = null;
   try {
     con = br.openGetConnection(finalURL);
     if (con.getContentType() != null && con.getContentType().contains("mp4")) {
       downloadLink.setName(title + ".mp4");
     } else {
       downloadLink.setName(title + ".flv");
     }
     downloadLink.setDownloadSize(con.getLongContentLength());
     return AvailableStatus.TRUE;
   } finally {
     try {
       con.disconnect();
     } catch (final Throwable e) {
     }
   }
 }
示例#12
0
  private boolean handlePassword() throws DecrypterException, IOException {
    final boolean passwordRequired;
    if ((this.br.getRedirectLocation() != null
            && this.br.getRedirectLocation().contains(urlpart_passwordneeded))
        || this.br.getURL().contains(urlpart_passwordneeded)) {
      logger.info("Blog password needed");
      passwordRequired = true;

      // final String password_required_url;
      // if (this.br.getRedirectLocation() != null) {
      // password_required_url = this.br.getRedirectLocation();
      // } else {
      // password_required_url = this.br.getURL();
      // }
      // final String blog_user = new Regex(password_required_url, "/blog_auth/(.+)").getMatch(0);
      // if (blog_user != null) {
      // this.br = prepBR(new Browser());
      // this.br.setFollowRedirects(true);
      // this.br.getPage("https://www.tumblr.com/blog_auth/" + blog_user);
      // } else {
      // this.br.setFollowRedirects(true);
      // }

      boolean success = false;
      for (int i = 0; i <= 2; i++) {
        if (this.passCode == null) {
          this.passCode = getUserInput("Password?", this.param);
        }
        Form form = br.getFormbyKey("auth");
        if (form == null) {
          form = br.getFormbyKey("password");
        }
        form.put("password", Encoding.urlEncode(this.passCode));
        br.submitForm(form);
        form = br.getFormbyKey("auth");
        if (form != null) {
          form.put("password", Encoding.urlEncode(passCode));
          br.submitForm(form);
        }
        if (this.br.getURL().contains(urlpart_passwordneeded)) {
          passCode = null;
          continue;
        }
        success = true;
        break;
      }
      if (!success) {
        throw new DecrypterException(DecrypterException.PASSWORD);
      }
      this.br.setFollowRedirects(false);
    } else {
      passwordRequired = false;
    }
    return passwordRequired;
  }
示例#13
0
 @Override
 public AvailableStatus requestFileInformation(DownloadLink downloadLink)
     throws IOException, PluginException {
   this.setBrowserExclusive();
   br.setFollowRedirects(true);
   br.getPage(downloadLink.getDownloadURL());
   if (br.containsHTML("<title>404 Not Found</title>")) {
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   }
   String filename = br.getRegex("<title>Download (.*?)  \\|").getMatch(0);
   if (filename == null) {
     filename = br.getRegex("<h2>Download File: (.*?)</h2>").getMatch(0);
   }
   if (filename == null) {
     filename = br.getRegex("<title>Download ([^<>\"]*?)</title>").getMatch(0);
   }
   DLLINK = br.getRegex("\\'file\\'([\t\n\r ]+)?:([\t\n\r ]+)?\\'([^<>\"]*?)\\'").getMatch(2);
   if (DLLINK == null) {
     DLLINK = br.getRegex("(https?://\\w+\\.tinyvid\\.net[^<>\"]*?\\.mp4)").getMatch(0);
   }
   if (filename == null && DLLINK == null) {
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   } else if (filename == null || filename.equals("")) {
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   }
   filename = Encoding.htmlDecode(filename.trim());
   downloadLink.setName(filename);
   DLLINK = Encoding.htmlDecode(DLLINK);
   if (!DLLINK.startsWith("http://")) {
     DLLINK = "http://s1000.animepremium.tv/download/" + DLLINK;
   }
   Browser br2 = br.cloneBrowser();
   // In case the link redirects to the finallink
   br2.setFollowRedirects(true);
   URLConnectionAdapter con = null;
   try {
     con = br2.openGetConnection(DLLINK);
     if (!con.getContentType().contains("html")) {
       String ext = br2.getURL().substring(br2.getURL().lastIndexOf("."));
       if (ext == null || ext.length() > 5) {
         ext = ".mp4";
       }
       downloadLink.setFinalFileName(filename + ext);
       downloadLink.setDownloadSize(con.getLongContentLength());
     } else {
       throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
     }
     return AvailableStatus.TRUE;
   } finally {
     try {
       con.disconnect();
     } catch (Throwable e) {
     }
   }
 }
示例#14
0
 private void login(Account account) throws Exception {
   this.setBrowserExclusive();
   br.setCookie("http://gigapeta.com", "lang", "us");
   br.setDebug(true);
   /*
    * Workaround for a serverside 502 error (date: 04.03.15). Accessing the wrong ('/dl/') link next line in the code will return a 404
    * error but we can login and download fine then.
    */
   br.getPage("http://gigapeta.com/dl/");
   final String auth_token = br.getRegex("name=\"auth_token\" value=\"([a-z0-9]+)\"").getMatch(0);
   final String lang = System.getProperty("user.language");
   if (auth_token == null) {
     if ("de".equalsIgnoreCase(lang)) {
       throw new PluginException(
           LinkStatus.ERROR_PREMIUM,
           "\r\nPlugin defekt, bitte den JDownloader Support kontaktieren!",
           PluginException.VALUE_ID_PREMIUM_DISABLE);
     } else {
       throw new PluginException(
           LinkStatus.ERROR_PREMIUM,
           "\r\nPlugin broken, please contact the JDownloader Support!",
           PluginException.VALUE_ID_PREMIUM_DISABLE);
     }
   }
   br.postPage(
       br.getURL(),
       "auth_login="******"&auth_passwd="
           + Encoding.urlEncode(account.getPass())
           + "&auth_token="
           + auth_token);
   if (br.getCookie("http://gigapeta.com/", "adv_sess") == null) {
     if ("de".equalsIgnoreCase(lang)) {
       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 (br.containsHTML("You have <b>basic</b> account")) {
     nopremium = true;
     simultanpremium.set(1);
   } else if (br.getRegex("You have <b>([^<>\"]*?)</b> account till").getMatch(0) != null) {
     simultanpremium.set(-1);
   } else {
     logger.warning("Unknown accounttype, disabling it...");
     throw new PluginException(LinkStatus.ERROR_PREMIUM, PluginException.VALUE_ID_PREMIUM_DISABLE);
   }
 }
示例#15
0
 @Override
 public AvailableStatus requestFileInformation(DownloadLink downloadLink)
     throws IOException, PluginException {
   this.setBrowserExclusive();
   br.setFollowRedirects(true);
   br.getPage(downloadLink.getDownloadURL());
   if (br.getURL().equals("http://www.p**n.to/")
       || br.containsHTML("<title>Watch Free P**n Videos and Amateur Sex Movies</title>"))
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   String filename =
       br.getRegex(
               "<div class=\"row\">[\t\n\r ]+<div class=\"box box_medium float\\-left\">[\t\n\r ]+<h2>(.*?)</h2>")
           .getMatch(0);
   if (filename == null) filename = br.getRegex("<title>(.*?)</title>").getMatch(0);
   Regex theRegex =
       br.getRegex(
           "createPlayer\\(\\'(http://.*?)\\',\\'http://.*?\\',\\'(.*?)\\',\\'(\\d+)\\'\\)");
   String token = theRegex.getMatch(1);
   String anID = theRegex.getMatch(2);
   boolean embeddedLink = false;
   DLLINK = theRegex.getMatch(0);
   if (DLLINK == null) {
     DLLINK = br.getRegex("\\&file=(http://embed\\.kickassratios\\.com/[^<>\"]*?)\\&").getMatch(0);
     embeddedLink = true;
   }
   if (filename == null || (DLLINK == null && token == null && !embeddedLink && anID == null))
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   DLLINK = Encoding.htmlDecode(DLLINK);
   filename = filename.trim();
   downloadLink.setFinalFileName(
       Encoding.htmlDecode(filename) + DLLINK.substring(DLLINK.length() - 4, DLLINK.length()));
   if (!embeddedLink)
     DLLINK +=
         "?start=0&id=videoplayer&client=FLASH%20WIN%2010,"
             + anID
             + ",181,26&version=4.2.95&width=664&token="
             + token;
   Browser br2 = br.cloneBrowser();
   // In case the link redirects to the finallink
   br2.setFollowRedirects(true);
   URLConnectionAdapter con = null;
   try {
     con = br2.openGetConnection(DLLINK);
     if (!con.getContentType().contains("html"))
       downloadLink.setDownloadSize(con.getLongContentLength());
     else throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
     return AvailableStatus.TRUE;
   } finally {
     try {
       con.disconnect();
     } catch (Throwable e) {
     }
   }
 }
示例#16
0
  @Override
  public AvailableStatus requestFileInformation(final DownloadLink downloadLink)
      throws IOException, PluginException {
    setBrowserExclusive();
    br.setFollowRedirects(true);
    br.getPage(downloadLink.getDownloadURL());
    // Video offline
    if (br.containsHTML("(<h2>Sorry, this video is no longer available|<title></title>)"))
      throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
    // 404
    if (br.containsHTML(">Not Found<|The requested URL was not found on this server"))
      throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
    String filename = br.getRegex("<title>(.*?)</title>").getMatch(0);
    if (filename == null) {
      filename =
          br.getRegex(
                  "<meta name=\"description\" content=\"(.*?) \\- video on Alpha Porno \\- P**n Tube\"/>")
              .getMatch(0);
    }
    DLLINK = br.getRegex("video_url:.*?\\('(http://.*?)'\\)").getMatch(0);
    if (filename == null || DLLINK == null)
      throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
    DLLINK = Encoding.htmlDecode(DLLINK);
    filename = filename.trim();
    String ext = DLLINK.substring(DLLINK.lastIndexOf(".")).replaceAll("\\W", "");
    if (ext == null || ext.length() > 5) {
      ext = "flv";
    }
    downloadLink.setFinalFileName(Encoding.htmlDecode(filename) + "." + ext);

    final String time = checkTM();
    final String ahv = checkMD(DLLINK, time);
    DLLINK = DLLINK + "?time=" + time + "&ahv=" + ahv + "&cv=" + checkMD2(time);

    final Browser br2 = br.cloneBrowser();
    // In case the link redirects to the finallink
    br2.setFollowRedirects(true);
    URLConnectionAdapter con = null;
    try {
      con = br2.openGetConnection(DLLINK);
      if (!con.getContentType().contains("html")) {
        downloadLink.setDownloadSize(con.getLongContentLength());
      } else {
        throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
      }
      return AvailableStatus.TRUE;
    } finally {
      try {
        con.disconnect();
      } catch (final Throwable e) {
      }
    }
  }
示例#17
0
 private void login(Account account) throws Exception {
   this.setBrowserExclusive();
   br.setFollowRedirects(false);
   br.postPage(
       "https://secure.nicovideo.jp/secure/login?site=niconico",
       "next_url=&mail="
           + Encoding.urlEncode(account.getUser())
           + "&password="******"user_session") == null)
     throw new PluginException(LinkStatus.ERROR_PREMIUM, PluginException.VALUE_ID_PREMIUM_DISABLE);
 }
示例#18
0
 public AvailableStatus requestFileInformation(final DownloadLink downloadLink)
     throws IOException, InterruptedException, PluginException {
   correctDownloadLink(downloadLink);
   this.setBrowserExclusive();
   br.getHeaders().put("User-Agent", userAgent.get());
   br.setCookie("http://remixshare.com", "lang_en", "english");
   br.setFollowRedirects(true);
   br.getPage(downloadLink.getDownloadURL());
   if (br.containsHTML(BLOCKED)) {
     return AvailableStatus.UNCHECKABLE;
   }
   br.setFollowRedirects(false);
   // 300 = The uploader has deleted the file
   // 400 = File deleted, maybe abused
   // 500 = Wrong link or maybe deleted some time ago
   if (br.containsHTML("<b>Error Code: [345]00\\.")
       || br.containsHTML("Please check the downloadlink")) {
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   }
   String filename =
       Encoding.htmlDecode(
           br.getRegex(
                   Pattern.compile(
                       "<span title=\\'([0-9]{10}_)?(.*?)\\'>", Pattern.CASE_INSENSITIVE))
               .getMatch(1));
   if (filename == null) {
     filename =
         Encoding.htmlDecode(
             br.getRegex(
                     Pattern.compile(
                         "<title>(.*?)Download at remiXshare Filehosting",
                         Pattern.CASE_INSENSITIVE))
                 .getMatch(0));
   }
   String filesize = br.getRegex("(>|\\.\\.\\.)\\&nbsp;\\((.*?)\\)<").getMatch(1);
   if (filename == null) {
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   downloadLink.setName(filename.trim());
   if (filesize != null) {
     filesize = Encoding.htmlDecode(filesize);
     downloadLink.setDownloadSize(SizeFormatter.getSize(filesize.replace(",", ".")));
   }
   String md5Hash = br.getRegex("/>MD5:(.*?)<").getMatch(0);
   if (md5Hash != null && md5Hash.trim().length() == 32) {
     downloadLink.setMD5Hash(md5Hash.trim());
   } else {
     /* fix broken md5 sums */
     downloadLink.setMD5Hash(null);
   }
   return AvailableStatus.TRUE;
 }
示例#19
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);
   }
 }
示例#20
0
 @Override
 public AvailableStatus requestFileInformation(final DownloadLink downloadLink)
     throws IOException, PluginException {
   this.setBrowserExclusive();
   br.setFollowRedirects(true);
   br.getPage(downloadLink.getDownloadURL());
   if (br.getHttpConnection().getResponseCode() == 404) {
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   }
   String filename = br.getRegex("<title>([^<>\"]*?) \\- Pornicom\\.com</title>").getMatch(0);
   DLLINK = checkDirectLink(downloadLink, "directlink");
   if (DLLINK == null) {
     DLLINK = br.getRegex("video_url: \\'(http[^<>\"]*?)\\'").getMatch(0);
   }
   if (filename == null || DLLINK == null) {
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   DLLINK = Encoding.htmlDecode(DLLINK);
   filename = Encoding.htmlDecode(filename);
   filename = filename.trim();
   filename = encodeUnicode(filename);
   String ext = DLLINK.substring(DLLINK.lastIndexOf("."));
   if (ext == null || ext.length() > 5) {
     ext = ".flv";
   }
   ext = ext.replace(".flv/", ".flv");
   downloadLink.setFinalFileName(Encoding.htmlDecode(filename) + ext);
   final Browser br2 = br.cloneBrowser();
   // In case the link redirects to the finallink
   br2.setFollowRedirects(true);
   URLConnectionAdapter con = null;
   try {
     try {
       con = br2.openGetConnection(DLLINK);
     } catch (final BrowserException e) {
       throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
     }
     if (!con.getContentType().contains("html")) {
       downloadLink.setDownloadSize(con.getLongContentLength());
     } else {
       throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
     }
     downloadLink.setProperty("directlink", DLLINK);
     return AvailableStatus.TRUE;
   } finally {
     try {
       con.disconnect();
     } catch (final Throwable e) {
     }
   }
 }
示例#21
0
 @Override
 public AvailableStatus requestFileInformation(final DownloadLink downloadLink)
     throws IOException, PluginException {
   /* Offline links should also have nice filenames */
   downloadLink.setName(
       new Regex(
               downloadLink.getDownloadURL(),
               "presstv\\.ir/detail/\\d{4}/\\d{2}/\\d{2}/\\d+/([A-Za-z0-9\\-]+)/")
           .getMatch(0));
   this.setBrowserExclusive();
   br.setFollowRedirects(true);
   br.getPage(downloadLink.getDownloadURL());
   if (br.containsHTML("The requested page was not found|<title>No Operation</title>"))
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   String ext;
   String filename = br.getRegex("id=\\'divTitle\\'>([^<>\"]*?)</div>").getMatch(0);
   if (filename == null)
     filename = br.getRegex("property=\"og:title\" content=\"([^<>\"]*?)\"").getMatch(0);
   if (filename == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   /* Decide between video and photo */
   if (br.containsHTML("property=\"og:video\"")) {
     DLLINK = br.getRegex("\\(\\'file\\', \\'(presstv[^<>\"]*?)\\'\\)").getMatch(0);
     if (DLLINK == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
     DLLINK = "http://64.150.186.181/" + Encoding.htmlDecode(DLLINK).replace("/mp4:", "/");
     ext = DLLINK.substring(DLLINK.lastIndexOf("."));
     if (ext == null || ext.length() > 5) ext = ".mp4";
   } else {
     DLLINK = br.getRegex("id=\\'imgMain\\' src=\\'(http://[^<>\"]*?)\\'").getMatch(0);
     if (DLLINK == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
     ext = DLLINK.substring(DLLINK.lastIndexOf("."));
     if (ext == null || ext.length() > 5) ext = ".jpg";
   }
   filename = filename.trim();
   downloadLink.setFinalFileName(encodeUnicode(Encoding.htmlDecode(filename)) + ext);
   final Browser br2 = br.cloneBrowser();
   // In case the link redirects to the finallink
   br2.setFollowRedirects(true);
   URLConnectionAdapter con = null;
   try {
     con = br2.openGetConnection(DLLINK);
     if (!con.getContentType().contains("html"))
       downloadLink.setDownloadSize(con.getLongContentLength());
     else throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
     return AvailableStatus.TRUE;
   } finally {
     try {
       con.disconnect();
     } catch (final Throwable e) {
     }
   }
 }
示例#22
0
 private boolean getUserLogin() throws IOException, DecrypterException {
   br.setFollowRedirects(true);
   String username = null;
   String password = null;
   synchronized (LOCK) {
     username = this.getPluginConfig().getStringProperty("user", null);
     password = this.getPluginConfig().getStringProperty("pass", null);
     if (username != null && password != null) {
       br.postPage(
           POSTPAGE,
           "user="******"&passwrd="
               + Encoding.urlEncode(password)
               + "&cookielength=2&hash_passwrd=");
     }
     for (int i = 0; i < 3; i++) {
       boolean valid = false;
       final Cookies allCookies = this.br.getCookies(MAINPAGE);
       for (final Cookie c : allCookies.getCookies()) {
         if (c.getKey().contains("SMFCookie")) {
           valid = true;
           break;
         }
       }
       if (!valid) {
         this.getPluginConfig().setProperty("user", Property.NULL);
         this.getPluginConfig().setProperty("pass", Property.NULL);
         username =
             UserIO.getInstance().requestInputDialog("Enter Loginname for " + DOMAIN + " :");
         if (username == null) return false;
         password = UserIO.getInstance().requestInputDialog("Enter password for " + DOMAIN + " :");
         if (password == null) return false;
         br.postPage(
             POSTPAGE,
             "user="******"&passwrd="
                 + Encoding.urlEncode(password)
                 + "&cookielength=2&hash_passwrd=");
       } else {
         this.getPluginConfig().setProperty("user", username);
         this.getPluginConfig().setProperty("pass", password);
         this.getPluginConfig().save();
         return true;
       }
     }
   }
   throw new DecrypterException("Login or/and password wrong");
 }
示例#23
0
 private void decryptLinks(final ArrayList<DownloadLink> decryptedLinks, final CryptedLink param)
     throws Exception {
   br.setFollowRedirects(false);
   final String[] matches = br.getRegex("getFile\\('(cid=\\w*?&lid=\\d*?)'\\)").getColumn(0);
   try {
     Browser brc = null;
     for (final String match : matches) {
       Thread.sleep(2333);
       handleCaptchaAndPassword("http://www.relink.us/frame.php?" + match, param);
       if (ALLFORM != null && ALLFORM.getRegex("captcha").matches()) {
         logger.warning("Falsche Captcheingabe, Link wird übersprungen!");
         continue;
       }
       brc = br.cloneBrowser();
       if (brc != null
           && brc.getRedirectLocation() != null
           && brc.getRedirectLocation().contains("relink.us/getfile")) {
         brc.getPage(brc.getRedirectLocation());
       }
       if (brc.getRedirectLocation() != null) {
         final DownloadLink dl =
             createDownloadlink(Encoding.htmlDecode(brc.getRedirectLocation()));
         try {
           distribute(dl);
         } catch (final Throwable e) {
           /* does not exist in 09581 */
         }
         decryptedLinks.add(dl);
         break;
       } else {
         final String url = brc.getRegex("iframe.*?src=\"(.*?)\"").getMatch(0);
         final DownloadLink dl = createDownloadlink(Encoding.htmlDecode(url));
         if (url != null) {
           try {
             distribute(dl);
           } catch (final Throwable e) {
             /* does not exist in 09581 */
           }
           decryptedLinks.add(dl);
         } else {
           /* as bot detected */
           return;
         }
       }
       PROGRESS.increase(1);
     }
   } finally {
     br.setFollowRedirects(true);
   }
 }
示例#24
0
 @SuppressWarnings("unchecked")
 private void login(final Account account, final boolean force) throws Exception {
   synchronized (LOCK) {
     try {
       /** Load cookies */
       br.setCookiesExclusive(true);
       prepBrowser(br);
       final Object ret = account.getProperty("cookies", null);
       boolean acmatch =
           Encoding.urlEncode(account.getUser())
               .equals(account.getStringProperty("name", Encoding.urlEncode(account.getUser())));
       if (acmatch)
         acmatch =
             Encoding.urlEncode(account.getPass())
                 .equals(account.getStringProperty("pass", Encoding.urlEncode(account.getPass())));
       if (acmatch && ret != null && ret instanceof HashMap<?, ?> && !force) {
         final HashMap<String, String> cookies = (HashMap<String, String>) ret;
         if (account.isValid()) {
           for (final Map.Entry<String, String> cookieEntry : cookies.entrySet()) {
             final String key = cookieEntry.getKey();
             final String value = cookieEntry.getValue();
             this.br.setCookie(COOKIE_HOST, key, value);
           }
           return;
         }
       }
       br.setFollowRedirects(true);
       getPage(COOKIE_HOST + "/login.html");
       final Form loginform = br.getFormbyProperty("name", "FL");
       if (loginform == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
       loginform.put("login", Encoding.urlEncode(account.getUser()));
       loginform.put("password", Encoding.urlEncode(account.getPass()));
       sendForm(loginform);
       if (br.getCookie(COOKIE_HOST, "login") == null || br.getCookie(COOKIE_HOST, "xfss") == null)
         throw new PluginException(
             LinkStatus.ERROR_PREMIUM, PluginException.VALUE_ID_PREMIUM_DISABLE);
       if (!br.getURL().contains("/?op=my_account")) {
         getPage("/?op=my_account");
       }
       if (!new Regex(correctedBR, "(Premium(\\-| )Account expire|>Renew premium<)").matches()) {
         account.setProperty("nopremium", true);
       } else {
         account.setProperty("nopremium", false);
       }
       /** Save cookies */
       final HashMap<String, String> cookies = new HashMap<String, String>();
       final Cookies add = this.br.getCookies(COOKIE_HOST);
       for (final Cookie c : add.getCookies()) {
         cookies.put(c.getKey(), c.getValue());
       }
       account.setProperty("name", Encoding.urlEncode(account.getUser()));
       account.setProperty("pass", Encoding.urlEncode(account.getPass()));
       account.setProperty("cookies", cookies);
     } catch (final PluginException e) {
       account.setProperty("cookies", Property.NULL);
       throw e;
     }
   }
 }
示例#25
0
 @Override
 public AvailableStatus requestFileInformation(DownloadLink downloadLink)
     throws IOException, PluginException {
   this.setBrowserExclusive();
   br.setFollowRedirects(true);
   br.getPage(downloadLink.getDownloadURL());
   if (br.containsHTML("(nodata\\.png\"|<title>Videos \\| )"))
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   String filename = br.getRegex(">Back to main page</a></div>(.*?)</h2>").getMatch(0);
   if (filename == null) filename = br.getRegex("<title>(.*?) \\| Videos \\| ").getMatch(0);
   if (filename == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   if (br.containsHTML(VIDEOUNAVAILABLE)) {
     // Don't set final filename in this case, it's set once the video is
     // downloadable again!
     downloadLink.setName(Encoding.htmlDecode(filename) + ".flv");
     downloadLink
         .getLinkStatus()
         .setStatusText(
             JDL.L("plugins.hoster.groups.videobeingencoded", VIDEOUNAVAILABLEUSERTEXT));
     return AvailableStatus.TRUE;
   }
   DLLINK = br.getRegex("addParam\\(\\'flashvars\\',\\'\\&file=(http://.*?)\\'").getMatch(0);
   if (DLLINK == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   DLLINK = Encoding.htmlDecode(DLLINK);
   DLLINK = Encoding.urlDecode(DLLINK, true);
   filename = filename.trim();
   Browser br2 = br.cloneBrowser();
   br2.setFollowRedirects(false);
   br2.getPage(DLLINK);
   DLLINK = br2.getRedirectLocation();
   if (DLLINK == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   downloadLink.setFinalFileName(
       Encoding.htmlDecode(filename) + DLLINK.substring(DLLINK.length() - 4, DLLINK.length()));
   URLConnectionAdapter con = null;
   try {
     con = br2.openGetConnection(DLLINK);
     if (!con.getContentType().contains("html") && con.getLongContentLength() != 0) {
       downloadLink.setDownloadSize(con.getLongContentLength());
     } else {
       throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
     }
     return AvailableStatus.TRUE;
   } finally {
     try {
       con.disconnect();
     } catch (Throwable e) {
     }
   }
 }
示例#26
0
 @SuppressWarnings("deprecation")
 @Override
 public AvailableStatus requestFileInformation(final DownloadLink link)
     throws IOException, PluginException {
   this.setBrowserExclusive();
   br.setFollowRedirects(true);
   String filename;
   if (use_oembed_api) {
     br.getPage(
         "http://www.audiomack.com/oembed?format=json&url="
             + Encoding.urlEncode(link.getDownloadURL()));
     if (br.containsHTML(">Did not find any music with url")) {
       throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
     }
     final String artist = getJson("author_name");
     final String songname = getJson("title");
     if (artist == null || songname == null) {
       throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
     }
     filename = artist + " - " + songname;
   } else if (link.getDownloadURL().matches(TYPE_API)) {
     br.getPage(link.getStringProperty("mainlink", null));
     if (br.getHttpConnection().getResponseCode() == 404) {
       throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
     }
     filename = link.getStringProperty("plain_filename", null);
   } else {
     br.getPage(link.getDownloadURL());
     if (br.containsHTML(">Page not found<")) {
       throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
     }
     filename = br.getRegex("<aside class=\"span2\">[\t\n\r ]+<h1>([^<>\"]*?)</h1>").getMatch(0);
     if (filename == null) {
       filename =
           br.getRegex("<title>([^<>\"]*?) \\- download and stream \\| AudioMack</title>")
               .getMatch(0);
     }
     if (filename == null) {
       filename = br.getRegex("name=\"twitter:title\" content=\"([^<>\"]*?)\"").getMatch(0);
     }
   }
   if (filename == null) {
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   if (filename != null && link.getFinalFileName() == null) {
     link.setFinalFileName(Encoding.htmlDecode(filename.trim()) + ".mp3");
   }
   return AvailableStatus.TRUE;
 }
 private boolean getUserLogin() throws Exception {
   /*
    * we have to load the plugins first! we must not reference a plugin class without loading it before
    */
   final PluginForHost hosterPlugin = JDUtilities.getPluginForHost("mediafire.com");
   final Account aa = AccountController.getInstance().getValidAccount(hosterPlugin);
   if (aa != null) {
     // Try to re-use session token as long as possible (it's valid for 10 minutes)
     final String savedusername = this.getPluginConfig().getStringProperty("username");
     final String savedpassword = this.getPluginConfig().getStringProperty("password");
     final String sessiontokenCreateDateObject =
         this.getPluginConfig().getStringProperty("sessiontokencreated2");
     long sessiontokenCreateDate = -1;
     if (sessiontokenCreateDateObject != null && sessiontokenCreateDateObject.length() > 0) {
       sessiontokenCreateDate = Long.parseLong(sessiontokenCreateDateObject);
     }
     if ((savedusername != null && savedusername.matches(aa.getUser()))
         && (savedpassword != null && savedpassword.matches(aa.getPass()))
         && System.currentTimeMillis() - sessiontokenCreateDate < 600000) {
       SESSIONTOKEN = this.getPluginConfig().getStringProperty("sessiontoken");
     } else {
       // Get token for user account
       apiRequest(
           br,
           "https://www.mediafire.com/api/user/get_session_token.php",
           "?email="
               + Encoding.urlEncode(aa.getUser())
               + "&password="******"&application_id="
               + MdfrFldr.APPLICATIONID
               + "&signature="
               + JDHash.getSHA1(
                   aa.getUser()
                       + aa.getPass()
                       + MdfrFldr.APPLICATIONID
                       + Encoding.Base64Decode(MdfrFldr.APIKEY))
               + "&version=1");
       SESSIONTOKEN = getXML("session_token", br.toString());
       this.getPluginConfig().setProperty("username", aa.getUser());
       this.getPluginConfig().setProperty("password", aa.getPass());
       this.getPluginConfig().setProperty("sessiontoken", SESSIONTOKEN);
       this.getPluginConfig().setProperty("sessiontokencreated2", "" + System.currentTimeMillis());
       this.getPluginConfig().save();
     }
   }
   return false;
 }
示例#28
0
 @Override
 public void handleFree(DownloadLink downloadLink) throws Exception, PluginException {
     requestFileInformation(downloadLink);
     final String hash = br.getRegex("\"hash_c\":\"([a-z0-9]+)\"").getMatch(0);
     String dllink = br.getRegex("\"return dl_me\\(this\\);\" href=\"(http://.*?)\"").getMatch(0);
     if (dllink == null) dllink = br.getRegex("\"(http://ng\\-st\\.esnips\\.com/dl_serve\\.php\\?file_id=userfolders/esnips/central/[a-z0-9\\-/]+\\&ts=\\d+)\"").getMatch(0);
     if (dllink == null || hash == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
     dllink = Encoding.htmlDecode(dllink) + "&hash=" + hash;
     dl = jd.plugins.BrowserAdapter.openDownload(br, downloadLink, dllink, false, 1);
     if (dl.getConnection().getContentType().contains("html")) {
         br.followConnection();
         throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
     }
     /** Server sends us internal filenames, we want nice filenames */
     final String tempFname = getFileNameFromHeader(dl.getConnection());
     String ext = tempFname.substring(tempFname.lastIndexOf("."));
     if (downloadLink.getFinalFileName() == null) {
         if (ext == null || ext.length() > 5) {
             downloadLink.setFinalFileName(tempFname);
         } else {
             downloadLink.setFinalFileName(downloadLink.getName() + ext);
         }
     }
     dl.startDownload();
 }
示例#29
0
 @Override
 public boolean checkLinks(final DownloadLink[] urls) {
   if (urls == null || urls.length == 0) {
     return false;
   }
   try {
     final Browser br = new Browser();
     prepBrowser(br);
     br.setCookiesExclusive(true);
     final StringBuilder sb = new StringBuilder();
     final ArrayList<DownloadLink> links = new ArrayList<DownloadLink>();
     int index = 0;
     while (true) {
       links.clear();
       while (true) {
         /* we test 50 links at once */
         if (index == urls.length || links.size() > 50) {
           break;
         }
         links.add(urls[index]);
         index++;
       }
       sb.delete(0, sb.capacity());
       sb.append("op=checkfiles&process=Check+URLs&list=");
       for (final DownloadLink dl : links) {
         sb.append(dl.getDownloadURL());
         sb.append("%0A");
       }
       br.postPage("http://qtyfiles.com/?op=checkfiles", sb.toString());
       for (final DownloadLink dllink : links) {
         if (br.containsHTML(
             ">" + dllink.getDownloadURL() + "</td><td style=\"color:red;\">Not found\\!</td>")) {
           dllink.setAvailable(false);
         } else {
           final String[][] linkInformation =
               br.getRegex(
                       ">"
                           + dllink.getDownloadURL()
                           + "</td><td style=\"color:green;\">Found</td><td>([^<>\"]*?)</td>")
                   .getMatches();
           if (linkInformation == null) {
             logger.warning("Linkchecker broken for qtyfiles.com");
             return false;
           }
           String name = extractFileNameFromURL(dllink.getDownloadURL());
           final String size = linkInformation[0][0];
           dllink.setAvailable(true);
           dllink.setName(Encoding.htmlDecode(name).replace(".html", ""));
           dllink.setDownloadSize(SizeFormatter.getSize(size));
         }
       }
       if (index == urls.length) {
         break;
       }
     }
   } catch (final Exception e) {
     return false;
   }
   return true;
 }
示例#30
0
 /** @param downloadLink */
 private void fixFilename(final DownloadLink downloadLink) {
   String oldName = downloadLink.getFinalFileName();
   if (oldName == null) {
     oldName = downloadLink.getName();
   }
   final String serverFilename = Encoding.htmlDecode(getFileNameFromHeader(dl.getConnection()));
   String newExtension = null;
   // some streaming sites do not provide proper file.extension within headers (Content-Disposition
   // or the fail over getURL()).
   if (serverFilename == null) {
     logger.info("Server filename is null, keeping filename: " + oldName);
   } else {
     if (serverFilename.contains(".")) {
       newExtension = serverFilename.substring(serverFilename.lastIndexOf("."));
     } else {
       logger.info("HTTP headers don't contain filename.extension information");
     }
   }
   if (newExtension != null && !oldName.endsWith(newExtension)) {
     String oldExtension = null;
     if (oldName.contains(".")) {
       oldExtension = oldName.substring(oldName.lastIndexOf("."));
     }
     if (oldExtension != null && oldExtension.length() <= 5) {
       downloadLink.setFinalFileName(oldName.replace(oldExtension, newExtension));
     } else {
       downloadLink.setFinalFileName(oldName + newExtension);
     }
   }
 }