mirror of
https://github.com/mirror/jdownloader.git
synced 2024-11-26 21:40:38 +00:00
Added: 180upload.com support - closes #4331
Improved: xfileshare, browser like behaviour git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@15990 ebf7c1c2-ba36-0410-9fe8-c592906822b4
This commit is contained in:
parent
0da7c880e2
commit
86131d8b7b
@ -1,5 +1,5 @@
|
||||
// jDownloader - Downloadmanager
|
||||
// Copyright (C) 2010 JD-Team support@jdownloader.org
|
||||
// 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
|
||||
|
@ -692,4 +692,5 @@ jd/plugins/decrypter/FlZnR.class
|
||||
jd/plugins/hoster/FileZoneRo.class
|
||||
jd/plugins/decrypter/FourMuCm.class
|
||||
jd/plugins/hoster/XSevenTo.class
|
||||
jd/plugins/decrypter/X7ToFldr.class
|
||||
jd/plugins/decrypter/X7ToFldr.class
|
||||
jd/plugins/decrypter/MkiOg.class
|
@ -1,101 +0,0 @@
|
||||
// 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.decrypter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import jd.PluginWrapper;
|
||||
import jd.controlling.ProgressController;
|
||||
import jd.http.RandomUserAgent;
|
||||
import jd.nutils.encoding.Encoding;
|
||||
import jd.parser.Regex;
|
||||
import jd.plugins.CryptedLink;
|
||||
import jd.plugins.DecrypterPlugin;
|
||||
import jd.plugins.DownloadLink;
|
||||
import jd.plugins.FilePackage;
|
||||
import jd.plugins.PluginForDecrypt;
|
||||
|
||||
@DecrypterPlugin(revision = "$Revision: 14836 $", interfaceVersion = 2, names = { "mukki.org" }, urls = { "http://(www\\.)?mukki\\.org/.+/.+\\-\\d+" }, flags = { 0 })
|
||||
public class MkiOg extends PluginForDecrypt {
|
||||
|
||||
public MkiOg(PluginWrapper wrapper) {
|
||||
super(wrapper);
|
||||
}
|
||||
|
||||
private final static String ua = RandomUserAgent.generate();
|
||||
|
||||
public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress) throws Exception {
|
||||
ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
|
||||
String parameter = param.toString().replace("://www.", "://");
|
||||
br.setCookie("http://mukki.org", "lang", "english");
|
||||
br.getHeaders().put("User-Agent", ua);
|
||||
br.getPage(parameter);
|
||||
// error clauses
|
||||
if (br.containsHTML("(?i)(>Not Found</h1>|>Apologies\\, but the page you requested could not be found\\.)")) {
|
||||
logger.warning("Invalid URL: " + parameter);
|
||||
return null;
|
||||
}
|
||||
// find a respectable package name
|
||||
String fp = Encoding.htmlDecode(br.getRegex("(?i)</a> \\»\\; ([^\"<>]+)").getMatch(0));
|
||||
if (fp == null) {
|
||||
fp = Encoding.htmlDecode(br.getRegex("(?i)\"></span>(.*?)</h1>").getMatch(0));
|
||||
}
|
||||
String fpName = null;
|
||||
if (fp != null)
|
||||
fpName = (fp + " - Mukki Site Links").trim();
|
||||
else
|
||||
fpName = "Mukki Site Links";
|
||||
FilePackage FP1 = FilePackage.getInstance();
|
||||
FP1.setName(fpName);
|
||||
// find and decode base64
|
||||
String SitePost = Encoding.Base64Decode(br.getRegex("(?i)\\(showmeass\\.decode\\(\"([a-zA-Z0-9\\+\\/]+[=]{0,2})\"\\)\\)").getMatch(0));
|
||||
String[] links = new Regex(SitePost, "(?i)href=\\'(.*?)\\'").getColumn(0);
|
||||
if (links == null || links.length == 0) links = new Regex(SitePost, "(?i)>(.*?)</a>").getColumn(0);
|
||||
if (links != null && links.length > 0) {
|
||||
for (String link : links) {
|
||||
DownloadLink thislink = this.createDownloadlink(link);
|
||||
FP1.add(thislink);
|
||||
decryptedLinks.add(thislink);
|
||||
}
|
||||
}
|
||||
// user comments
|
||||
if (fp != null)
|
||||
fpName = (fp + " - Mukki User Links").trim();
|
||||
else
|
||||
fpName = "Mukki User Links";
|
||||
FilePackage FP2 = FilePackage.getInstance();
|
||||
FP2.setName(fpName);
|
||||
String UserComments = br.getRegex("(?i)<div id=\"comments\">(.*?)</ol></div>").getMatch(0);
|
||||
String[] UserLinks = null;
|
||||
if (UserComments != null) {
|
||||
UserLinks = new Regex(UserComments, "(?i)>(https?://.*?)</a>").getColumn(0);
|
||||
if (UserLinks == null || UserLinks.length == 0) {
|
||||
UserLinks = new Regex(UserComments, "(?i)href=\"(.*?)\"").getColumn(0);
|
||||
}
|
||||
}
|
||||
if (UserLinks != null) {
|
||||
for (String link : UserLinks) {
|
||||
if (!link.contains("mukki.org")) {
|
||||
DownloadLink thislink = this.createDownloadlink(link);
|
||||
FP2.add(thislink);
|
||||
decryptedLinks.add(thislink);
|
||||
}
|
||||
}
|
||||
}
|
||||
return decryptedLinks;
|
||||
}
|
||||
}
|
456
src/jd/plugins/hoster/OneEightZeroUploadCom.java
Normal file
456
src/jd/plugins/hoster/OneEightZeroUploadCom.java
Normal file
@ -0,0 +1,456 @@
|
||||
// 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.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import jd.PluginWrapper;
|
||||
import jd.config.Property;
|
||||
import jd.http.Browser;
|
||||
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.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;
|
||||
|
||||
@HostPlugin(revision = "$Revision: 15976 $", interfaceVersion = 2, names = { "180upload.com" }, urls = { "http://(www\\.)?180upload\\.com/[a-z0-9]{12}" }, flags = { 0 })
|
||||
public class OneEightZeroUploadCom 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://180upload.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";
|
||||
|
||||
// DEV NOTES
|
||||
// XfileSharingProBasic Version 2.5.2.2
|
||||
// mods: filename, filesize, dllink
|
||||
// free: 20chunk, max dl tested 5
|
||||
// protocol: no https
|
||||
// captchatype: nill
|
||||
|
||||
@Override
|
||||
public String getAGBLink() {
|
||||
return COOKIE_HOST + "/tos.html";
|
||||
}
|
||||
|
||||
public OneEightZeroUploadCom(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 IOException, PluginException {
|
||||
this.setBrowserExclusive();
|
||||
br.setFollowRedirects(false);
|
||||
br.setCookie(COOKIE_HOST, "lang", "english");
|
||||
br.getPage(link.getDownloadURL());
|
||||
doSomething();
|
||||
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\\.)?" + COOKIE_HOST.replaceAll("https?://", "") + "/[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, "<b>Filename:</b></td><td nowrap>([^<>]+)").getMatch(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
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, "(?i)([\\d\\.]+ ?(GB|MB))").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.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, 0, true);
|
||||
}
|
||||
|
||||
public void doFree(DownloadLink downloadLink, boolean resumable, int maxchunks, boolean getLinkWithoutLogin) 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 = null;
|
||||
if (getLinkWithoutLogin)
|
||||
dllink = downloadLink.getStringProperty("freelink");
|
||||
else
|
||||
dllink = downloadLink.getStringProperty("freelink2");
|
||||
if (dllink != null) {
|
||||
try {
|
||||
Browser br2 = br.cloneBrowser();
|
||||
URLConnectionAdapter con = br2.openGetConnection(dllink);
|
||||
if (con.getContentType().contains("html") || con.getLongContentLength() == -1) {
|
||||
if (getLinkWithoutLogin)
|
||||
downloadLink.setProperty("freelink", Property.NULL);
|
||||
else
|
||||
downloadLink.setProperty("freelink2", Property.NULL);
|
||||
dllink = null;
|
||||
}
|
||||
con.disconnect();
|
||||
} catch (Exception e) {
|
||||
if (getLinkWithoutLogin)
|
||||
downloadLink.setProperty("freelink", Property.NULL);
|
||||
else
|
||||
downloadLink.setProperty("freelink2", Property.NULL);
|
||||
dllink = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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\"")) {
|
||||
br.postPage(downloadLink.getDownloadURL(), "op=download1&usr_login=&id=" + new Regex(downloadLink.getDownloadURL(), COOKIE_HOST.replaceAll("https?://", "") + "/" + "([A-Za-z0-9]{12})").getMatch(0) + "&fname=" + Encoding.urlEncode(downloadLink.getName()) + "&referer=&method_free=Free+Download");
|
||||
doSomething();
|
||||
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 = this.br.getRegex("\\?k=([A-Za-z0-9%_\\+\\- ]+)\"").getMatch(0);
|
||||
rc.setId(id);
|
||||
rc.load();
|
||||
File cf = rc.downloadCaptcha(getLocalCaptchaFile());
|
||||
String c = getCaptchaCode(cf, downloadLink);
|
||||
rc.prepareForm(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);
|
||||
br.submitForm(dlForm);
|
||||
logger.info("Submitted DLForm");
|
||||
doSomething();
|
||||
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();
|
||||
doSomething();
|
||||
checkServerErrors();
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
|
||||
}
|
||||
if (getLinkWithoutLogin)
|
||||
downloadLink.setProperty("freelink", dllink);
|
||||
else
|
||||
downloadLink.setProperty("freelink2", dllink);
|
||||
if (passCode != null) downloadLink.setProperty("pass", passCode);
|
||||
dl.startDownload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxSimultanFreeDownloadNum() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
/** This removes fake messages which can kill the plugin */
|
||||
public void doSomething() 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) {
|
||||
// within the html comment
|
||||
dllink = new Regex(br, "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, "<a href=\"([^<>\"]+)\"><img src=\"(https?://[\\w\\.]+)?/images/downloadbutton.png\"/></a>").getMatch(0);
|
||||
if (dllink == null) {
|
||||
dllink = new Regex(correctedBR, "<a href=\"([^<>\"]+)\">[\\w\"\\= \\;<>]+Download").getMatch(0);
|
||||
if (dllink == null) {
|
||||
String cryptedScripts[] = br.getRegex("p\\}\\((.*?)\\.split\\('\\|'\\)").getColumn(0);
|
||||
if (cryptedScripts != null && cryptedScripts.length != 0) {
|
||||
for (String crypted : cryptedScripts) {
|
||||
dllink = decodeDownloadLink(crypted);
|
||||
if (dllink != null) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return dllink;
|
||||
}
|
||||
|
||||
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()) {
|
||||
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;
|
||||
}
|
||||
|
||||
public 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);
|
||||
}
|
||||
|
||||
@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 */
|
||||
final String ttt = new Regex(correctedBR, "id=\"countdown_str\">[^<>\"]+<span id=\"[^<>\"]+\"( class=\"[^<>\"]+\")?>([\n ]+)?(\\d+)([\n ]+)?</span>").getMatch(2);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -61,7 +61,7 @@ public class XFileSharingProBasic extends PluginForHost {
|
||||
private static final String ALLWAIT_SHORT = "Waiting till new downloads can be started";
|
||||
private static final Object LOCK = new Object();
|
||||
|
||||
// XfileSharingProBasic Version 2.5.2.2
|
||||
// XfileSharingProBasic Version 2.5.2.3
|
||||
/**
|
||||
* This is only for developers to easily implement hosters using the
|
||||
* "xfileshare(pro)" script (more informations can be found on
|
||||
@ -181,6 +181,7 @@ public class XFileSharingProBasic extends PluginForHost {
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user