mirror of
https://github.com/mirror/jdownloader.git
synced 2024-11-27 05:50:51 +00:00
-rs-layer: RIP (+captchamethod)
-Added support for filefeltolto closes #4606 -Added support for vreer (+premium) git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@16328 ebf7c1c2-ba36-0410-9fe8-c592906822b4
This commit is contained in:
parent
1dbcae9d51
commit
5f593bcd79
Binary file not shown.
Before Width: | Height: | Size: 672 B |
@ -1,4 +0,0 @@
|
||||
<jDownloader>
|
||||
<method name="rs-layer.com" author="JD-Team" services="rs-layer.com"/>
|
||||
<format type="png" letterNum="6"/>
|
||||
</jDownloader>
|
@ -1,39 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<jDownloader>
|
||||
<letter bad="1" captchaHash="0d43c945b9f49f7f5c3ab097d0d28544" good="22" id="0" value="z">00000001|11111001|11111011|11110111|11100111|11001111|10000000|00000000</letter>
|
||||
<letter bad="0" captchaHash="38ce6fe83c8c3f5a2ef1c4db2b9e4f36" good="27" id="1" value="x">0111100|1011001|1101011|1100011|1101011|1011101|0011110|0111111</letter>
|
||||
<letter bad="2" captchaHash="38ce6fe83c8c3f5a2ef1c4db2b9e4f36" good="14" id="2" value="w">011111111100|011111111100|101110011100|101100000101|100000100001|110001110011|110011110011|111011111111</letter>
|
||||
<letter bad="1" captchaHash="38ce6fe83c8c3f5a2ef1c4db2b9e4f36" good="19" id="3" value="v">01111110|00111100|10011101|10011001|11000011|11000011|11100111</letter>
|
||||
<letter bad="0" captchaHash="d4bf5df4b0cfc9514bc87d4d25f217c3" good="7" id="4" value="u">0111110|0111110|0011110|0011110|0011100|1011101|1000001|1100011</letter>
|
||||
<letter bad="0" captchaHash="0d43c945b9f49f7f5c3ab097d0d28544" good="7" id="5" value="t">110111|110111|110111|000000|000000|110011|110011|110011|110011|110011|110011|110011|110011|110011</letter>
|
||||
<letter bad="0" captchaHash="330d9d18e9bf71294ebfbafcf992c053" good="1" id="6" value="s">1100011|1011111|1001111|1110111|1111100|1111110|1111100|0000001</letter>
|
||||
<letter bad="0" captchaHash="6956db54cca23e6afca3f83746772c79" good="8" id="7" value="s">11000111|10111111|10011111|11101111|11111001|11111100|11111001|00000011</letter>
|
||||
<letter bad="1" captchaHash="0b0670bc0d8cc2e0c0def23b9f711204" good="13" id="8" value="r">000|000|000|000|000|000|000|001|001</letter>
|
||||
<letter bad="0" captchaHash="1af27d7874af2fe48ed78e41782c71fe" good="20" id="9" value="n">0001000011|0000110001|0001111001|0001111100|0001111100|0001111100|0001111100|0001111100|0001111111</letter>
|
||||
<letter bad="0" captchaHash="1af27d7874af2fe48ed78e41782c71fe" good="11" id="10" value="m">001110111110001|000000001100000|000011100011110|000111110011110|000111110011110|000111110011110|000111110011100|000111110011101|000111110011101</letter>
|
||||
<letter bad="0" captchaHash="1af27d7874af2fe48ed78e41782c71fe" good="16" id="11" value="l">000|000|000|000|000|000|000|000|000|000|000|000|000</letter>
|
||||
<letter bad="0" captchaHash="1846fac96adc29dcd77da1e2ffa171ec" good="29" id="12" value="k">00111111|00111111|00111111|00111111|00111111|00111111|00110011|00110111|00100111|00001111|00001111|00110001|00111000|00011111</letter>
|
||||
<letter bad="0" captchaHash="38ce6fe83c8c3f5a2ef1c4db2b9e4f36" good="6" id="13" value="i">101|101|111|111|001|000|000|000|000|000|000|000|000</letter>
|
||||
<letter bad="0" captchaHash="38ce6fe83c8c3f5a2ef1c4db2b9e4f36" good="18" id="14" value="h">00111111|00111111|00111111|00111111|00111111|00111111|00001111|00000001|00111101|00111100|00111100|00111100|00011100|00011111</letter>
|
||||
<letter bad="0" captchaHash="1846fac96adc29dcd77da1e2ffa171ec" good="21" id="15" value="f">11100|11001|11011|11011|10011|10011|11011|11011|11011|11011|00000|11001|11001|11001</letter>
|
||||
<letter bad="0" captchaHash="8b24bfba940025433d0a2191122a51f0" good="6" id="16" value="e">10000011|00111001|00111000|00001111|00111111|10111111|11000001|11100111</letter>
|
||||
<letter bad="2" captchaHash="1af27d7874af2fe48ed78e41782c71fe" good="25" id="17" value="d">111111100|111111100|111111100|111111100|111111100|111000000|110000000|100111100|001111100|001111100|001111100|001111100|000000000|100000000</letter>
|
||||
<letter bad="0" captchaHash="6b989886deb032f68180cb3b6ca8c93e" good="6" id="18" value="c">11110111|11000001|10011011|00111111|01111111|01111111|00111110|10011100|11000001|11101111</letter>
|
||||
<letter bad="0" captchaHash="0b0670bc0d8cc2e0c0def23b9f711204" good="13" id="19" value="b">0011111111|0011111111|0011111111|0011111111|0011111111|0000000111|0001111001|0011111100|0011111100|0011111100|0001111100|0000000000|0000000001|1100001111</letter>
|
||||
<letter bad="0" captchaHash="6b989886deb032f68180cb3b6ca8c93e" good="7" id="20" value="a">1001111|0000011|1111001|1111101|1011100|1011100|0011110|1000000|1111110</letter>
|
||||
<letter bad="1" captchaHash="fc9b31ea7e626e79489283c208746143" good="8" id="21" value="9">11000011|01111101|01111110|01111110|10111100|11100000|11111001|11110011|11100111|11000111|10001111|10011111</letter>
|
||||
<letter bad="0" captchaHash="03132d46d139dee0d19a8c628f53fef9" good="0" id="22" value="9">11000011|01111101|01111110|01111110|10111100|11100000|11111001|11110011|11100111|11000111|10001111|10011111</letter>
|
||||
<letter bad="0" captchaHash="3f46f2fdb15d9bd2a6465c3f7a7e7263" good="11" id="23" value="8">11101111|10011111|00111101|00111101|10011101|11100011|11100011|11001101|10011111|10011110|10011110|10011110|11000101|11110111</letter>
|
||||
<letter bad="0" captchaHash="741bc47a1c970a02dafd7359ac8e47d1" good="23" id="24" value="7">000000000|000000010|111111110|111111110|111111100|111111100|111100000|111111001|111111001|111111001|111111001|111111001|111111001|111111001</letter>
|
||||
<letter bad="0" captchaHash="0b0670bc0d8cc2e0c0def23b9f711204" good="0" id="25" value="7">1111000000000|1111000000010|1111111111110|1111111111110|1111111111100|0000111111100|1111111100000|1111111111001|1111111111001|1111111111001|1111111111001|1111111111001|1111111111001|1111111111001</letter>
|
||||
<letter bad="5" captchaHash="9a9a970710b1f7e90c71b528d1ecb151" good="21" id="26" value="6">11110111|11101111|11101111|11011111|10111111|10110001|00011110|00111110|00111110|00111101|00000011|11000111</letter>
|
||||
<letter bad="0" captchaHash="9a9a970710b1f7e90c71b528d1ecb151" good="0" id="27" value="5">11110000000001|11110011000001|11110011111111|11110011111111|11110011111111|00000011111111|11110000001111|11111111110011|11111111111001|11111111111001|11111111111000|11111111110001|11110000000011|11110111111111</letter>
|
||||
<letter bad="0" captchaHash="8d00f35fdd52218f4425a3c86fd3f0f9" good="7" id="28" value="5">0000000001|0011000001|0011111111|0011111111|0011111111|0011111111|0000001111|1111110011|1111111001|1111111001|1111111000|1111110001|0000000011|0111111111</letter>
|
||||
<letter bad="0" captchaHash="fd6949cb76852ab242805fe90e53296a" good="12" id="29" value="4">110001111|100011111|100011111|100011111|100111111|100111111|100111111|101111111|101111111|001110011|000110011|000000000|111110011|111110011</letter>
|
||||
<letter bad="0" captchaHash="741bc47a1c970a02dafd7359ac8e47d1" good="20" id="30" value="3">0000001|0011101|1111101|1111101|1111001|1111011|1111101|1111100|1111100|1111100|1000000|0000000|1110011</letter>
|
||||
<letter bad="1" captchaHash="0d43c945b9f49f7f5c3ab097d0d28544" good="20" id="31" value="2">10000011|00000001|01111000|11111001|11111001|11110011|11110011|11100111|11001111|11011111|10000000|10000000|00000000</letter>
|
||||
<letter bad="0" captchaHash="d4bf5df4b0cfc9514bc87d4d25f217c3" good="0" id="32" value=".">000|000|000|000|000|000|000|001|001</letter>
|
||||
<letter bad="0" captchaHash="d4bf5df4b0cfc9514bc87d4d25f217c3" good="4" id="33" value=".">0000</letter>
|
||||
<letter bad="0" captchaHash="d4bf5df4b0cfc9514bc87d4d25f217c3" good="0" id="34" value=".">11000011|01111101|01111110|01111110|10111100|11100000|11111001|11110011|11100111|11000111|10001111|10011111</letter>
|
||||
<letter bad="0" captchaHash="d4bf5df4b0cfc9514bc87d4d25f217c3" good="0" id="35" value=".">111111100|111111100|111111100|111111100|111111100|111000000|110000000|100111100|001111100|001111100|001111100|001111100|000000000|100000000</letter>
|
||||
</jDownloader>
|
@ -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);
|
@ -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
|
||||
jd/plugins/decrypter/FuHdBz.class
|
||||
jd/plugins/decrypter/RsLrCm.class
|
||||
jd/captcha/methods/rslr
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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 = "<img src=\"(captcha-[^\"]*\\.png)\" ";
|
||||
private Pattern patternSupported = Pattern.compile("http://[\\w\\.]*?rs-layer\\.com/(.+)\\.html", Pattern.CASE_INSENSITIVE);
|
||||
|
||||
public RsLrCm(PluginWrapper wrapper) {
|
||||
super(wrapper);
|
||||
}
|
||||
|
||||
private boolean add_container(String cryptedLink, String ContainerFormat, ArrayList<DownloadLink> 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<DownloadLink> decryptIt(CryptedLink param, ProgressController progress) throws Exception {
|
||||
ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
|
||||
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("<frame.*?src=\"(.*?)\".*?>").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<br />war nicht korrekt")) {
|
||||
logger.info(JDL.L("plugins.decrypt.general.captchacodewrong", "Wrong CAPTCHA code"));
|
||||
continue;
|
||||
}
|
||||
if (br.containsHTML("Gültigkeit für den<br> Sicherheitscode<br>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("<i?frame.*?src=\"(.*?)\".*?>").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;
|
||||
// }
|
||||
|
||||
}
|
124
src/jd/plugins/hoster/FileFeltoltoHu.java
Normal file
124
src/jd/plugins/hoster/FileFeltoltoHu.java
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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</td><td>([^<>\"]*?)</td></tr>").getMatch(0);
|
||||
if (filename == null) filename = br.getRegex("<title>([^<>\"]*?) letöltés :: FileFeltolto\\.hu</title>").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("<input type=\"hidden\" name=\"fid\" value=\"(\\d+)\"").getMatch(0);
|
||||
if (fid != null) {
|
||||
dllink = "http://filefeltolto.hu/xvidplayer_gateway.php?fid=" + fid;
|
||||
} else {
|
||||
int wait = 10;
|
||||
String waittime = br.getRegex("var limit=\\'0:(\\d+)\\';").getMatch(0);
|
||||
if (waittime != null) wait = Integer.parseInt(waittime);
|
||||
// Activate waittime
|
||||
br.getHeaders().put("X-Requested-With", "XMLHttpRequest");
|
||||
br.postPage("http://filefeltolto.hu/ajax/set.php", "hash=" + new Regex(downloadLink.getDownloadURL(), "filefeltolto\\.hu/letoltes/([a-z0-9]+)/").getMatch(0));
|
||||
sleep(wait * 1001l, downloadLink);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
dl.startDownload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxSimultanFreeDownloadNum() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetDownloadlink(DownloadLink link) {
|
||||
}
|
||||
|
||||
}
|
599
src/jd/plugins/hoster/VreerCom.java
Normal file
599
src/jd/plugins/hoster/VreerCom.java
Normal file
@ -0,0 +1,599 @@
|
||||
//jDownloader - Downloadmanager
|
||||
//Copyright (C) 2012 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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 = "(<br><b>Password:</b> <input|<br><b>Passwort:</b> <input)";
|
||||
private static final String COOKIE_HOST = "http://vreer.com";
|
||||
private static final String MAINTENANCE = ">This server is in maintenance mode";
|
||||
private static final String MAINTENANCEUSERTEXT = "This server is under Maintenance";
|
||||
private static final String ALLWAIT_SHORT = "Waiting till new downloads can be started";
|
||||
private static final Object LOCK = new Object();
|
||||
|
||||
// XfileSharingProBasic Version 2.5.4.7, MANY modifications, do NOT update
|
||||
// with new xfilesharing version!!
|
||||
@Override
|
||||
public void correctDownloadLink(DownloadLink link) {
|
||||
link.setUrlDownload(link.getDownloadURL().replace("https://", "http://"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAGBLink() {
|
||||
return COOKIE_HOST + "/tos.html";
|
||||
}
|
||||
|
||||
public VreerCom(PluginWrapper wrapper) {
|
||||
super(wrapper);
|
||||
this.enablePremium(COOKIE_HOST + "/premium.html");
|
||||
}
|
||||
|
||||
// do not add @Override here to keep 0.* compatibility
|
||||
public boolean hasAutoCaptcha() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// do not add @Override here to keep 0.* compatibility
|
||||
public boolean hasCaptcha() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AvailableStatus requestFileInformation(DownloadLink link) throws Exception {
|
||||
this.setBrowserExclusive();
|
||||
br.setFollowRedirects(false);
|
||||
br.setCookie(COOKIE_HOST, "lang", "english");
|
||||
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, "(?i)(File)?name ?:? ?(<[^>]+> ?)+?([^<>\"\\']+)").getMatch(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
String filesize = new Regex(correctedBR, "\\(([0-9]+ bytes)\\)").getMatch(0);
|
||||
if (filesize == null) {
|
||||
filesize = new Regex(correctedBR, "</font>[ ]+\\(([^<>\"\\'/]+)\\)(.*?)</font>").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("(</b>|<b>|\\.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, "<b>MD5.*?</b>.*?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()), "<span style=\\'position:absolute;padding\\-left:(\\d+)px;padding\\-top:\\d+px;\\'>(\\d)</span>").getMatches();
|
||||
if (letters == null || letters.length == 0) {
|
||||
logger.warning("plaintext captchahandling broken!");
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
|
||||
}
|
||||
SortedMap<Integer, String> capMap = new TreeMap<Integer, String>();
|
||||
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<String> someStuff = new ArrayList<String>();
|
||||
ArrayList<String> regexStuff = new ArrayList<String>();
|
||||
regexStuff.add("<\\!(\\-\\-.*?\\-\\-)>");
|
||||
regexStuff.add("(display: none;\">.*?</div>)");
|
||||
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.*?<a href=\"(.*?)\"").getMatch(0);
|
||||
if (dllink == null) {
|
||||
dllink = new Regex(correctedBR, "This (direct link|download link) will be available for your IP.*?href=\"(http.*?)\"").getMatch(1);
|
||||
if (dllink == null) {
|
||||
dllink = new Regex(correctedBR, "Download: <a href=\"(.*?)\"").getMatch(0);
|
||||
if (dllink == null) {
|
||||
dllink = new Regex(correctedBR, "file: \"(http://[^<>\"]*?)\"").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|<h1>404 Not Found</h1>)").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("<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")) {
|
||||
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("<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;
|
||||
}
|
||||
|
||||
@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<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.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<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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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\">[^<>\"]+<span id=\"[^<>\"]+\"( class=\"[^<>\"]+\")?>([\n ]+)?(\\d+)([\n ]+)?</span>").getMatch(2);
|
||||
if (ttt == null) ttt = new Regex(correctedBR, "\">Wait <span id=\"[a-z0-9]+\">(\\d+)</span>").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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user