示例#1
0
  @Override
  public Object getNextValue() {
    Object ret = getValue();
    long num = ((Number) ret).longValue();

    Unit unit = SizeFormatter.getBestUnit(num);
    long add = getStep(num, unit);

    long newV;
    if (nm.getMaximum() != null) {

      newV = (long) Math.min(((Number) nm.getMaximum()).longValue(), num + add);
    } else {
      newV = (long) (num + add);
    }
    Unit newUnit = SizeFormatter.getBestUnit((long) newV);
    if (newUnit == unit) {
      if (newV == num) {
        beep();
      }
      return newV;
    }

    newV = newUnit.getBytes1024() * 1;

    if (newV == num) {
      beep();
    }
    return newV;
  }
示例#2
0
  @Override
  public Object getPreviousValue() {
    final Object ret = this.getValue();
    final long num = ((Number) ret).longValue();
    final Unit unit = SizeFormatter.getBestUnit(num);
    long add = getStep(num, unit);
    long nv;
    if (this.nm.getMinimum() != null) {
      nv = (long) Math.max(((Number) this.nm.getMinimum()).longValue(), num - add);
    } else {
      nv = (long) (num - add);
    }
    final Unit nunit = SizeFormatter.getBestUnit(nv);
    if (nunit == unit) {
      if (nv == num) {
        this.beep();
      }
      return nv;
    }

    nv = nunit.getBytes1024() * 1000;
    if (nv == num) {
      this.beep();
    }
    return nv;
  }
示例#3
0
 @SuppressWarnings("deprecation")
 @Override
 public AvailableStatus requestFileInformation(final DownloadLink link)
     throws IOException, PluginException {
   this.setBrowserExclusive();
   br.setFollowRedirects(true);
   br.getPage(link.getDownloadURL());
   if (br.getHttpConnection().getResponseCode() == 404
       || this.br.containsHTML("img/404\\.jpg\"|>Whoops\\! 404")) {
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   }
   String filename = br.getRegex("<td>Dateiname:</td><td>([^<>\"]*?)<").getMatch(0);
   String filesize = br.getRegex("<td>Dateigröße:</td><td>([^<>\"]*?)<").getMatch(0);
   if (filename == null || filesize == null) {
     Regex filenameSize = br.getRegex("<p class=\"intro\"><b>(.*?)</b>\\s*\\((.*?)\\)");
     if (filename == null) {
       filename = filenameSize.getMatch(0);
     }
     if (filesize == null) {
       filesize = filenameSize.getMatch(1);
     }
   }
   if (filename == null) {
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   link.setName(Encoding.htmlDecode(filename.trim()));
   if (filesize != null) {
     link.setDownloadSize(SizeFormatter.getSize(filesize));
   }
   return AvailableStatus.TRUE;
 }
示例#4
0
 @SuppressWarnings("deprecation")
 @Override
 public AvailableStatus requestFileInformation(final DownloadLink link)
     throws IOException, PluginException {
   this.setBrowserExclusive();
   br.setFollowRedirects(true);
   br.getPage(link.getDownloadURL());
   if (br.getHttpConnection().getResponseCode() == 404
       || br.containsHTML(">The file you have requested does not exist")) {
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   }
   String filename =
       br.getRegex(
               "og:description\" content=\"(Watch|Listen to) (\\&#34;)?([^<>\"]*?)(\\&#34;)? on")
           .getMatch(2);
   if (filename == null) {
     filename =
         br.getRegex("data\\-type=\"video\">(Watch|Listen to) ([^<>\"]*?)(\\&nbsp;)?<strong>")
             .getMatch(1);
   }
   final String filesize =
       br.getRegex("<strong>\\((\\d+(\\.\\d{2})? (KB|MB|GB))\\)</strong>").getMatch(0);
   if (filename == null || filesize == null) {
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   filename = encodeUnicode(Encoding.htmlDecode(filename.trim()));
   if (filename.endsWith(" (...)")) {
     filename = filename.replace(" (...)", ".mp4");
   }
   link.setFinalFileName(filename);
   link.setDownloadSize(SizeFormatter.getSize(filesize));
   return AvailableStatus.TRUE;
 }
示例#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;
 }
示例#6
0
 @Override
 public AvailableStatus requestFileInformation(DownloadLink parameter) throws Exception {
   this.setBrowserExclusive();
   br.setFollowRedirects(true);
   br.setCookie(COOKIE_HOST, "mfh_mylang", "en");
   br.setCookie(COOKIE_HOST, "yab_mylang", "en");
   br.getPage(parameter.getDownloadURL());
   if (br.containsHTML("Your requested file is not found"))
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   String filename =
       br.getRegex("<b>File name:</b></td>.*?<td align=.*?width=.*?>(.*?)</td>").getMatch(0);
   if (filename == null) {
     filename = br.getRegex("\"Click this to report for(.*?)\"").getMatch(0);
     if (filename == null) {
       filename = br.getRegex("content=\"(.*?), The best file hosting service").getMatch(0);
       if (filename == null) {
         filename = br.getRegex("<title>(.*?)</title>").getMatch(0);
       }
     }
   }
   String filesize = br.getRegex("<b>File size:</b></td>.*?<td align=.*?>(.*?)</td>").getMatch(0);
   if (filename == null || filename.matches(""))
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   parameter.setFinalFileName(filename.trim());
   if (filesize != null) parameter.setDownloadSize(SizeFormatter.getSize(filesize));
   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 link)
     throws IOException, PluginException {
   this.setBrowserExclusive();
   br.setFollowRedirects(true);
   br.getPage(link.getDownloadURL());
   if (br.getURL().contains(SIMULTANDLSLIMIT) || br.getURL().contains(SIMULTANDLSLIMIT_2)) {
     link.setName(new Regex(link.getDownloadURL(), "([A-Za-z0-9]+)$").getMatch(0));
     link.getLinkStatus().setStatusText(SIMULTANDLSLIMITUSERTEXT);
     return AvailableStatus.TRUE;
   } else if (br.getURL().contains(SERVERERROR)) {
     link.setName(new Regex(link.getDownloadURL(), "([A-Za-z0-9]+)$").getMatch(0));
     link.getLinkStatus().setStatusText(SERVERERRORUSERTEXT);
     return AvailableStatus.TRUE;
   }
   if (br.getURL().contains("/error." + TYPE)
       || br.getURL().contains("/index." + TYPE)
       || br.containsHTML("No htmlCode read")
       || !br.containsHTML("class=\"downloadPageTableV2\"")) {
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   }
   final Regex fInfo =
       br.getRegex(
           "<th class=\"descr\"([^<>]*?)?>[\t\n\r ]+<strong>([^<>\"]*?) \\((\\d+(,\\d+)?(\\.\\d+)? (KB|MB|GB))\\)<br/>");
   final String filename = fInfo.getMatch(1);
   final String filesize = fInfo.getMatch(2);
   if (filename == null || filesize == null) {
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   link.setName(Encoding.htmlDecode(filename.trim()));
   link.setDownloadSize(SizeFormatter.getSize(filesize.replace(",", "")));
   return AvailableStatus.TRUE;
 }
示例#9
0
  @Override
  public AvailableStatus requestFileInformation(DownloadLink downloadLink)
      throws IOException, InterruptedException, PluginException {
    br.setFollowRedirects(true);
    for (int i = 0; i < 5; i++) {
      /* hoster blocks several useragents */
      this.setBrowserExclusive();
      br.getHeaders().put("User-Agent", RandomUserAgent.generate());
      br.setCookie("http://www.storeplace.org", "setlang", "en");
      br.getPage(downloadLink.getDownloadURL());
      if (!br.containsHTML("User-Agent not allowed")) break;
      Thread.sleep(250);
    }
    if (br.containsHTML("User-Agent not allowed"))
      throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
    if (br.containsHTML("Your requested file is not found"))
      throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
    String filename =
        Encoding.htmlDecode(
            br.getRegex("File name:</b></td>.*?<td align=.*?width=[0-9]+px>(.*?)</td>")
                .getMatch(0));
    String filesize = br.getRegex("File size:</b></td>.*?<td align=left>(.*?)</td>").getMatch(0);
    if (filename == null || filesize == null)
      throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
    downloadLink.setName(filename.trim());
    downloadLink.setDownloadSize(SizeFormatter.getSize(filesize.trim()));

    return AvailableStatus.TRUE;
  }
示例#10
0
 @Override
 public AvailableStatus requestFileInformation(final DownloadLink link)
     throws IOException, PluginException {
   this.setBrowserExclusive();
   br.setFollowRedirects(true);
   br.setCookie("http://qiannao.com", "language", "en_us");
   br.getPage(link.getDownloadURL());
   String filename = null, filesize = null;
   if (link.getDownloadURL().matches(SPACELINK)) {
     if (br.containsHTML(">文件大小:</div><span class=\"span2\">0 B\\&nbsp;<"))
       throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
     filename = new Regex(link.getDownloadURL(), "/([^<>\"/]*)/\\.page$").getMatch(0);
     filesize =
         br.getRegex(">文件大小:</div><span class=\"span2\">([^<>\"]*?)\\&nbsp;</span>").getMatch(0);
   } else {
     if (br.containsHTML("<title> \\- 千脑云电脑 我的在线电脑 \\| [^<>\"]*?</title>"))
       throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
     filename = br.getRegex("<h2 class=\"h2_title\">([^<>\"]*?)</h2>").getMatch(0);
     filesize =
         br.getRegex("<b>文件大小:</b>\\&nbsp;\\&nbsp;\\&nbsp;\\&nbsp;([^<>\"]*?)<br>").getMatch(0);
   }
   if (filename == null || filesize == null)
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   link.setName(Encoding.htmlDecode(filename.trim()));
   link.setDownloadSize(SizeFormatter.getSize(filesize));
   return AvailableStatus.TRUE;
 }
示例#11
0
 @Override
 public AvailableStatus requestFileInformation(DownloadLink link)
     throws IOException, PluginException {
   this.setBrowserExclusive();
   br.setFollowRedirects(true);
   br.setCookie("http://www.share4web.com/", "lang", "en");
   br.getPage(link.getDownloadURL());
   if (br.containsHTML(">File not found or removed|Page Not Found|File not found"))
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   if (br.containsHTML(SECURITYCAPTCHA)) {
     link.getLinkStatus().setStatusText("Can't check status, security captcha...");
     return AvailableStatus.UNCHECKABLE;
   }
   final Regex fileInfo =
       br.getRegex(
           "<small>Download file:</small><br/>([^<>\"]*?)<small>\\(([^<>\"]*?)\\)</small>");
   String filename = fileInfo.getMatch(0);
   String filesize = fileInfo.getMatch(1);
   if (filename == null || filesize == null)
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   // Server sends filename with .exe ending, prevent it by setting final
   // filename here
   link.setFinalFileName(Encoding.htmlDecode(filename.trim()));
   link.setDownloadSize(SizeFormatter.getSize(filesize));
   return AvailableStatus.TRUE;
 }
示例#12
0
  public AvailableStatus requestFileInformation(DownloadLink downloadLink)
      throws IOException, PluginException {
    this.setBrowserExclusive();
    br.setCookie("http://gigapeta.com", "lang", "us");
    br.getPage(downloadLink.getDownloadURL());
    if (br.containsHTML("All threads for IP")) {
      throw new PluginException(
          LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE,
          JDL.L("plugins.hoster.gigapeta.unavailable", "Your IP is already downloading a file"));
    }
    if (br.containsHTML("<div id=\"page_error\">")) {
      throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
    }
    Regex infos =
        br.getRegex(
            Pattern.compile(
                "<img src=\".*\" alt=\"file\" />\\-\\->(.*?)</td>.*?</tr>.*?<tr>.*?<th>.*?</th>.*?<td>(.*?)</td>",
                Pattern.DOTALL));
    String fileName = infos.getMatch(0);
    String fileSize = infos.getMatch(1);
    if (fileName == null || fileSize == null) {
      throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
    }
    downloadLink.setName(fileName.trim());
    downloadLink.setDownloadSize(SizeFormatter.getSize(fileSize.trim()));

    return AvailableStatus.TRUE;
  }
示例#13
0
 @Override
 public AvailableStatus requestFileInformation(final DownloadLink link)
     throws IOException, PluginException {
   this.setBrowserExclusive();
   br.setFollowRedirects(true);
   br.getPage(link.getDownloadURL());
   if (br.containsHTML("(>File Not Found<|>The file you were looking for could not be found)"))
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   // For invalid links
   if (br.containsHTML(">403 Forbidden<"))
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   String filename = br.getRegex(">Filename:</span> <div title=\"([^<>\"]*?)\"").getMatch(0);
   if (filename == null)
     filename =
         br.getRegex(
                 "<title>Dev\\-Host \\- ([^<>\"]*?) \\- The Ultimate Free File Hosting / File Sharing Service</title>")
             .getMatch(0);
   String filesize = br.getRegex("\\((\\d+ bytes)\\)").getMatch(0);
   if (filename == null || filesize == null)
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   link.setName(Encoding.htmlDecode(filename.trim()));
   link.setDownloadSize(SizeFormatter.getSize(filesize));
   final String md5 = br.getRegex(">MD5 Sum:</span> ([a-z0-9]{32})</div>").getMatch(0);
   if (md5 != null) link.setMD5Hash(md5);
   return AvailableStatus.TRUE;
 }
示例#14
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;
 }
示例#15
0
 @Override
 public AvailableStatus requestFileInformation(final DownloadLink link) throws Exception {
   br.setFollowRedirects(true);
   prepBrowser(br);
   getPage(link.getDownloadURL());
   if (new Regex(
           correctedBR,
           "(No such file|>File Not Found<|>The file was removed by|Reason for deletion:\n)")
       .matches()) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   if (new Regex(correctedBR, MAINTENANCE).matches()) {
     link.getLinkStatus().setStatusText(MAINTENANCEUSERTEXT);
     return AvailableStatus.TRUE;
   }
   if (br.getURL().contains("/?op=login&redirect=")) {
     link.getLinkStatus().setStatusText(PREMIUMONLY2);
     return AvailableStatus.UNCHECKABLE;
   }
   String[] fileInfo = new String[3];
   scanInfo(fileInfo);
   if (fileInfo[0] == null || fileInfo[0].equals("")) {
     if (correctedBR.contains("You have reached the download(\\-| )limit")) {
       logger.warning("Waittime detected, please reconnect to make the linkchecker work!");
       return AvailableStatus.UNCHECKABLE;
     }
     logger.warning("filename equals null, throwing \"plugin defect\"");
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   if (fileInfo[2] != null && !fileInfo[2].equals("")) link.setMD5Hash(fileInfo[2].trim());
   fileInfo[0] = fileInfo[0].replaceAll("(</b>|<b>|\\.html)", "");
   link.setFinalFileName(fileInfo[0].trim());
   if (fileInfo[1] != null && !fileInfo[1].equals(""))
     link.setDownloadSize(SizeFormatter.getSize(fileInfo[1]));
   return AvailableStatus.TRUE;
 }
示例#16
0
  @SuppressWarnings("deprecation")
  public AvailableStatus requestFileInformationWebsite(final DownloadLink link) throws Exception {
    final String downloadURL = link.getDownloadURL();
    this.setBrowserExclusive();
    br.setFollowRedirects(false);
    getPage(downloadURL);
    doSomething();
    if (br.containsHTML("<title>Error 404</title>")
        || br.getHttpConnection().getResponseCode() == 404) {
      throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
    }
    String fileName =
        new Regex(
                brbefore,
                "<h3 class=\"pull-left\" style=\"margin-left: 10px;\">(.*)</h3>[ \t\n\r\f]+<h3 class=\"pull-right\"")
            .getMatch(0);
    String fileSize =
        new Regex(brbefore, "<h3 class=\"pull-right\" style=\"margin-right: 10px;\">(.+?)</h3>")
            .getMatch(0);

    if (fileName == null || fileSize == null) {
      logger.warning("For link: " + downloadURL + ", final filename or filesize is null!");
      throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND, getPhrase("NO_LINK_DATA"));
    }

    link.setName(fileName.trim());
    link.setDownloadSize(SizeFormatter.getSize(fileSize));
    // setting this prevents from setting incorrect (shortened) filename from the request header
    link.setFinalFileName(link.getName());
    return AvailableStatus.TRUE;
  }
示例#17
0
 @Override
 public AvailableStatus requestFileInformation(DownloadLink link) throws Exception {
   this.setBrowserExclusive();
   br.setFollowRedirects(false);
   prepBrowser();
   getPage(link.getDownloadURL());
   if (new Regex(
           correctedBR,
           Pattern.compile(
               "(No such file|>File Not Found<|>The file was removed by|Reason (of|for) deletion:\n)",
               Pattern.CASE_INSENSITIVE))
       .matches()) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   if (correctedBR.contains(MAINTENANCE)) {
     link.getLinkStatus()
         .setStatusText(
             JDL.L("plugins.hoster.xfilesharingprobasic.undermaintenance", MAINTENANCEUSERTEXT));
     return AvailableStatus.TRUE;
   }
   String filename =
       new Regex(
               correctedBR,
               "You have requested.*?https?://(www\\.)?"
                   + this.getHost()
                   + "/[A-Za-z0-9]{12}/(.*?)</font>")
           .getMatch(1);
   if (filename == null) {
     filename = new Regex(correctedBR, "fname\"( type=\"hidden\")? value=\"(.*?)\"").getMatch(1);
     if (filename == null) {
       filename = new Regex(correctedBR, "<h2>Download File(.*?)</h2>").getMatch(0);
       if (filename == null) {
         filename = new Regex(correctedBR, "Filename:? ?(<[^>]+> ?)+?([^<>\"\\']+)").getMatch(1);
       }
     }
   }
   String filesize = new Regex(correctedBR, "\\(([0-9]+ bytes)\\)").getMatch(0);
   if (filesize == null) {
     filesize = new Regex(correctedBR, "</font>[ ]+\\(([^<>\"\\'/]+)\\)(.*?)</font>").getMatch(0);
     if (filesize == null) {
       filesize = new Regex(correctedBR, "([\\d\\.]+ ?(KB|MB|GB))").getMatch(0);
     }
   }
   if (filename == null || filename.equals("")) {
     if (correctedBR.contains("You have reached the download\\-limit")) {
       logger.warning("Waittime detected, please reconnect to make the linkchecker work!");
       return AvailableStatus.UNCHECKABLE;
     }
     logger.warning("The filename equals null, throwing \"plugin defect\" now...");
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   String md5hash = new Regex(correctedBR, "<b>MD5.*?</b>.*?nowrap>(.*?)<").getMatch(0);
   if (md5hash != null) link.setMD5Hash(md5hash.trim());
   filename = filename.replaceAll("(</b>|<b>|\\.html)", "");
   link.setProperty("plainfilename", filename);
   link.setFinalFileName(filename.trim());
   if (filesize != null && !filesize.equals(""))
     link.setDownloadSize(SizeFormatter.getSize(filesize));
   return AvailableStatus.TRUE;
 }
示例#18
0
 @Override
 public AccountInfo fetchAccountInfo(Account account) throws Exception {
   AccountInfo ai = new AccountInfo();
   try {
     login(account, true);
   } catch (PluginException e) {
     account.setValid(false);
     return ai;
   }
   String space =
       br.getRegex(
               Pattern.compile(
                   "<td>Used space:</td>.*?<td.*?b>([0-9\\.]+) of [0-9\\.]+ (Mb|GB)</b>",
                   Pattern.DOTALL | Pattern.CASE_INSENSITIVE))
           .getMatch(0);
   if (space != null) {
     ai.setUsedSpace(space.trim() + " Mb");
   }
   account.setValid(true);
   String availabletraffic =
       new Regex(correctedBR, "Traffic available.*?:</TD><TD><b>([^<>\"\\']+)</b>").getMatch(0);
   if (availabletraffic != null
       && !availabletraffic.contains("nlimited")
       && !availabletraffic.equalsIgnoreCase(" Mb")) {
     availabletraffic.trim();
     // need to set 0 traffic left, as getSize returns positive result, even when negative value
     // supplied.
     if (!availabletraffic.startsWith("-")) {
       ai.setTrafficLeft(SizeFormatter.getSize(availabletraffic));
     } else {
       ai.setTrafficLeft(0);
     }
   } else {
     ai.setUnlimitedTraffic();
   }
   if (account.getBooleanProperty("nopremium")) {
     ai.setStatus("Registered (free) User");
   } else {
     String expire =
         new Regex(
                 correctedBR,
                 Pattern.compile(
                     "<td>Premium(\\-| )Account expires?:</td>.*?<td>(<b>)?(\\d{1,2} [A-Za-z]+ \\d{4})(</b>)?</td>",
                     Pattern.CASE_INSENSITIVE))
             .getMatch(2);
     if (expire == null) {
       ai.setExpired(true);
       account.setValid(false);
       return ai;
     } else {
       expire = expire.replaceAll("(<b>|</b>)", "");
       ai.setValidUntil(TimeFormatter.getMilliSeconds(expire, "dd MMMM yyyy", null));
     }
     ai.setStatus("Premium User");
   }
   return ai;
 }
示例#19
0
 @Override
 public AvailableStatus requestFileInformation(final DownloadLink parameter) throws Exception {
   setBrowserExclusive();
   br.setDebug(true);
   /* workaround as server does not send correct encoding information */
   br.setCustomCharset("UTF-8");
   final String lastDl = parameter.getDownloadURL().replaceFirst("http://.*?/", "/");
   br.setCookie("http://hotfile.com", "lastdl", Encoding.urlEncode(lastDl));
   prepareBrowser(br);
   br.setFollowRedirects(true);
   // Differ between normal- and directlinks
   URLConnectionAdapter con = null;
   try {
     con = br.openGetConnection(parameter.getDownloadURL());
     if (!con.getContentType().contains("html")) {
       directDownload = true;
       parameter.setDownloadSize(con.getLongContentLength());
       parameter.setFinalFileName(getFileNameFromHeader(con));
       return AvailableStatus.TRUE;
     } else {
       br.followConnection();
     }
   } finally {
     try {
       con.disconnect();
     } catch (Throwable e) {
     }
   }
   br.setFollowRedirects(false);
   final Browser cl = new Browser();
   cl.setDebug(true);
   cl.setCookie("http://hotfile.com", "lastdl", br.getCookie("http://hotfile.com", "lastdl"));
   prepareBrowser(cl);
   cl.getHeaders().put("Referer", "http://hotfile.com/styles/structure.css");
   Browser.download(
       this.getLocalCaptchaFile(), cl.openGetConnection("http://hotfile.com/i/blank.gif"));
   if (br.getRedirectLocation() != null) {
     br.getPage(br.getRedirectLocation());
   }
   String filename = br.getRegex("Downloading <b>(.+?)</b>").getMatch(0);
   if (filename == null) {
     /* polish users get this */
     filename = br.getRegex("Downloading:</strong>(.*?)<").getMatch(0);
   }
   String filesize = br.getRegex("<span class=\"size\">(.*?)</span>").getMatch(0);
   if (filesize == null) {
     /* polish users get this */
     filesize = br.getRegex("Downloading:</strong>.*?span.*?strong>(.*?)<").getMatch(0);
   }
   if (filename == null || filesize == null) {
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   }
   parameter.setName(filename.trim());
   parameter.setDownloadSize(SizeFormatter.getSize(filesize.trim()));
   return AvailableStatus.TRUE;
 }
示例#20
0
 @Override
 public AvailableStatus requestFileInformation(DownloadLink link)
     throws IOException, PluginException {
   this.setBrowserExclusive();
   br.setFollowRedirects(false);
   br.setCookie(COOKIE_HOST, "lang", "english");
   br.getPage(link.getDownloadURL());
   doSomething();
   if (brbefore.contains("No such file")
       || brbefore.contains("No such user exist")
       || brbefore.contains("File not found")) {
     logger.warning("file is 99,99% offline, throwing \"file not found\" now...");
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   }
   String filename =
       br.getRegex("You have requested.*?http://.*?[a-z0-9]{12}/(.*?)</font>").getMatch(0);
   if (filename == null) {
     filename = new Regex(brbefore, "fname\" value=\"(.*?)\"").getMatch(0);
     if (filename == null) {
       filename = new Regex(brbefore, "<h2>Download File(.*?)</h2>").getMatch(0);
       if (filename == null) {
         filename = new Regex(brbefore, "Filename:</b></td><td[ ]{0,2}>(.*?)</td>").getMatch(0);
         if (filename == null) {
           filename = new Regex(brbefore, "Filename.*?nowrap.*?>(.*?)</td").getMatch(0);
           if (filename == null) {
             filename = new Regex(brbefore, "File Name.*?nowrap>(.*?)</td").getMatch(0);
           }
         }
       }
     }
   }
   String filesize = new Regex(brbefore, "<small>\\((.*?)\\)</small>").getMatch(0);
   if (filesize == null) {
     filesize = new Regex(brbefore, "\\(([0-9]+ bytes)\\)").getMatch(0);
     if (filesize == null) {
       filesize = new Regex(brbefore, "</font>[ ]+\\((.*?)\\)(.*?)</font>").getMatch(0);
     }
   }
   if (filename == null || filename.equals("")) {
     if (brbefore.contains("You have reached the download-limit")) {
       logger.warning("Waittime detected, please reconnect to make the linkchecker work!");
       return AvailableStatus.UNCHECKABLE;
     }
     logger.warning("The filename equals null, throwing \"plugin defect\" now...");
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   filename = filename.replaceAll("(</b>|<b>|\\.html)", "");
   link.setName(filename.trim());
   if (filesize != null && !filesize.equals("")) {
     logger.info("Filesize found, filesize = " + filesize);
     link.setDownloadSize(SizeFormatter.getSize(filesize));
   }
   return AvailableStatus.TRUE;
 }
示例#21
0
 /** TODO: Improve overall errorhandling. */
 @SuppressWarnings("deprecation")
 @Override
 public AvailableStatus requestFileInformation(final DownloadLink link)
     throws IOException, PluginException {
   setBrowserExclusive();
   /* To prefer english page UPDATE: English does not work anymore */
   br.setCustomCharset("utf-8");
   br.getHeaders().put("Accept-Language", "en-gb;q=0.9, en;q=0.8");
   changeToEnglish();
   br.setFollowRedirects(true);
   try {
     br.getPage(link.getDownloadURL());
   } catch (final BrowserException e) {
     if (br.getHttpConnection() != null && br.getHttpConnection().getResponseCode() == 502) {
       link.getLinkStatus()
           .setStatusText("We are sorry, but HellShare is unavailable in your country");
       return AvailableStatus.UNCHECKABLE;
     }
   }
   if (br.containsHTML(
           ">File not found|>File was deleted|>The file is private and can only be downloaded owner")
       || br.getHttpConnection().getResponseCode() == 404) {
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   }
   /* Folderlinks are unsupported! */
   if (br.containsHTML("id=\"snippet\\-\\-FolderList\"")) {
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   }
   String filesize = br.getRegex("FileSize_master\">(.*?)</strong>").getMatch(0);
   if (filesize == null) {
     filesize = br.getRegex("\"The content.*?with a size of (.*?) has been uploaded").getMatch(0);
   }
   String filename = br.getRegex("\"FileName_master\">(.*?)<").getMatch(0);
   if (filename == null) {
     filename = br.getRegex("\"The content (.*?) with a size").getMatch(0);
     if (filename == null) {
       filename = br.getRegex("<title>(.*?) – Download").getMatch(0);
       if (filename == null) {
         filename = br.getRegex("hidden\">Downloading file (.*?)</h1>").getMatch(0);
         if (filename == null) {
           filename = br.getRegex("keywords\" content=\"HellShare, (.*?)\"").getMatch(0);
         }
       }
     }
   }
   if (filename == null || filesize == null) {
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   filename = Encoding.htmlDecode(filename).trim();
   link.setName(filename);
   link.setDownloadSize(SizeFormatter.getSize(filesize.replace("&nbsp;", "")));
   link.setUrlDownload(br.getURL());
   return AvailableStatus.TRUE;
 }
示例#22
0
 @Override
 public AvailableStatus requestFileInformation(final DownloadLink downloadLink)
     throws IOException, PluginException {
   correctDownloadLink(downloadLink);
   downloadLink.setName(new Regex(downloadLink.getDownloadURL(), "([A-Za-z0-9]+)/?$").getMatch(0));
   this.setBrowserExclusive();
   prepBrowser();
   br.getHeaders().put("User-Agent", RandomUserAgent.generate());
   URLConnectionAdapter con = null;
   try {
     br.setCookie(MAINPAGE, "language", "en");
     con = br.openGetConnection(downloadLink.getDownloadURL());
     if (con.getResponseCode() == 503) {
       throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
     }
     br.followConnection();
   } finally {
     try {
       con.disconnect();
     } catch (Throwable e) {
     }
   }
   // Offline links
   if (br.containsHTML(
       "<title>Crocko\\.com 404</title>|>Requested file is deleted|>Searching for file")) {
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   }
   // Invalid links
   if (br.containsHTML(">you have no permission")) {
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   }
   String filename = br.getRegex(">Download: +<strong>(.*?)</strong>").getMatch(0);
   if (filename == null) {
     filename =
         br.getRegex(">Download:</span> <br />[\t\n\r ]+<strong>(.*?)</strong>").getMatch(0);
   }
   final String filesize =
       br.getRegex("<span class=\"tip1\"><span class=\"inner\">(.*?)</span></span>").getMatch(0);
   if (filename == null || filesize == null) {
     if (br.containsHTML("<h1>Software error:</h1>")) {
       return AvailableStatus.UNCHECKABLE;
     } else if (br.containsHTML(
         "(<div class=\"search_result\">|<form method=\"POST\" action=\"/search_form\">)")) {
       throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
     } else {
       logger.warning("crocko.com: plugin broken, filename or filesize missing");
       throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
     }
   }
   filename = filename.replaceAll("<br>", "");
   downloadLink.setName(Encoding.htmlDecode(filename.trim()));
   downloadLink.setDownloadSize(SizeFormatter.getSize(filesize.trim() + "b"));
   return AvailableStatus.TRUE;
 }
示例#23
0
  @Override
  public AvailableStatus requestFileInformation(final DownloadLink link)
      throws IOException, PluginException {
    setBrowserExclusive();
    br.setCookie("http://www.jumbofiles.com", "lang", "english");
    br.getPage(link.getDownloadURL());
    doSomething();
    if (BRBEFORE.contains("No such file")
        || BRBEFORE.contains("No such user exist")
        || BRBEFORE.contains("File not found")
        || BRBEFORE.contains(">File Not Found<")) {
      logger.warning("file is 99,99% offline, throwing \"file not found\" now...");
      throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
    }
    String filename = new Regex(BRBEFORE, "Filename:.*?</TD><TD>(.*?)</TD>").getMatch(0);
    String filesize = new Regex(BRBEFORE, "Filesize:.*?</TD><TD>(.*?)</TD>").getMatch(0);
    // They got different pages for stream, normal and pw-protected files so
    // we need special handling
    if (filesize == null) {
      filesize = new Regex(BRBEFORE, "<small>\\((.*?)\\)</small>").getMatch(0);
    }
    if (filesize == null) {
      filesize = new Regex(BRBEFORE, "F<TD><center>.*?<br>(.*?)<br>").getMatch(0);
    }
    if (filesize == null) {
      filesize = new Regex(BRBEFORE, "You have requested.*?>http.*?font> \\((.*?)\\)").getMatch(0);
    }

    if (filename == null) {
      filename =
          new Regex(
                  BRBEFORE,
                  "down_direct\" value=.*?<input type=\"image\" src=.*?</TD></TR>.*?<TR><TD>(.*?)<small")
              .getMatch(0);
    }
    if (filename == null) {
      filename = new Regex(BRBEFORE, "<TD><center>(.*?)<br>").getMatch(0);
    }
    if (filename == null) {
      filename = new Regex(BRBEFORE, "fname\" value=\"(.*?)\"").getMatch(0);
    }

    if (filename == null) {
      throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
    }
    filename = filename.replace("&nbsp;", "");
    filename = filename.trim();
    link.setName(filename);
    if (filesize != null) {
      link.setDownloadSize(SizeFormatter.getSize(filesize));
    }
    return AvailableStatus.TRUE;
  }
示例#24
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;
 }
示例#25
0
 @Override
 public AvailableStatus requestFileInformation(DownloadLink parameter) throws Exception {
   this.setBrowserExclusive();
   br.getPage(parameter.getDownloadURL());
   if (br.containsHTML("Oops, looks like we can\\'t find that page"))
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   String filename = br.getRegex("<em>(.*?)</em>").getMatch(0);
   br.setFollowRedirects(true);
   if (filename == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   String username = br.getRegex("\"username\":\"(.*?)\"").getMatch(0);
   filename = Encoding.htmlDecode(filename.trim());
   String type = br.getRegex("title=\"Uploaded format\">(.*?)<").getMatch(0);
   if (type == null) {
     type = br.getRegex("class=\"file\\-type\">(.*?)</span>").getMatch(0);
     if (type == null) type = "mp3";
   }
   username = username.trim();
   if (username != null && !filename.contains(username)) filename += " - " + username;
   filename += "." + type;
   if (!br.containsHTML("class=\"download pl\\-button\"")) {
     String[] data = br.getRegex("\"uid\":\"(.*?)\".*?\"token\":\"(.*?)\"").getRow(0);
     url = "http://media.soundcloud.com/stream/" + data[0] + "?stream_token=" + data[1];
     URLConnectionAdapter con = br.openGetConnection(url);
     if (!con.getContentType().contains("html"))
       parameter.setDownloadSize(con.getLongContentLength());
     else throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
     con.disconnect();
     parameter
         .getLinkStatus()
         .setStatusText(
             JDL.L(
                 "plugins.hoster.SoundCloudCom.status.previewavailable",
                 "Preview is downloadable"));
   } else {
     String filesize =
         br.getRegex("The file you're about to download has a size of (.*?)\"").getMatch(0);
     if (filesize != null) parameter.setDownloadSize(SizeFormatter.getSize(filesize));
     url = parameter.getDownloadURL() + "/download";
     parameter
         .getLinkStatus()
         .setStatusText(
             JDL.L(
                 "plugins.hoster.SoundCloudCom.status.downloadavailable",
                 "Original file is downloadable"));
   }
   parameter.setFinalFileName(filename);
   return AvailableStatus.TRUE;
 }
示例#26
0
 // @Override
 public AvailableStatus requestFileInformation(final DownloadLink downloadLink)
     throws IOException, PluginException {
   try {
     br.getPage(downloadLink.getDownloadURL());
   } catch (final UnknownHostException e) {
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   }
   if (!br.containsHTML("File Not Found")) {
     downloadLink.setName(
         Encoding.htmlDecode(br.getRegex("File Name:</span>(.*?)</span>").getMatch(0)));
     downloadLink.setDownloadSize(
         SizeFormatter.getSize(br.getRegex("File Size:</span>(.*?)</span>").getMatch(0)));
     return AvailableStatus.TRUE;
   }
   throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
 }
示例#27
0
 @Override
 public AvailableStatus requestFileInformation(DownloadLink link)
     throws IOException, PluginException {
   this.setBrowserExclusive();
   br.setFollowRedirects(true);
   br.getPage(link.getDownloadURL());
   if (br.containsHTML("(>404 Error \\- Page Not Found<|>Page Not Found)"))
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   String filename = br.getRegex("<title>([^<>\"]*?) Download for").getMatch(0);
   String filesize = br.getRegex("id=\"btn_file_size\">\\(([^<>\"]*?)\\)</span>").getMatch(0);
   if (filename == null || filesize == null)
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   link.setName(Encoding.htmlDecode(filename.trim()));
   link.setDownloadSize(SizeFormatter.getSize(filesize));
   return AvailableStatus.TRUE;
 }
示例#28
0
 @Override
 public AvailableStatus requestFileInformation(final DownloadLink link)
     throws IOException, PluginException {
   this.setBrowserExclusive();
   br.setFollowRedirects(true);
   br.getPage(link.getDownloadURL());
   if (br.getURL().equals("http://ulub.pl/") || !br.containsHTML("class=\"pobierz\""))
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   String filename = br.getRegex("property=\"og:title\" content=\"([^<>\"]*?)\"").getMatch(0);
   if (filename == null)
     filename = br.getRegex("<h1 class=\"h1_pad\">Pobierz MP3 \"([^<>\"]*?)\"</h1>").getMatch(0);
   final String filesize = br.getRegex("kHz (\\d+\\.\\d+ (Kb|Mb))</span>").getMatch(0);
   if (filename == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   link.setFinalFileName(Encoding.htmlDecode(filename.trim()) + ".mp3");
   if (filesize != null) link.setDownloadSize(SizeFormatter.getSize(filesize));
   return AvailableStatus.TRUE;
 }
示例#29
0
  @Override
  public AvailableStatus requestFileInformation(final DownloadLink link)
      throws IOException, PluginException {
    this.setBrowserExclusive();
    br.setFollowRedirects(true);
    br.setCookie("http://qiannao.com", "language", "en_us");
    br.getHeaders()
        .put(
            "User-Agent",
            "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0");
    br.getHeaders()
        .put("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
    br.getHeaders().put("Accept-Language", "en-US,en;q=0.5");
    br.getPage(link.getDownloadURL());

    // No_access|user_banned|file_deleted|strange_exception
    if (br.containsHTML(
        "<span> 资源已被禁止访问</span>|用户已被禁用。</span>|<span> 资源已被删除</span>|<span>java\\.io\\.FileNotFoundException"))
      throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);

    // Cookies needed to start the download
    final String vid = br.getRegex("setCookie\\(\"vid\", \"([a-z0-9]+)\"").getMatch(0);
    if (vid != null) br.setCookie("http://qiannao.com/", "vid", vid);
    final String vid1 = br.getRegex("setCookie\\(\"vid1\", \"([a-z0-9]+)\"").getMatch(0);
    if (vid1 != null) br.setCookie("http://qiannao.com/", "vid1", vid1);

    String filename = null, filesize = null;
    if (link.getDownloadURL().matches(SPACELINK)) {
      if (br.containsHTML(">文件大小:</div><span class=\"span2\">0 B\\&nbsp;<"))
        throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
      filename = new Regex(link.getDownloadURL(), "/([^<>\"/]*)/\\.page$").getMatch(0);
      filesize =
          br.getRegex(">文件大小:</div><span class=\"span2\">([^<>\"]*?)\\&nbsp;</span>").getMatch(0);
    } else {
      if (br.containsHTML("<title> \\- 千脑云电脑 我的在线电脑 \\| [^<>\"]*?</title>"))
        throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
      filename = br.getRegex("<h2 class=\"h2_title\">([^<>\"]*?)</h2>").getMatch(0);
      filesize =
          br.getRegex("<b>文件大小:</b>\\&nbsp;\\&nbsp;\\&nbsp;\\&nbsp;([^<>\"]*?)<br>").getMatch(0);
    }
    if (filename == null || filesize == null)
      throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
    link.setName(Encoding.htmlDecode(filename.trim()));
    link.setDownloadSize(SizeFormatter.getSize(filesize));
    return AvailableStatus.TRUE;
  }
 @Override
 public AvailableStatus requestFileInformation(DownloadLink link)
     throws IOException, PluginException {
   this.setBrowserExclusive();
   br.setFollowRedirects(true);
   br.getPage(link.getDownloadURL());
   if (br.containsHTML("(>System Error<|>could not find file)"))
     throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
   final String filename =
       br.getRegex(">Name</b>[\r\n\t ]+</td>[\r\n\t ]+<td>([^<>\"]+)</td>").getMatch(0);
   final String filesize =
       br.getRegex(">Size</b>[\r\n\t ]+</td>[\r\n\t ]+<td>([^<>\"]+)</td>").getMatch(0);
   if (filename == null || filesize == null)
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   link.setName(Encoding.htmlDecode(filename.trim()));
   link.setDownloadSize(SizeFormatter.getSize(filesize));
   return AvailableStatus.TRUE;
 }