mirror of
https://github.com/mirror/jdownloader.git
synced 2024-11-26 21:40:38 +00:00
*Plugins: Fixes/Changes/Maintenance*
- DdebridCom: minor changes: ooks like domain has changed and old API is no longer in use? - LinkifierCom: minor changes - MegaDebridEu: minor changes - other multihoster plugin changes: refactoring to make use of MultiHostHost git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@49866 ebf7c1c2-ba36-0410-9fe8-c592906822b4 Former-commit-id: 6cb4d89a50294714a2fd015f768071fde29fd747
This commit is contained in:
parent
eec0b253b6
commit
c98f91b6a0
@ -26,33 +26,6 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import jd.PluginWrapper;
|
||||
import jd.controlling.AccountController;
|
||||
import jd.controlling.linkcrawler.CheckableLink;
|
||||
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.Form.MethodType;
|
||||
import jd.plugins.Account;
|
||||
import jd.plugins.Account.AccountType;
|
||||
import jd.plugins.AccountInfo;
|
||||
import jd.plugins.AccountInvalidException;
|
||||
import jd.plugins.AccountRequiredException;
|
||||
import jd.plugins.AccountUnavailableException;
|
||||
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 jd.plugins.PluginProgress;
|
||||
import jd.plugins.components.MultiHosterManagement;
|
||||
import jd.plugins.download.DownloadInterface;
|
||||
import jd.plugins.download.DownloadLinkDownloadable;
|
||||
import jd.plugins.download.HashInfo;
|
||||
|
||||
import org.appwork.net.protocol.http.HTTPConstants;
|
||||
import org.appwork.storage.JSonMapperException;
|
||||
import org.appwork.storage.TypeRef;
|
||||
@ -76,6 +49,35 @@ import org.jdownloader.plugins.config.PluginJsonConfig;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
import org.jdownloader.scripting.JavaScriptEngineFactory;
|
||||
|
||||
import jd.PluginWrapper;
|
||||
import jd.controlling.AccountController;
|
||||
import jd.controlling.linkcrawler.CheckableLink;
|
||||
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.Form.MethodType;
|
||||
import jd.plugins.Account;
|
||||
import jd.plugins.Account.AccountType;
|
||||
import jd.plugins.AccountInfo;
|
||||
import jd.plugins.AccountInvalidException;
|
||||
import jd.plugins.AccountRequiredException;
|
||||
import jd.plugins.AccountUnavailableException;
|
||||
import jd.plugins.DownloadLink;
|
||||
import jd.plugins.DownloadLink.AvailableStatus;
|
||||
import jd.plugins.HostPlugin;
|
||||
import jd.plugins.LinkStatus;
|
||||
import jd.plugins.MultiHostHost;
|
||||
import jd.plugins.MultiHostHost.MultihosterHostStatus;
|
||||
import jd.plugins.PluginException;
|
||||
import jd.plugins.PluginForHost;
|
||||
import jd.plugins.PluginProgress;
|
||||
import jd.plugins.components.MultiHosterManagement;
|
||||
import jd.plugins.download.DownloadInterface;
|
||||
import jd.plugins.download.DownloadLinkDownloadable;
|
||||
import jd.plugins.download.HashInfo;
|
||||
|
||||
@HostPlugin(revision = "$Revision$", interfaceVersion = 3, names = { "alldebrid.com" }, urls = { "https?://alldebrid\\.com/f/([A-Za-z0-9\\-_]+)" })
|
||||
public class AllDebridCom extends PluginForHost {
|
||||
public AllDebridCom(PluginWrapper wrapper) {
|
||||
@ -277,18 +279,17 @@ public class AllDebridCom extends PluginForHost {
|
||||
final Map<String, Object> entries = restoreFromString(br.getRequest().getHtmlCode(), TypeRef.MAP);
|
||||
final Map<String, Object> supportedHostsInfo = (Map<String, Object>) JavaScriptEngineFactory.walkJson(entries, "data/hosts");
|
||||
final Iterator<Entry<String, Object>> iterator = supportedHostsInfo.entrySet().iterator();
|
||||
final ArrayList<String> supportedHosts = new ArrayList<String>();
|
||||
final List<MultiHostHost> supportedHosts = new ArrayList<MultiHostHost>();
|
||||
while (iterator.hasNext()) {
|
||||
final Entry<String, Object> entry = iterator.next();
|
||||
final String hosterKey = entry.getKey();
|
||||
// final String hosterKey = entry.getKey();
|
||||
final Map<String, Object> hosterinfos = (Map<String, Object>) entry.getValue();
|
||||
String host_without_tld = (String) hosterinfos.get("name");
|
||||
final String host_without_tld = hosterinfos.get("name").toString();
|
||||
final Number quota = (Number) hosterinfos.get("quota");
|
||||
final String quotaType = (String) hosterinfos.get("quotaType");
|
||||
if (StringUtils.isEmpty(host_without_tld)) {
|
||||
host_without_tld = hosterKey;
|
||||
}
|
||||
final List<String> domains = (List<String>) hosterinfos.get("domains");
|
||||
final MultiHostHost mhost = new MultiHostHost();
|
||||
mhost.setName(host_without_tld);
|
||||
mhost.setDomains((List<String>) hosterinfos.get("domains"));
|
||||
/*
|
||||
* 2020-04-01: This check will most likely never be required as free accounts officially cannot be used via API at all and JD
|
||||
* also does not accept them but we're doing this check nevertheless.
|
||||
@ -297,37 +298,29 @@ public class AllDebridCom extends PluginForHost {
|
||||
final Boolean status = (Boolean) hosterinfos.get("status"); // optional field
|
||||
// final Number quota = (Number) entry.get("quota");
|
||||
if (account.getType() == AccountType.FREE && !"free".equalsIgnoreCase(type)) {
|
||||
logger.info("Skipping host because it cannot be used with free accounts: " + host_without_tld);
|
||||
continue;
|
||||
} else if (quota != null && quota.longValue() <= 0) {
|
||||
logger.info("Skipping host because there is no quota left: " + host_without_tld);
|
||||
continue;
|
||||
} else if (domains.isEmpty()) {
|
||||
/* This should never happen */
|
||||
logger.info("Skipping entry with empty domains field: " + host_without_tld);
|
||||
continue;
|
||||
mhost.setStatus(MultihosterHostStatus.DEACTIVATED_MULTIHOST_NOT_FOR_THIS_ACCOUNT_TYPE);
|
||||
logger.info("This host cannot be used with free accounts: " + host_without_tld);
|
||||
}
|
||||
/* Skip currently disabled hosts --> 2020-03-26: Do not skip any hosts anymore, display all in JD RE: admin */
|
||||
if (Boolean.FALSE.equals(status)) {
|
||||
/* Log hosts which look to be non working according to API. */
|
||||
logger.info("Host which might currently be broken: " + host_without_tld);
|
||||
/* 2024-09-03: Do not ignore/skip such entries */
|
||||
// continue;
|
||||
mhost.setStatus(MultihosterHostStatus.DEACTIVATED_MULTIHOST);
|
||||
}
|
||||
/* Add all domains of host */
|
||||
// TODO: Make use of this quota information
|
||||
if (StringUtils.equalsIgnoreCase(quotaType, "traffic")) {
|
||||
// quota is traffic in MB
|
||||
mhost.setTrafficLeft(quota.longValue() * 1024 * 1024);
|
||||
} else if (StringUtils.equalsIgnoreCase(quotaType, "nb_download")) {
|
||||
// quota is number of links left to download
|
||||
mhost.setLinksLeft(quota.intValue());
|
||||
} else {
|
||||
// No limit
|
||||
}
|
||||
for (final String domain : domains) {
|
||||
supportedHosts.add(domain);
|
||||
}
|
||||
supportedHosts.add(mhost);
|
||||
}
|
||||
accountInfo.setMultiHostSupport(this, supportedHosts);
|
||||
accountInfo.setMultiHostSupportV2(this, supportedHosts);
|
||||
return accountInfo;
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,8 @@ import jd.plugins.DownloadLink;
|
||||
import jd.plugins.DownloadLink.AvailableStatus;
|
||||
import jd.plugins.HostPlugin;
|
||||
import jd.plugins.LinkStatus;
|
||||
import jd.plugins.MultiHostHost;
|
||||
import jd.plugins.MultiHostHost.MultihosterHostStatus;
|
||||
import jd.plugins.PluginException;
|
||||
import jd.plugins.PluginForHost;
|
||||
import jd.plugins.components.MultiHosterManagement;
|
||||
@ -210,12 +212,12 @@ public class BoxbitApp extends PluginForHost {
|
||||
|
||||
@Override
|
||||
public AccountInfo fetchAccountInfo(final Account account) throws Exception {
|
||||
final AccountInfo ai = new AccountInfo();
|
||||
Map<String, Object> user = loginAPI(account, true);
|
||||
/* Access userInfo if it hasn't been accessed already. */
|
||||
if (br.getURL() == null || !br.getURL().contains("/users/")) {
|
||||
user = accessUserInfo(this.br, account);
|
||||
}
|
||||
final AccountInfo ai = new AccountInfo();
|
||||
final Map<String, Object> subscription = (Map<String, Object>) user.get("subscription");
|
||||
List<Map<String, Object>> hosts = null;
|
||||
final Object currentSubscriptionO = subscription.get("current");
|
||||
@ -243,7 +245,7 @@ public class BoxbitApp extends PluginForHost {
|
||||
status += " | TokenValidity: " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.getLoginTokenValidity(account));
|
||||
ai.setStatus(status);
|
||||
}
|
||||
final ArrayList<String> supportedhostslist = new ArrayList<String>();
|
||||
final ArrayList<MultiHostHost> supportedhostslist = new ArrayList<MultiHostHost>();
|
||||
/* Can be null for free accounts! */
|
||||
if (hosts != null) {
|
||||
br.getPage(API_BASE + "/filehosts/domains");
|
||||
@ -252,17 +254,17 @@ public class BoxbitApp extends PluginForHost {
|
||||
for (final Map<String, Object> hostInfo : hosts) {
|
||||
final Map<String, Object> hostDetails = (Map<String, Object>) hostInfo.get("details");
|
||||
final String hostIdentifier = (String) hostDetails.get("identifier");
|
||||
final MultiHostHost mhost = new MultiHostHost();
|
||||
if (hostDetails.get("status").toString().equalsIgnoreCase("working")) {
|
||||
final List<String> fullDomains = (List<String>) hostMapping.get(hostIdentifier);
|
||||
for (final String fullDomain : fullDomains) {
|
||||
supportedhostslist.add(fullDomain);
|
||||
}
|
||||
mhost.setStatus(MultihosterHostStatus.WORKING);
|
||||
} else {
|
||||
logger.info("Skipping non working host: " + hostIdentifier);
|
||||
mhost.setStatus(MultihosterHostStatus.DEACTIVATED_MULTIHOST);
|
||||
}
|
||||
final List<String> fullDomains = (List<String>) hostMapping.get(hostIdentifier);
|
||||
mhost.setDomains(fullDomains);
|
||||
}
|
||||
}
|
||||
ai.setMultiHostSupport(this, supportedhostslist);
|
||||
ai.setMultiHostSupportV2(this, supportedhostslist);
|
||||
account.setConcurrentUsePossible(true);
|
||||
return ai;
|
||||
}
|
||||
|
@ -39,6 +39,8 @@ import jd.plugins.DownloadLink;
|
||||
import jd.plugins.DownloadLink.AvailableStatus;
|
||||
import jd.plugins.HostPlugin;
|
||||
import jd.plugins.LinkStatus;
|
||||
import jd.plugins.MultiHostHost;
|
||||
import jd.plugins.MultiHostHost.MultihosterHostStatus;
|
||||
import jd.plugins.PluginException;
|
||||
import jd.plugins.PluginForHost;
|
||||
import jd.plugins.components.MultiHosterManagement;
|
||||
@ -214,7 +216,7 @@ public class CocoleechCom extends PluginForHost {
|
||||
}
|
||||
br.getPage(API_ENDPOINT + "/hosts-status");
|
||||
final Map<String, Object> hoststatusmap = handleAPIErrors(br, account, null);
|
||||
final ArrayList<String> supportedhostslist = new ArrayList();
|
||||
final List<MultiHostHost> supportedhostslist = new ArrayList<MultiHostHost>();
|
||||
final List<Map<String, Object>> hosters = (List<Map<String, Object>>) hoststatusmap.get("result");
|
||||
for (final Map<String, Object> hostinfo : hosters) {
|
||||
final String host = (String) hostinfo.get("host");
|
||||
@ -223,13 +225,13 @@ public class CocoleechCom extends PluginForHost {
|
||||
/* Skip invalid items */
|
||||
continue;
|
||||
}
|
||||
if ("online".equalsIgnoreCase(status)) {
|
||||
supportedhostslist.add(host);
|
||||
} else {
|
||||
logger.info("Not adding currently serverside deactivated host: " + host);
|
||||
final MultiHostHost mhost = new MultiHostHost(host);
|
||||
if (!"online".equalsIgnoreCase(status)) {
|
||||
mhost.setStatus(MultihosterHostStatus.DEACTIVATED_MULTIHOST);
|
||||
}
|
||||
supportedhostslist.add(mhost);
|
||||
}
|
||||
ai.setMultiHostSupport(this, supportedhostslist);
|
||||
ai.setMultiHostSupportV2(this, supportedhostslist);
|
||||
return ai;
|
||||
}
|
||||
|
||||
|
@ -17,9 +17,16 @@ package jd.plugins.hoster;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.appwork.storage.TypeRef;
|
||||
import org.appwork.utils.Regex;
|
||||
import org.appwork.utils.StringUtils;
|
||||
import org.appwork.utils.formatter.SizeFormatter;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
|
||||
import jd.PluginWrapper;
|
||||
import jd.http.Browser;
|
||||
import jd.http.Cookies;
|
||||
@ -35,17 +42,12 @@ import jd.plugins.DownloadLink;
|
||||
import jd.plugins.DownloadLink.AvailableStatus;
|
||||
import jd.plugins.HostPlugin;
|
||||
import jd.plugins.LinkStatus;
|
||||
import jd.plugins.MultiHostHost;
|
||||
import jd.plugins.MultiHostHost.MultihosterHostStatus;
|
||||
import jd.plugins.PluginException;
|
||||
import jd.plugins.PluginForHost;
|
||||
import jd.plugins.components.MultiHosterManagement;
|
||||
|
||||
import org.appwork.storage.JSonStorage;
|
||||
import org.appwork.storage.TypeRef;
|
||||
import org.appwork.utils.Regex;
|
||||
import org.appwork.utils.StringUtils;
|
||||
import org.appwork.utils.formatter.SizeFormatter;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
|
||||
@HostPlugin(revision = "$Revision$", interfaceVersion = 3, names = { "cooldebrid.com" }, urls = { "" })
|
||||
public class CooldebridCom extends PluginForHost {
|
||||
private static final String WEBSITE_BASE = "https://cooldebrid.com";
|
||||
@ -215,8 +217,11 @@ public class CooldebridCom extends PluginForHost {
|
||||
ai.setExpired(true);
|
||||
}
|
||||
// br.getPage("/host-status.html");
|
||||
final ArrayList<String> supportedHosts = new ArrayList<String>();
|
||||
final List<MultiHostHost> supportedHosts = new ArrayList<MultiHostHost>();
|
||||
final String[] htmls = br.getRegex("<tr>(.*?)</tr>").getColumn(0);
|
||||
if (htmls == null || htmls.length == 0) {
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT, "Failed to find list of supported hosts");
|
||||
}
|
||||
for (final String html : htmls) {
|
||||
final String domain = new Regex(html, "favicons\\?domain=([^\"]+)").getMatch(0);
|
||||
if (domain == null) {
|
||||
@ -230,10 +235,17 @@ public class CooldebridCom extends PluginForHost {
|
||||
}
|
||||
/* Skip hosts that are marked as broken/offline by this multihost */
|
||||
final String hostStatusColumn = columns[2].toLowerCase(Locale.ENGLISH);
|
||||
final boolean isHostAvailable = hostStatusColumn.contains("online") || hostStatusColumn.contains("unstable");
|
||||
if (!isHostAvailable) {
|
||||
logger.info("Skipping currently unsupported host: " + domain);
|
||||
continue;
|
||||
final MultiHostHost mhost = new MultiHostHost(domain);
|
||||
if (StringUtils.containsIgnoreCase(html, "Only Premium") && account.getType() != AccountType.PREMIUM) {
|
||||
mhost.setStatus(MultihosterHostStatus.DEACTIVATED_MULTIHOST_NOT_FOR_THIS_ACCOUNT_TYPE);
|
||||
} else {
|
||||
if (hostStatusColumn.contains("online")) {
|
||||
mhost.setStatus(MultihosterHostStatus.WORKING);
|
||||
} else if (hostStatusColumn.contains("unstable")) {
|
||||
mhost.setStatus(MultihosterHostStatus.WORKING_UNSTABLE);
|
||||
} else {
|
||||
mhost.setStatus(MultihosterHostStatus.DEACTIVATED_MULTIHOST);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Skip hosts if individual limits have been reached. Some have "unlimited" links or bandwidth -> Limit-RegEx will fail for them
|
||||
@ -241,28 +253,24 @@ public class CooldebridCom extends PluginForHost {
|
||||
*/
|
||||
final String hostLimitsHTML = columns[1];
|
||||
final Regex maxLinkLimitRegex = new Regex(hostLimitsHTML, "used_count=\"[^\"]+\">(\\d+)</span>\\s*/\\s*(\\d+)\\s*link\\s*</p>");
|
||||
if (maxLinkLimitRegex.matches()) {
|
||||
if (maxLinkLimitRegex.patternFind()) {
|
||||
final int linksUsed = Integer.parseInt(maxLinkLimitRegex.getMatch(0));
|
||||
final int linksMax = Integer.parseInt(maxLinkLimitRegex.getMatch(1));
|
||||
final int linksLeft = linksMax - linksUsed;
|
||||
if (linksLeft <= 0) {
|
||||
logger.info("Skipping host because user reached individual max links limit for it: " + domain + " | " + linksUsed + "/" + linksMax);
|
||||
continue;
|
||||
}
|
||||
mhost.setLinksLeft(linksLeft);
|
||||
mhost.setLinksMax(linksMax);
|
||||
}
|
||||
final Regex maxQuotaRegex = new Regex(hostLimitsHTML, "used_mb=\"[^\"]+\">(\\d+(?:\\.\\d{1,2})? [A-Za-z]{1,5})</span>\\s*/\\s*(\\d+(?:\\.\\d{1,2})? [A-Za-z]{1,5})\\s*<br>");
|
||||
if (maxQuotaRegex.matches()) {
|
||||
if (maxQuotaRegex.patternFind()) {
|
||||
final long trafficUsed = SizeFormatter.getSize(maxQuotaRegex.getMatch(0));
|
||||
final long trafficMax = SizeFormatter.getSize(maxQuotaRegex.getMatch(1));
|
||||
final long trafficLeft = trafficMax - trafficUsed;
|
||||
if (trafficLeft <= 0) {
|
||||
logger.info("Skipping host because user reached individual traffic limit for it: " + domain + " | " + maxQuotaRegex.getMatch(0) + "/" + maxQuotaRegex.getMatch(1));
|
||||
continue;
|
||||
}
|
||||
mhost.setTrafficLeft(trafficLeft);
|
||||
mhost.setTrafficMax(trafficMax);
|
||||
}
|
||||
supportedHosts.add(domain);
|
||||
supportedHosts.add(mhost);
|
||||
}
|
||||
ai.setMultiHostSupport(this, supportedHosts);
|
||||
ai.setMultiHostSupportV2(this, supportedHosts);
|
||||
account.setConcurrentUsePossible(true);
|
||||
return ai;
|
||||
}
|
||||
|
@ -16,7 +16,6 @@
|
||||
package jd.plugins.hoster;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
@ -521,11 +520,10 @@ public class DailyleechCom extends PluginForHost {
|
||||
}
|
||||
br.getPage("/hostsp/");
|
||||
final String[] hostlist = br.getRegex("domain=([^<>\"\\'/]+)\"").getColumn(0);
|
||||
final ArrayList<String> supportedHosts = new ArrayList<String>();
|
||||
if (hostlist != null) {
|
||||
supportedHosts.addAll(Arrays.asList(hostlist));
|
||||
if (hostlist == null || hostlist.length == 0) {
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT, "Failed to find list of supported hosts");
|
||||
}
|
||||
ai.setMultiHostSupport(this, supportedHosts);
|
||||
ai.setMultiHostSupport(this, Arrays.asList(hostlist));
|
||||
return ai;
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,12 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.appwork.storage.TypeRef;
|
||||
import org.appwork.utils.StringUtils;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
import org.jdownloader.plugins.controller.host.PluginFinder;
|
||||
import org.jdownloader.scripting.JavaScriptEngineFactory;
|
||||
|
||||
import jd.PluginWrapper;
|
||||
import jd.http.Browser;
|
||||
import jd.http.URLConnectionAdapter;
|
||||
@ -37,13 +43,6 @@ import jd.plugins.PluginForHost;
|
||||
import jd.plugins.components.MultiHosterManagement;
|
||||
import jd.plugins.components.PluginJSonUtils;
|
||||
|
||||
import org.appwork.storage.JSonStorage;
|
||||
import org.appwork.storage.TypeRef;
|
||||
import org.appwork.utils.StringUtils;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
import org.jdownloader.plugins.controller.host.PluginFinder;
|
||||
import org.jdownloader.scripting.JavaScriptEngineFactory;
|
||||
|
||||
@HostPlugin(revision = "$Revision$", interfaceVersion = 3, names = { "ddebrid.com" }, urls = { "" })
|
||||
public class DdebridCom extends PluginForHost {
|
||||
private static final String API_BASE = "https://ddebrid.com/api";
|
||||
@ -57,12 +56,12 @@ public class DdebridCom extends PluginForHost {
|
||||
@SuppressWarnings("deprecation")
|
||||
public DdebridCom(PluginWrapper wrapper) {
|
||||
super(wrapper);
|
||||
this.enablePremium("https://ddebrid.com/premium");
|
||||
this.enablePremium("https://" + getHost() + "/premium");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAGBLink() {
|
||||
return "https://ddebrid.com/support";
|
||||
return "https://" + getHost() + "/support";
|
||||
}
|
||||
|
||||
private Browser prepBR(final Browser br) {
|
||||
|
@ -19,6 +19,13 @@ import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import org.appwork.storage.TypeRef;
|
||||
import org.appwork.utils.Regex;
|
||||
import org.appwork.utils.StringUtils;
|
||||
import org.appwork.utils.formatter.SizeFormatter;
|
||||
import org.jdownloader.captcha.v2.challenge.recaptcha.v2.CaptchaHelperHostPluginRecaptchaV2;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
|
||||
import jd.PluginWrapper;
|
||||
import jd.http.Browser;
|
||||
import jd.http.Cookies;
|
||||
@ -35,14 +42,6 @@ import jd.plugins.PluginException;
|
||||
import jd.plugins.PluginForHost;
|
||||
import jd.plugins.components.MultiHosterManagement;
|
||||
|
||||
import org.appwork.storage.JSonStorage;
|
||||
import org.appwork.storage.TypeRef;
|
||||
import org.appwork.utils.Regex;
|
||||
import org.appwork.utils.StringUtils;
|
||||
import org.appwork.utils.formatter.SizeFormatter;
|
||||
import org.jdownloader.captcha.v2.challenge.recaptcha.v2.CaptchaHelperHostPluginRecaptchaV2;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
|
||||
@HostPlugin(revision = "$Revision$", interfaceVersion = 3, names = { "debrid-file.com" }, urls = { "" })
|
||||
public class DebridFileCom extends PluginForHost {
|
||||
/* This is a "updated" version of website tout-debrid.ch */
|
||||
@ -197,6 +196,9 @@ public class DebridFileCom extends PluginForHost {
|
||||
* Get list of supported hosts.
|
||||
*/
|
||||
final String[] hosts = br.getRegex("/hostlar/([^<>\"]+)\\.png\"").getColumn(0);
|
||||
if (hosts == null || hosts.length == 0) {
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT, "Failed to find list of supported hosts");
|
||||
}
|
||||
ai.setMultiHostSupport(this, Arrays.asList(hosts));
|
||||
account.setConcurrentUsePossible(true);
|
||||
return ai;
|
||||
@ -276,7 +278,7 @@ public class DebridFileCom extends PluginForHost {
|
||||
/*
|
||||
* 2020-03-27: What does this mean? Is this supposed to be a temporary error? If so, you should use e.g. throw new
|
||||
* AccountUnavailableException("Error 403 'blocked by debrid-file'", 10 * 60 * 1000);
|
||||
*
|
||||
*
|
||||
* 2020-03-27 : phg : This a temporary fix as we are not supposed to have a 403 error and we must fix the 403. I let the
|
||||
* previous code as it is not a temporary account error but a fatal plugin error
|
||||
*/
|
||||
|
@ -21,6 +21,13 @@ import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.appwork.net.protocol.http.HTTPConstants;
|
||||
import org.appwork.utils.StringUtils;
|
||||
import org.appwork.utils.net.httpconnection.HTTPConnectionUtils.DispositionHeader;
|
||||
import org.appwork.utils.parser.UrlQuery;
|
||||
import org.jdownloader.plugins.components.antiDDoSForHost;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
|
||||
import jd.PluginWrapper;
|
||||
import jd.config.Property;
|
||||
import jd.http.Browser;
|
||||
@ -41,13 +48,6 @@ import jd.plugins.components.MultiHosterManagement;
|
||||
import jd.plugins.download.DownloadLinkDownloadable;
|
||||
import jd.plugins.download.Downloadable;
|
||||
|
||||
import org.appwork.net.protocol.http.HTTPConstants;
|
||||
import org.appwork.utils.StringUtils;
|
||||
import org.appwork.utils.net.httpconnection.HTTPConnectionUtils.DispositionHeader;
|
||||
import org.appwork.utils.parser.UrlQuery;
|
||||
import org.jdownloader.plugins.components.antiDDoSForHost;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
|
||||
@HostPlugin(revision = "$Revision$", interfaceVersion = 3, names = { "debriditalia.com" }, urls = { "https?://\\w+\\.debriditalia\\.com/dl/\\d+/.+" })
|
||||
public class DebridItaliaCom extends antiDDoSForHost {
|
||||
public DebridItaliaCom(PluginWrapper wrapper) {
|
||||
@ -103,7 +103,7 @@ public class DebridItaliaCom extends antiDDoSForHost {
|
||||
}
|
||||
ac.setValidUntil(Long.parseLong(expire) * 1000l, this.br);
|
||||
getPage(API_BASE + "?hosts");
|
||||
final String[] hosts = br.getRegex("\"([^<>\"]*?)\"").getColumn(0);
|
||||
final String[] hosts = br.getRegex("\"([^\"]*?)\"").getColumn(0);
|
||||
ac.setMultiHostSupport(this, new ArrayList<String>(Arrays.asList(hosts)));
|
||||
account.setType(AccountType.PREMIUM);
|
||||
return ac;
|
||||
@ -245,7 +245,6 @@ public class DebridItaliaCom extends antiDDoSForHost {
|
||||
@Override
|
||||
public Downloadable newDownloadable(DownloadLink downloadLink, final Browser br) {
|
||||
return new DownloadLinkDownloadable(downloadLink, br) {
|
||||
|
||||
@Override
|
||||
protected DispositionHeader parseDispositionHeader(URLConnectionAdapter connection) {
|
||||
final DispositionHeader ret = super.parseDispositionHeader(connection);
|
||||
|
@ -319,7 +319,7 @@ public class EsouboryCz extends PluginForHost {
|
||||
/*
|
||||
* E.g. {"error":"","data":{"list":"http:\/\/www.edisk.cz;https:\/\/datoid.cz;https:\/\/webshare.cz;https:\/\/www.shareprofi.com"}}
|
||||
*/
|
||||
entries = restoreFromString(br.toString(), TypeRef.MAP);
|
||||
entries = restoreFromString(br.getRequest().getHtmlCode(), TypeRef.MAP);
|
||||
data = (Map<String, Object>) entries.get("data");
|
||||
final String hostsStr = (String) data.get("list");
|
||||
final String[] hosts = hostsStr.split(";");
|
||||
|
@ -54,6 +54,8 @@ import jd.plugins.DownloadLink;
|
||||
import jd.plugins.DownloadLink.AvailableStatus;
|
||||
import jd.plugins.HostPlugin;
|
||||
import jd.plugins.LinkStatus;
|
||||
import jd.plugins.MultiHostHost;
|
||||
import jd.plugins.MultiHostHost.MultihosterHostStatus;
|
||||
import jd.plugins.PluginException;
|
||||
import jd.plugins.PluginForHost;
|
||||
import jd.plugins.components.MultiHosterManagement;
|
||||
@ -286,10 +288,9 @@ public class FakirdebridNet extends PluginForHost {
|
||||
ai.setTrafficLeft(((Number) entries.get("trafficleft")).longValue());
|
||||
ai.setTrafficMax(((Number) entries.get("trafficlimit")).longValue());
|
||||
ai.setValidUntil(JavaScriptEngineFactory.toLong(entries.get("premium_until"), 0) * 1000, br);
|
||||
final ArrayList<String> supportedHosts = new ArrayList<String>();
|
||||
br.getPage(API_BASE + "/supportedhosts.php?pin=" + Encoding.urlEncode(account.getPass()));
|
||||
entries = restoreFromString(br.getRequest().getHtmlCode(), TypeRef.MAP);
|
||||
final List<Object> arrayHoster;
|
||||
final List<Map<String, Object>> arrayHoster;
|
||||
final Object arrayHosterO = entries.get("supportedhosts");
|
||||
/* 2021-05-27: API can return Map instead of expected Array */
|
||||
if (arrayHosterO instanceof Map) {
|
||||
@ -297,28 +298,24 @@ public class FakirdebridNet extends PluginForHost {
|
||||
arrayHoster = new ArrayList(mapHoster.values());
|
||||
// mapHoster.values();
|
||||
} else {
|
||||
arrayHoster = (List<Object>) arrayHosterO;
|
||||
arrayHoster = (List<Map<String, Object>>) arrayHosterO;
|
||||
}
|
||||
for (final Object hoster : arrayHoster) {
|
||||
final Map<String, Object> hostermap = (Map<String, Object>) hoster;
|
||||
final String domain = (String) hostermap.get("host");
|
||||
final List<MultiHostHost> supportedHosts = new ArrayList<MultiHostHost>();
|
||||
for (final Map<String, Object> hostermap : arrayHoster) {
|
||||
final String domain = hostermap.get("host").toString();
|
||||
final boolean active = ((Boolean) hostermap.get("currently_working")).booleanValue();
|
||||
final MultiHostHost mhost = new MultiHostHost(domain);
|
||||
if (!active) {
|
||||
continue;
|
||||
mhost.setStatus(MultihosterHostStatus.DEACTIVATED_MULTIHOST);
|
||||
}
|
||||
/* Workaround to find the real domain which we need to assign the properties to later on! */
|
||||
final ArrayList<String> supportedHostsTmp = new ArrayList<String>();
|
||||
supportedHostsTmp.add(domain);
|
||||
ai.setMultiHostSupport(null, supportedHostsTmp);
|
||||
final List<String> realDomainList = ai.getMultiHostSupport();
|
||||
if (realDomainList == null || realDomainList.isEmpty()) {
|
||||
/* Skip unsupported hosts or host plugins which don't allow multihost usage. */
|
||||
continue;
|
||||
}
|
||||
final String realDomain = realDomainList.get(0);
|
||||
supportedHosts.add(realDomain);
|
||||
mhost.setResume(((Boolean) hostermap.get("resumable")).booleanValue());
|
||||
mhost.setMaxChunks(((Number) hostermap.get("maxChunks")).intValue());
|
||||
mhost.setMaxDownloads(((Number) hostermap.get("maxDownloads")).intValue());
|
||||
mhost.setTrafficMax(((Number) hostermap.get("traffixmax_daily")).longValue());
|
||||
mhost.setTrafficLeft(((Number) hostermap.get("trafficleft")).longValue());
|
||||
supportedHosts.add(mhost);
|
||||
}
|
||||
ai.setMultiHostSupport(this, supportedHosts);
|
||||
ai.setMultiHostSupportV2(this, supportedHosts);
|
||||
return ai;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ public class LinkifierCom extends PluginForHost {
|
||||
|
||||
public LinkifierCom(PluginWrapper wrapper) {
|
||||
super(wrapper);
|
||||
enablePremium("https://www.linkifier.com");
|
||||
enablePremium("https://www." + getHost());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -45,15 +45,12 @@ public class LinkifierCom extends PluginForHost {
|
||||
|
||||
@Override
|
||||
public String getAGBLink() {
|
||||
return "https://www.linkifier.com/terms-of-use/";
|
||||
return "https://www." + getHost() + "/terms-of-use/";
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountInfo fetchAccountInfo(Account account) throws Exception {
|
||||
final String username = account.getUser();
|
||||
if (username == null || !username.matches("^.+?@.+?\\.[^\\.]+")) {
|
||||
throw new PluginException(LinkStatus.ERROR_PREMIUM, "Please use your email address to login", PluginException.VALUE_ID_PREMIUM_DISABLE);
|
||||
}
|
||||
final AccountInfo ai = new AccountInfo();
|
||||
final HashMap<String, Object> userJson = new HashMap<String, Object>();
|
||||
userJson.put("login", username);
|
||||
|
@ -247,9 +247,10 @@ public class LinksvipNet extends PluginForHost {
|
||||
}
|
||||
br.getPage("/host-support.html");
|
||||
final String[] hostlist = br.getRegex("domain=([^<>\"]+)\"").getColumn(0);
|
||||
if (hostlist != null) {
|
||||
supportedHosts = new ArrayList<String>(Arrays.asList(hostlist));
|
||||
if (hostlist == null || hostlist.length == 0) {
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT, "Failed to find list of supported hosts");
|
||||
}
|
||||
supportedHosts = new ArrayList<String>(Arrays.asList(hostlist));
|
||||
ai.setUnlimitedTraffic();
|
||||
} else {
|
||||
account.setType(AccountType.FREE);
|
||||
|
@ -19,9 +19,9 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.appwork.storage.TypeRef;
|
||||
import org.appwork.utils.StringUtils;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
import org.jdownloader.scripting.JavaScriptEngineFactory;
|
||||
|
||||
import jd.PluginWrapper;
|
||||
import jd.http.Browser;
|
||||
@ -84,26 +84,24 @@ public class MegaDebridEu extends PluginForHost {
|
||||
}
|
||||
// now it's time to get all supported hosts
|
||||
br.getPage("/api.php?action=getHostersList");
|
||||
final Map<String, Object> results = JavaScriptEngineFactory.jsonToJavaMap(br.toString());
|
||||
final Map<String, Object> results = restoreFromString(br.getRequest().getHtmlCode(), TypeRef.MAP);
|
||||
if (!"ok".equalsIgnoreCase((String) results.get("response_code"))) {
|
||||
throw new AccountInvalidException();
|
||||
}
|
||||
final ArrayList<String> supportedHosts = new ArrayList<String>();
|
||||
for (final Object resultz : (List<Object>) results.get("hosters")) {
|
||||
final Map<String, Object> r = (Map<String, Object>) resultz;
|
||||
if (!"up".equals(r.get("status")) || r.get("domains") == null) {
|
||||
for (final Map<String, Object> hostinfo : (List<Map<String, Object>>) results.get("hosters")) {
|
||||
final List<String> domains = (List<String>) hostinfo.get("domains");
|
||||
if (!"up".equals(hostinfo.get("status")) || domains == null) {
|
||||
continue;
|
||||
}
|
||||
for (final String domain : (List<String>) r.get("domains")) {
|
||||
supportedHosts.add(domain);
|
||||
}
|
||||
supportedHosts.addAll(domains);
|
||||
}
|
||||
ac.setMultiHostSupport(this, supportedHosts);
|
||||
account.setType(AccountType.PREMIUM);
|
||||
return ac;
|
||||
}
|
||||
|
||||
private String login(Account account) throws Exception {
|
||||
private String login(final Account account) throws Exception {
|
||||
synchronized (account) {
|
||||
br.getPage(mProt + mName + "/api.php?action=connectUser&login=" + Encoding.urlEncode(account.getUser()) + "&password=" + Encoding.urlEncode(account.getPass()));
|
||||
if (br.getHttpConnection().getResponseCode() == 403 || br.getHttpConnection().getResponseCode() == 404) {
|
||||
@ -145,7 +143,7 @@ public class MegaDebridEu extends PluginForHost {
|
||||
}
|
||||
url = Encoding.urlEncode(url);
|
||||
prepBrowser(br);
|
||||
String token = account.getStringProperty("token", null);
|
||||
String token = account.getStringProperty("token");
|
||||
if (token == null) {
|
||||
// this shouldn't happen!
|
||||
token = login(account);
|
||||
@ -196,7 +194,7 @@ public class MegaDebridEu extends PluginForHost {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleFree(DownloadLink downloadLink) throws Exception, PluginException {
|
||||
public void handleFree(final DownloadLink link) throws Exception, PluginException {
|
||||
throw new PluginException(LinkStatus.ERROR_PREMIUM, PluginException.VALUE_ID_PREMIUM_ONLY);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user