diff --git a/ressourcen/jd/captcha/methods/rslr/example.png b/ressourcen/jd/captcha/methods/rslr/example.png deleted file mode 100644 index a2ac3a5a87..0000000000 Binary files a/ressourcen/jd/captcha/methods/rslr/example.png and /dev/null differ diff --git a/ressourcen/jd/captcha/methods/rslr/jacinfo.xml b/ressourcen/jd/captcha/methods/rslr/jacinfo.xml deleted file mode 100644 index 374823fd57..0000000000 --- a/ressourcen/jd/captcha/methods/rslr/jacinfo.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/ressourcen/jd/captcha/methods/rslr/letters.mth b/ressourcen/jd/captcha/methods/rslr/letters.mth deleted file mode 100644 index a1a859e6d0..0000000000 --- a/ressourcen/jd/captcha/methods/rslr/letters.mth +++ /dev/null @@ -1,39 +0,0 @@ - - -00000001|11111001|11111011|11110111|11100111|11001111|10000000|00000000 -0111100|1011001|1101011|1100011|1101011|1011101|0011110|0111111 -011111111100|011111111100|101110011100|101100000101|100000100001|110001110011|110011110011|111011111111 -01111110|00111100|10011101|10011001|11000011|11000011|11100111 -0111110|0111110|0011110|0011110|0011100|1011101|1000001|1100011 -110111|110111|110111|000000|000000|110011|110011|110011|110011|110011|110011|110011|110011|110011 -1100011|1011111|1001111|1110111|1111100|1111110|1111100|0000001 -11000111|10111111|10011111|11101111|11111001|11111100|11111001|00000011 -000|000|000|000|000|000|000|001|001 -0001000011|0000110001|0001111001|0001111100|0001111100|0001111100|0001111100|0001111100|0001111111 -001110111110001|000000001100000|000011100011110|000111110011110|000111110011110|000111110011110|000111110011100|000111110011101|000111110011101 -000|000|000|000|000|000|000|000|000|000|000|000|000 -00111111|00111111|00111111|00111111|00111111|00111111|00110011|00110111|00100111|00001111|00001111|00110001|00111000|00011111 -101|101|111|111|001|000|000|000|000|000|000|000|000 -00111111|00111111|00111111|00111111|00111111|00111111|00001111|00000001|00111101|00111100|00111100|00111100|00011100|00011111 -11100|11001|11011|11011|10011|10011|11011|11011|11011|11011|00000|11001|11001|11001 -10000011|00111001|00111000|00001111|00111111|10111111|11000001|11100111 -111111100|111111100|111111100|111111100|111111100|111000000|110000000|100111100|001111100|001111100|001111100|001111100|000000000|100000000 -11110111|11000001|10011011|00111111|01111111|01111111|00111110|10011100|11000001|11101111 -0011111111|0011111111|0011111111|0011111111|0011111111|0000000111|0001111001|0011111100|0011111100|0011111100|0001111100|0000000000|0000000001|1100001111 -1001111|0000011|1111001|1111101|1011100|1011100|0011110|1000000|1111110 -11000011|01111101|01111110|01111110|10111100|11100000|11111001|11110011|11100111|11000111|10001111|10011111 -11000011|01111101|01111110|01111110|10111100|11100000|11111001|11110011|11100111|11000111|10001111|10011111 -11101111|10011111|00111101|00111101|10011101|11100011|11100011|11001101|10011111|10011110|10011110|10011110|11000101|11110111 -000000000|000000010|111111110|111111110|111111100|111111100|111100000|111111001|111111001|111111001|111111001|111111001|111111001|111111001 -1111000000000|1111000000010|1111111111110|1111111111110|1111111111100|0000111111100|1111111100000|1111111111001|1111111111001|1111111111001|1111111111001|1111111111001|1111111111001|1111111111001 -11110111|11101111|11101111|11011111|10111111|10110001|00011110|00111110|00111110|00111101|00000011|11000111 -11110000000001|11110011000001|11110011111111|11110011111111|11110011111111|00000011111111|11110000001111|11111111110011|11111111111001|11111111111001|11111111111000|11111111110001|11110000000011|11110111111111 -0000000001|0011000001|0011111111|0011111111|0011111111|0011111111|0000001111|1111110011|1111111001|1111111001|1111111000|1111110001|0000000011|0111111111 -110001111|100011111|100011111|100011111|100111111|100111111|100111111|101111111|101111111|001110011|000110011|000000000|111110011|111110011 -0000001|0011101|1111101|1111101|1111001|1111011|1111101|1111100|1111100|1111100|1000000|0000000|1110011 -10000011|00000001|01111000|11111001|11111001|11110011|11110011|11100111|11001111|11011111|10000000|10000000|00000000 -000|000|000|000|000|000|000|001|001 -0000 -11000011|01111101|01111110|01111110|10111100|11100000|11111001|11110011|11100111|11000111|10001111|10011111 -111111100|111111100|111111100|111111100|111111100|111000000|110000000|100111100|001111100|001111100|001111100|001111100|000000000|100000000 - diff --git a/ressourcen/jd/captcha/methods/rslr/script.jas b/ressourcen/jd/captcha/methods/rslr/script.jas deleted file mode 100644 index 9ec0a58a17..0000000000 --- a/ressourcen/jd/captcha/methods/rslr/script.jas +++ /dev/null @@ -1,37 +0,0 @@ -#####-------------------------------------JAC-Script------------------------------------##### -##### Dieses Script beinhaltet alle Parameter und Funktioenen die für die captcha ##### -##### erkennung nötig sind ##### -#####################################---xup.in---#################################### -##############Set parameter -param.simplifyFaktor = 1; -param.trainOnlyUnknown=true; -param.colorType = RGB; - -param.borderVarianceX=5; -param.borderVarianceY=5; -param.scanVarianceX=5; -param.scanVarianceY=5; - -param.LetterSearchLimitPerfectPercent=1; -param.overlayNoiseSize=0; - -param.objectColorContrast = 0.2; -param.objectDetectionContrast = 0.9; -param.useObjectDetection = false; -param.scanAngleLeft=0; -param.scanAngleRight=0; -param.scanAngleSteps=3; -param.quickScanReliabilityLimit=3.0; -param.quickScanValityLimit=10.0; -param.preScanFilter=100; -param.preScanFaktor=3; -param.splitPixelObjectsOverlap=3; -param.errorAWeight=2; -param.errorBWeight=2; -param.coverageFaktorAWeight=2; -param.coverageFaktorBWeight=2; -param.cleftFaktor=0.6; - - -captcha.prepare.invert(); -captcha.prepare.toBlackAndWhite(0.002); diff --git a/ressourcen/outdated.dat b/ressourcen/outdated.dat index 36233667b2..1c36e48b60 100644 --- a/ressourcen/outdated.dat +++ b/ressourcen/outdated.dat @@ -745,4 +745,6 @@ jd/plugins/hoster/Upload24Net.class jd/plugins/decrypter/LnkBCm.class jd/plugins/hoster/BatubiaCom.class jd/plugins/hoster/MegaFreeKz.class -jd/plugins/decrypter/FuHdBz.class \ No newline at end of file +jd/plugins/decrypter/FuHdBz.class +jd/plugins/decrypter/RsLrCm.class +jd/captcha/methods/rslr \ No newline at end of file diff --git a/src/jd/plugins/decrypter/RsLrCm.java b/src/jd/plugins/decrypter/RsLrCm.java deleted file mode 100644 index 77528524c6..0000000000 --- a/src/jd/plugins/decrypter/RsLrCm.java +++ /dev/null @@ -1,159 +0,0 @@ -// jDownloader - Downloadmanager -// Copyright (C) 2008 JD-Team support@jdownloader.org -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -package jd.plugins.decrypter; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.regex.Pattern; - -import jd.PluginWrapper; -import jd.controlling.ProgressController; -import jd.nutils.encoding.Encoding; -import jd.parser.Regex; -import jd.parser.html.Form; -import jd.plugins.CryptedLink; -import jd.plugins.DecrypterException; -import jd.plugins.DecrypterPlugin; -import jd.plugins.DownloadLink; -import jd.plugins.PluginForDecrypt; -import jd.utils.JDUtilities; -import jd.utils.locale.JDL; - -@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "rs-layer.com" }, urls = { "http://[\\w\\.]*?rs-layer\\.com/(.+)\\.html" }, flags = { 0 }) -public class RsLrCm extends PluginForDecrypt { - - private static Pattern linkPattern = Pattern.compile("onclick=\"getFile\\('([^;]*)'\\)", Pattern.CASE_INSENSITIVE); - private static String strCaptchaPattern = " decryptedLinks) throws IOException { - String link_id = new Regex(cryptedLink, patternSupported).getMatch(0); - String container_link = "http://rs-layer.com/" + link_id + ContainerFormat; - if (br.containsHTML(container_link)) { - File container = JDUtilities.getResourceFile("container/" + System.currentTimeMillis() + ContainerFormat); - - br.cloneBrowser().downloadConnection(container, br.openGetConnection(container_link)); - decryptedLinks.addAll(JDUtilities.getController().getContainerLinks(container)); - container.delete(); - return true; - } - return false; - } - - // @Override - public ArrayList decryptIt(CryptedLink param, ProgressController progress) throws Exception { - ArrayList decryptedLinks = new ArrayList(); - String parameter = param.toString().replace("-jd.html", ".html"); - - br.getPage(parameter); - - // if (isExternInterfaceActive()) { - // - // // CNL Dummy - // if ((System.currentTimeMillis() - LATEST_OPENED_CNL_TIME) > 60 * 1000 - // && !CNL_URL_MAP.containsKey(parameter)) { - // if (br.getRegex("\\<\\!\\-\\- cnl \\-\\-\\>").matches()) { - // LATEST_OPENED_CNL_TIME = System.currentTimeMillis(); - // - // LocalBrowser.openDefaultURL(new URL(parameter.substring(0, - // parameter.lastIndexOf(".")) + "-jd.html")); - // CNL_URL_MAP.put(parameter, Boolean.TRUE); - // Balloon.show(JDL.L("jd.controlling.CNL2.checkText.title", - // "Click'n'Load"), null, JDL.L("jd.controlling.CNL2.checkText.message", - // "Click'n'Load URL opened")); - // return decryptedLinks; - // - // } - // } - // } - if (parameter.indexOf("/link-") != -1) { - String link = br.getRegex("").getMatch(0); - if (link == null) return null; - decryptedLinks.add(createDownloadlink(link)); - } else if (parameter.indexOf("/directory-") != -1) { - boolean cont = false; - for (int i = 1; i < 6; i++) { - Form[] forms = br.getForms(); - if (forms != null && forms.length != 0 && forms[0] != null && br.getRegex(linkPattern).getColumn(0).length == 0 && !br.containsHTML("\\/img\\/button")) { - Form captchaForm = forms[0]; - String captchaFileName = br.getRegex(strCaptchaPattern).getMatch(0); - if (captchaFileName == null) { return null; } - String captchaUrl = "http://rs-layer.com/" + captchaFileName; - String captchaCode = getCaptchaCode(captchaUrl, param); - captchaForm.put("captcha_input", captchaCode); - br.submitForm(captchaForm); - - if (br.containsHTML("Sicherheitscode
war nicht korrekt")) { - logger.info(JDL.L("plugins.decrypt.general.captchacodewrong", "Wrong CAPTCHA code")); - continue; - } - if (br.containsHTML("Gültigkeit für den
Sicherheitscode
ist abgelaufen")) { - logger.info(JDL.L("plugins.decrypt.rslayer.captchaexpired", "CAPTCHA code is too old")); - continue; - } - } else { - cont = true; - break; - } - } - if (cont == false) { throw new DecrypterException(DecrypterException.CAPTCHA); } - String layerLinks[] = br.getRegex(linkPattern).getColumn(0); - System.out.println(layerLinks.length); - if (layerLinks.length == 0) { - if (!add_container(parameter, ".dlc", decryptedLinks)) { - if (!add_container(parameter, ".rsdf", decryptedLinks)) { - add_container(parameter, ".ccf", decryptedLinks); - } - } - } else { - progress.setRange(layerLinks.length); - for (String element : layerLinks) { - br.getPage("http://rs-layer.com/link-" + element + ".html"); - String link = Encoding.htmlDecode(br.getRegex("").getMatch(0)); - - if (link != null) { - if (link.startsWith("http://")) { - decryptedLinks.add(createDownloadlink(Encoding.htmlDecode(link))); - } else { - - String dllink = "http://rs-layer.com/" + link; - br.getPage(dllink); - String finallink = br.getRegex("src=\"(.*?)\"").getMatch(0); - decryptedLinks.add(createDownloadlink(Encoding.htmlDecode(finallink))); - } - } - progress.increase(1); - } - } - } - - return decryptedLinks; - } - - // private boolean isExternInterfaceActive() { - // // DO NOT check for the plugin here. compatzibility reasons to 0.9* - // // better: check port 9666 for a httpserver - // - // return true; - // } - -} \ No newline at end of file diff --git a/src/jd/plugins/hoster/FileFeltoltoHu.java b/src/jd/plugins/hoster/FileFeltoltoHu.java new file mode 100644 index 0000000000..08d670989b --- /dev/null +++ b/src/jd/plugins/hoster/FileFeltoltoHu.java @@ -0,0 +1,124 @@ +//jDownloader - Downloadmanager +//Copyright (C) 2010 JD-Team support@jdownloader.org +// +//This program is free software: you can redistribute it and/or modify +//it under the terms of the GNU General Public License as published by +//the Free Software Foundation, either version 3 of the License, or +//(at your option) any later version. +// +//This program is distributed in the hope that it will be useful, +//but WITHOUT ANY WARRANTY; without even the implied warranty of +//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//GNU General Public License for more details. +// +//You should have received a copy of the GNU General Public License +//along with this program. If not, see . + +package jd.plugins.hoster; + +import java.io.IOException; + +import jd.PluginWrapper; +import jd.http.Browser; +import jd.http.URLConnectionAdapter; +import jd.nutils.encoding.Encoding; +import jd.parser.Regex; +import jd.plugins.DownloadLink; +import jd.plugins.DownloadLink.AvailableStatus; +import jd.plugins.HostPlugin; +import jd.plugins.LinkStatus; +import jd.plugins.PluginException; +import jd.plugins.PluginForHost; + +import org.appwork.utils.formatter.SizeFormatter; + +@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "filefeltolto.hu" }, urls = { "http://(www\\.)?filefeltolto\\.hu/(letoltes/[a-z0-9]+/[^<>\"/]+|x/[a-z0-9]+|xvidplayer_gateway\\.php\\?fid=\\d+)" }, flags = { 0 }) +public class FileFeltoltoHu extends PluginForHost { + + public FileFeltoltoHu(PluginWrapper wrapper) { + super(wrapper); + } + + @Override + public String getAGBLink() { + return "http://filefeltolto.hu/terms"; + } + + @Override + public AvailableStatus requestFileInformation(DownloadLink link) throws IOException, PluginException { + this.setBrowserExclusive(); + br.setFollowRedirects(true); + if (link.getDownloadURL().matches("http://(www\\.)?filefeltolto\\.hu/(letoltes/[a-z0-9]+/[^<>\"/]+|x/[a-z0-9]+)")) { + br.getPage(link.getDownloadURL()); + if (br.containsHTML("A fájl nem létezik, vagy törölve lett szerzői jogsértő tartalom miatt")) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND); + String filename = br.getRegex("class=\"left\">Fájlnév([^<>\"]*?)").getMatch(0); + if (filename == null) filename = br.getRegex("([^<>\"]*?) letöltés :: FileFeltolto\\.hu").getMatch(0); + String filesize = br.getRegex("\\((\\d+ KB)\\)").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)); + } else { + Browser br2 = br.cloneBrowser(); + // In case the link redirects to the finallink + br2.setFollowRedirects(true); + URLConnectionAdapter con = null; + try { + con = br2.openGetConnection(link.getDownloadURL()); + if (!con.getContentType().contains("html")) { + link.setDownloadSize(con.getLongContentLength()); + link.setFinalFileName(Encoding.htmlDecode(getFileNameFromHeader(con).trim())); + } else { + throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND); + } + return AvailableStatus.TRUE; + } finally { + try { + con.disconnect(); + } catch (Throwable e) { + } + } + } + return AvailableStatus.TRUE; + } + + @Override + public void handleFree(DownloadLink downloadLink) throws Exception, PluginException { + requestFileInformation(downloadLink); + String dllink = downloadLink.getDownloadURL(); + if (downloadLink.getDownloadURL().matches("http://(www\\.)?filefeltolto\\.hu/letoltes/[a-z0-9]+/[^<>\"/]+")) { + // Try to skip waittime + final String fid = br.getRegex(". + +package jd.plugins.hoster; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.SortedMap; +import java.util.TreeMap; +import java.util.regex.Pattern; + +import jd.PluginWrapper; +import jd.config.Property; +import jd.http.Browser; +import jd.http.Cookie; +import jd.http.Cookies; +import jd.http.URLConnectionAdapter; +import jd.nutils.encoding.Encoding; +import jd.parser.Regex; +import jd.parser.html.Form; +import jd.parser.html.HTMLParser; +import jd.plugins.Account; +import jd.plugins.AccountInfo; +import jd.plugins.DownloadLink; +import jd.plugins.DownloadLink.AvailableStatus; +import jd.plugins.HostPlugin; +import jd.plugins.LinkStatus; +import jd.plugins.Plugin; +import jd.plugins.PluginException; +import jd.plugins.PluginForHost; +import jd.utils.JDUtilities; +import jd.utils.locale.JDL; + +import org.appwork.utils.formatter.SizeFormatter; +import org.appwork.utils.formatter.TimeFormatter; + +@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "vreer.com" }, urls = { "https?://(www\\.)?vreer\\.com/[a-z0-9]{12}" }, flags = { 2 }) +public class VreerCom extends PluginForHost { + + private String correctedBR = ""; + private static final String PASSWORDTEXT = "(
Password: Passwort: 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}/(.*?)").getMatch(1); + if (filename == null) { + filename = new Regex(correctedBR, "fname\"( type=\"hidden\")? value=\"(.*?)\"").getMatch(1); + if (filename == null) { + filename = new Regex(correctedBR, "

Download File(.*?)

").getMatch(0); + if (filename == null) { + filename = new Regex(correctedBR, "(?i)(File)?name ?:? ?(<[^>]+> ?)+?([^<>\"\\']+)").getMatch(2); + } + } + } + String filesize = new Regex(correctedBR, "\\(([0-9]+ bytes)\\)").getMatch(0); + if (filesize == null) { + filesize = new Regex(correctedBR, "[ ]+\\(([^<>\"\\'/]+)\\)(.*?)").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); + } + filename = filename.replaceAll("(||\\.html)", ""); + link.setProperty("plainfilename", filename); + link.setFinalFileName(filename.trim()); + if (filesize != null && !filesize.equals("")) link.setDownloadSize(SizeFormatter.getSize(filesize)); + return AvailableStatus.TRUE; + } + + @Override + public void handleFree(DownloadLink downloadLink) throws Exception, PluginException { + requestFileInformation(downloadLink); + doFree(downloadLink, true, -2, "freelink"); + } + + public void doFree(DownloadLink downloadLink, boolean resumable, int maxchunks, String directlinkproperty) throws Exception, PluginException { + String passCode = null; + String md5hash = new Regex(correctedBR, "MD5.*?.*?nowrap>(.*?)<").getMatch(0); + if (md5hash != null) { + md5hash = md5hash.trim(); + logger.info("Found md5hash: " + md5hash); + downloadLink.setMD5Hash(md5hash); + } + + String dllink = checkDirectLink(downloadLink, directlinkproperty); + /** + * Video links can already be found here, if a link is found here we can + * skip wait times and captchas + */ + if (dllink == null) { + checkErrors(downloadLink, false, passCode); + if (correctedBR.contains("\"download1\"")) { + final String hash = new Regex(correctedBR, "name=\"hash\" value=\"([a-z0-9]+)\"").getMatch(0); + if (hash == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT); + waitTime(System.currentTimeMillis(), downloadLink); + postPage(br.getURL(), "op=download1&usr_login=&id=" + new Regex(downloadLink.getDownloadURL(), "/([A-Za-z0-9]{12})$").getMatch(0) + "&fname=" + Encoding.urlEncode(downloadLink.getStringProperty("plainfilename")) + "&hash=" + hash + "&referer=&method_free=Free+Download"); + checkErrors(downloadLink, false, passCode); + } + dllink = getDllink(); + } + if (dllink == null) { + Form dlForm = br.getFormbyProperty("name", "F1"); + if (dlForm == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT); + dlForm.remove(null); + final long timeBefore = System.currentTimeMillis(); + boolean password = false; + boolean skipWaittime = false; + if (new Regex(correctedBR, PASSWORDTEXT).matches()) { + password = true; + logger.info("The downloadlink seems to be password protected."); + } + + /* Captcha START */ + if (correctedBR.contains(";background:#ccc;text-align")) { + logger.info("Detected captcha method \"plaintext captchas\" for this host"); + /** Captcha method by ManiacMansion */ + String[][] letters = new Regex(Encoding.htmlDecode(br.toString()), "(\\d)").getMatches(); + if (letters == null || letters.length == 0) { + logger.warning("plaintext captchahandling broken!"); + throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT); + } + SortedMap capMap = new TreeMap(); + for (String[] letter : letters) { + capMap.put(Integer.parseInt(letter[0]), letter[1]); + } + StringBuilder code = new StringBuilder(); + for (String value : capMap.values()) { + code.append(value); + } + dlForm.put("code", code.toString()); + logger.info("Put captchacode " + code.toString() + " obtained by captcha metod \"plaintext captchas\" in the form."); + } else if (correctedBR.contains("/captchas/")) { + logger.info("Detected captcha method \"Standard captcha\" for this host"); + String[] sitelinks = HTMLParser.getHttpLinks(br.toString(), null); + String captchaurl = null; + if (sitelinks == null || sitelinks.length == 0) { + logger.warning("Standard captcha captchahandling broken!"); + throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT); + } + for (String link : sitelinks) { + if (link.contains("/captchas/")) { + captchaurl = link; + break; + } + } + if (captchaurl == null) { + logger.warning("Standard captcha captchahandling broken!"); + throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT); + } + String code = getCaptchaCode("xfilesharingprobasic", captchaurl, downloadLink); + dlForm.put("code", code); + logger.info("Put captchacode " + code + " obtained by captcha metod \"Standard captcha\" in the form."); + } else if (new Regex(correctedBR, "(api\\.recaptcha\\.net|google\\.com/recaptcha/api/)").matches()) { + logger.info("Detected captcha method \"Re Captcha\" for this host"); + PluginForHost recplug = JDUtilities.getPluginForHost("DirectHTTP"); + jd.plugins.hoster.DirectHTTP.Recaptcha rc = ((DirectHTTP) recplug).getReCaptcha(br); + rc.setForm(dlForm); + String id = new Regex(correctedBR, "\\?k=([A-Za-z0-9%_\\+\\- ]+)\"").getMatch(0); + rc.setId(id); + rc.load(); + File cf = rc.downloadCaptcha(getLocalCaptchaFile()); + String c = getCaptchaCode(cf, downloadLink); + Form rcform = rc.getForm(); + rcform.put("recaptcha_challenge_field", rc.getChallenge()); + rcform.put("recaptcha_response_field", Encoding.urlEncode(c)); + logger.info("Put captchacode " + c + " obtained by captcha metod \"Re Captcha\" in the form and submitted it."); + dlForm = rc.getForm(); + /** wait time is often skippable for reCaptcha handling */ + // skipWaittime = true; + } + /* Captcha END */ + if (password) passCode = handlePassword(passCode, dlForm, downloadLink); + if (!skipWaittime) waitTime(timeBefore, downloadLink); + sendForm(dlForm); + logger.info("Submitted DLForm"); + checkErrors(downloadLink, true, passCode); + dllink = getDllink(); + if (dllink == null) { + logger.warning("Final downloadlink (String is \"dllink\") regex didn't match!"); + throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT); + } + } + logger.info("Final downloadlink = " + dllink + " starting the download..."); + dl = jd.plugins.BrowserAdapter.openDownload(br, downloadLink, dllink, resumable, maxchunks); + if (dl.getConnection().getContentType().contains("html")) { + logger.warning("The final dllink seems not to be a file!"); + br.followConnection(); + correctBR(); + checkServerErrors(); + throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT); + } + downloadLink.setProperty(directlinkproperty, dllink); + if (passCode != null) downloadLink.setProperty("pass", passCode); + dl.startDownload(); + } + + @Override + public int getMaxSimultanFreeDownloadNum() { + return 1; + } + + /** Remove HTML code which could break the plugin */ + public void correctBR() throws NumberFormatException, PluginException { + correctedBR = br.toString(); + ArrayList someStuff = new ArrayList(); + ArrayList regexStuff = new ArrayList(); + regexStuff.add("<\\!(\\-\\-.*?\\-\\-)>"); + regexStuff.add("(display: none;\">.*?)"); + regexStuff.add("(visibility:hidden>.*?<)"); + for (String aRegex : regexStuff) { + String lolz[] = br.getRegex(aRegex).getColumn(0); + if (lolz != null) { + for (String dingdang : lolz) { + someStuff.add(dingdang); + } + } + } + for (String fun : someStuff) { + correctedBR = correctedBR.replace(fun, ""); + } + } + + public String getDllink() { + String dllink = br.getRedirectLocation(); + if (dllink == null) { + dllink = new Regex(correctedBR, "dotted #bbb;padding.*?\"]*?)\"").getMatch(0); + if (dllink == null) { + String cryptedScripts[] = new Regex(correctedBR, "p\\}\\((.*?)\\.split\\('\\|'\\)").getColumn(0); + if (cryptedScripts != null && cryptedScripts.length != 0) { + for (String crypted : cryptedScripts) { + dllink = decodeDownloadLink(crypted); + if (dllink != null) break; + } + } + } + } + + } + } + } + return dllink; + } + + private void getPage(String page) throws Exception { + br.getPage(page); + correctBR(); + } + + private void postPage(String page, String postdata) throws Exception { + br.postPage(page, postdata); + correctBR(); + } + + private void sendForm(Form form) throws Exception { + br.submitForm(form); + correctBR(); + } + + public void checkErrors(DownloadLink theLink, boolean checkAll, String passCode) throws NumberFormatException, PluginException { + if (checkAll) { + if (new Regex(correctedBR, PASSWORDTEXT).matches() || correctedBR.contains("Wrong password")) { + logger.warning("Wrong password, the entered password \"" + passCode + "\" is wrong, retrying..."); + throw new PluginException(LinkStatus.ERROR_RETRY, "Wrong password entered"); + } + if (correctedBR.contains("Wrong captcha")) { + logger.warning("Wrong captcha or wrong password!"); + throw new PluginException(LinkStatus.ERROR_CAPTCHA); + } + if (correctedBR.contains("\">Skipped countdown<")) throw new PluginException(LinkStatus.ERROR_FATAL, "Fatal countdown error (countdown skipped)"); + } + /** Wait time reconnect handling */ + if (new Regex(correctedBR, "(You have reached the download\\-limit|You have to wait)").matches()) { + /** TODO: Improve those regexes */ + String tmphrs = new Regex(correctedBR, "\\s+(\\d+)\\s+hours?").getMatch(0); + if (tmphrs == null) tmphrs = new Regex(correctedBR, "You have to wait.*?\\s+(\\d+)\\s+hours?").getMatch(0); + String tmpmin = new Regex(correctedBR, "\\s+(\\d+)\\s+minutes?").getMatch(0); + if (tmpmin == null) tmpmin = new Regex(correctedBR, "You have to wait.*?\\s+(\\d+)\\s+minutes?").getMatch(0); + String tmpsec = new Regex(correctedBR, "\\s+(\\d+)\\s+seconds?").getMatch(0); + String tmpdays = new Regex(correctedBR, "\\s+(\\d+)\\s+days?").getMatch(0); + if (tmphrs == null && tmpmin == null && tmpsec == null && tmpdays == null) { + logger.info("Waittime regexes seem to be broken"); + throw new PluginException(LinkStatus.ERROR_IP_BLOCKED, null, 60 * 60 * 1000l); + } else { + int minutes = 0, seconds = 0, hours = 0, days = 0; + if (tmphrs != null) hours = Integer.parseInt(tmphrs); + if (tmpmin != null) minutes = Integer.parseInt(tmpmin); + if (tmpsec != null) seconds = Integer.parseInt(tmpsec); + if (tmpdays != null) days = Integer.parseInt(tmpdays); + int waittime = ((days * 24 * 3600) + (3600 * hours) + (60 * minutes) + seconds + 1) * 1000; + logger.info("Detected waittime #2, waiting " + waittime + "milliseconds"); + /** Not enough wait time to reconnect->Wait and try again */ + if (waittime < 180000) { throw new PluginException(LinkStatus.ERROR_HOSTER_TEMPORARILY_UNAVAILABLE, JDL.L("plugins.hoster.xfilesharingprobasic.allwait", ALLWAIT_SHORT), waittime); } + throw new PluginException(LinkStatus.ERROR_IP_BLOCKED, null, waittime); + } + } + if (correctedBR.contains("You're using all download slots for IP")) { throw new PluginException(LinkStatus.ERROR_IP_BLOCKED, null, 10 * 60 * 1001l); } + if (correctedBR.contains("Error happened when generating Download Link")) throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Server error!", 10 * 60 * 1000l); + /** Error handling for only-premium links */ + if (new Regex(correctedBR, "( can download files up to |Upgrade your account to download bigger files|>Upgrade your account to download larger files|>The file You requested reached max downloads limit for Free Users|Please Buy Premium To download this file<|This file reached max downloads limit)").matches()) { + String filesizelimit = new Regex(correctedBR, "You can download files up to(.*?)only").getMatch(0); + if (filesizelimit != null) { + filesizelimit = filesizelimit.trim(); + logger.warning("As free user you can download files up to " + filesizelimit + " only"); + throw new PluginException(LinkStatus.ERROR_FATAL, "Free users can only download files up to " + filesizelimit); + } else { + logger.warning("Only downloadable via premium"); + throw new PluginException(LinkStatus.ERROR_FATAL, "Only downloadable via premium or registered"); + } + } + if (correctedBR.contains(MAINTENANCE)) throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, JDL.L("plugins.hoster.xfilesharingprobasic.undermaintenance", MAINTENANCEUSERTEXT), 2 * 60 * 60 * 1000l); + } + + public void checkServerErrors() throws NumberFormatException, PluginException { + if (new Regex(correctedBR, Pattern.compile("No file", Pattern.CASE_INSENSITIVE)).matches()) throw new PluginException(LinkStatus.ERROR_FATAL, "Server error"); + if (new Regex(correctedBR, "(File Not Found|

404 Not Found

)").matches()) { + logger.warning("Server says link offline, please recheck that!"); + throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND); + } + } + + private String decodeDownloadLink(String s) { + String decoded = null; + + try { + Regex params = new Regex(s, "\\'(.*?[^\\\\])\\',(\\d+),(\\d+),\\'(.*?)\\'"); + + String p = params.getMatch(0).replaceAll("\\\\", ""); + int a = Integer.parseInt(params.getMatch(1)); + int c = Integer.parseInt(params.getMatch(2)); + String[] k = params.getMatch(3).split("\\|"); + + while (c != 0) { + c--; + if (k[c].length() != 0) p = p.replaceAll("\\b" + Integer.toString(c, a) + "\\b", k[c]); + } + + decoded = p; + } catch (Exception e) { + } + + String finallink = null; + if (decoded != null) { + finallink = new Regex(decoded, "name=\"src\"value=\"(.*?)\"").getMatch(0); + if (finallink == null) { + finallink = new Regex(decoded, "type=\"video/divx\"src=\"(.*?)\"").getMatch(0); + if (finallink == null) { + finallink = new Regex(decoded, "\\.addVariable\\(\\'file\\',\\'(http://.*?)\\'\\)").getMatch(0); + } + } + } + return finallink; + } + + private String handlePassword(String passCode, Form pwform, DownloadLink thelink) throws IOException, PluginException { + passCode = thelink.getStringProperty("pass", null); + if (passCode == null) passCode = Plugin.getUserInput("Password?", thelink); + pwform.put("password", passCode); + logger.info("Put password \"" + passCode + "\" entered by user in the DLForm."); + return Encoding.urlEncode(passCode); + } + + private String checkDirectLink(DownloadLink downloadLink, String property) { + String dllink = downloadLink.getStringProperty(property); + if (dllink != null) { + try { + Browser br2 = br.cloneBrowser(); + URLConnectionAdapter con = br2.openGetConnection(dllink); + if (con.getContentType().contains("html") || con.getLongContentLength() == -1) { + downloadLink.setProperty(property, Property.NULL); + dllink = null; + } + con.disconnect(); + } catch (Exception e) { + downloadLink.setProperty(property, Property.NULL); + dllink = null; + } + } + return dllink; + } + + @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("Used space:.*?([0-9\\.]+) of [0-9\\.]+ (Mb|GB)
", 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.*?:([^<>\"\\']+)").getMatch(0); + if (availabletraffic != null && !availabletraffic.contains("nlimited") && !availabletraffic.equalsIgnoreCase(" Mb")) { + ai.setTrafficLeft(SizeFormatter.getSize(availabletraffic)); + } else { + ai.setUnlimitedTraffic(); + } + if (account.getBooleanProperty("nopremium")) { + ai.setStatus("Registered (free) User"); + } else { + String expire = new Regex(correctedBR, Pattern.compile("Premium(\\-| )Account expires?:.*?()?(\\d{1,2} [A-Za-z]+ \\d{4})()?", Pattern.CASE_INSENSITIVE)).getMatch(2); + if (expire == null) { + ai.setExpired(true); + account.setValid(false); + return ai; + } else { + expire = expire.replaceAll("(|)", ""); + ai.setValidUntil(TimeFormatter.getMilliSeconds(expire, "dd MMMM yyyy", null)); + } + ai.setStatus("Premium User"); + } + return ai; + } + + @Override + public void handlePremium(DownloadLink link, Account account) throws Exception { + String passCode = null; + requestFileInformation(link); + login(account, false); + br.setFollowRedirects(false); + String dllink = null; + if (account.getBooleanProperty("nopremium")) { + getPage(link.getDownloadURL()); + doFree(link, true, -2, "freelink2"); + } else { + dllink = checkDirectLink(link, "premlink"); + if (dllink == null) { + getPage(link.getDownloadURL()); + checkErrors(link, true, passCode); + Form dlform = br.getFormbyProperty("name", "F1"); + if (dlform == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT); + if (new Regex(correctedBR, PASSWORDTEXT).matches()) passCode = handlePassword(passCode, dlform, link); + sendForm(dlform); + dllink = getDllink(); + checkErrors(link, true, passCode); + } + if (dllink == null) { + logger.warning("Final downloadlink (String is \"dllink\") regex didn't match!"); + throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT); + } + logger.info("Final downloadlink = " + dllink + " starting the download..."); + dl = jd.plugins.BrowserAdapter.openDownload(br, link, dllink, true, -2); + if (dl.getConnection().getContentType().contains("html")) { + logger.warning("The final dllink seems not to be a file!"); + br.followConnection(); + correctBR(); + checkServerErrors(); + throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT); + } + if (passCode != null) link.setProperty("pass", passCode); + link.setProperty("premlink", dllink); + dl.startDownload(); + } + } + + @SuppressWarnings("unchecked") + private void login(Account account, boolean force) throws Exception { + synchronized (LOCK) { + try { + /** Load cookies */ + br.setCookiesExclusive(true); + 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 cookies = (HashMap) ret; + if (account.isValid()) { + for (final Map.Entry cookieEntry : cookies.entrySet()) { + final String key = cookieEntry.getKey(); + final String value = cookieEntry.getValue(); + this.br.setCookie(COOKIE_HOST, key, value); + } + return; + } + } + br.setCookie(COOKIE_HOST, "lang", "english"); + account.setProperty("nopremium", "false"); + getPage(COOKIE_HOST + "/login.html"); + Form loginform = br.getForm(1); + if (loginform == null) loginform = br.getForm(0); + 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, "xfsts") == null) throw new PluginException(LinkStatus.ERROR_PREMIUM, PluginException.VALUE_ID_PREMIUM_DISABLE); + getPage(COOKIE_HOST + "/?op=my_account"); + if (!new Regex(correctedBR, "(Premium(\\-| )Account expire|Upgrade to premium|>Renew premium<)").matches()) throw new PluginException(LinkStatus.ERROR_PREMIUM, PluginException.VALUE_ID_PREMIUM_DISABLE); + if (!new Regex(correctedBR, "(Premium(\\-| )Account expire|>Renew premium<)").matches()) account.setProperty("nopremium", "true"); + /** Save cookies */ + final HashMap cookies = new HashMap(); + 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; + } + } + } + + @Override + public int getMaxSimultanPremiumDownloadNum() { + return 1; + } + + @Override + public void reset() { + } + + @Override + public void resetDownloadlink(DownloadLink link) { + } + + private void waitTime(long timeBefore, DownloadLink downloadLink) throws PluginException { + int passedTime = (int) ((System.currentTimeMillis() - timeBefore) / 1000) - 1; + /** Ticket Time */ + String ttt = new Regex(correctedBR, "id=\"countdown_str\">[^<>\"]+\"]+\"( class=\"[^<>\"]+\")?>([\n ]+)?(\\d+)([\n ]+)?").getMatch(2); + if (ttt == null) ttt = new Regex(correctedBR, "\">Wait (\\d+)").getMatch(0); + if (ttt != null) { + int tt = Integer.parseInt(ttt); + tt -= passedTime; + logger.info("Waittime detected, waiting " + ttt + " - " + passedTime + " seconds from now on..."); + if (tt > 0) sleep(tt * 1000l, downloadLink); + } + } + +} \ No newline at end of file