From abef19f20689e0417bb6fa3a8c76c536615a5d5c Mon Sep 17 00:00:00 2001 From: psp Date: Wed, 19 Jul 2023 08:46:17 +0000 Subject: [PATCH] *Plugins: Fixes/Changes/Maintenance* - VivaTvDecrypt: fixed newly added domain RE forum 523285 - depositfilescom: reviewed my own refactoring changes - JulesjordanCom: added errorhandling for when user enters invalid login captcha *Plugins: RIP* - DecrypterForRedirectServicesWithoutDirectRedirects: songspk.info git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@48014 ebf7c1c2-ba36-0410-9fe8-c592906822b4 Former-commit-id: 0783726b7a4e0a73facc66a14b11d1716d4a217b --- ...edirectServicesWithoutDirectRedirects.java | 10 ++----- src/jd/plugins/decrypter/VivaTvDecrypt.java | 2 +- src/jd/plugins/hoster/DepositFiles.java | 29 ++++++++++++------- src/jd/plugins/hoster/JulesjordanCom.java | 5 +++- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/jd/plugins/decrypter/DecrypterForRedirectServicesWithoutDirectRedirects.java b/src/jd/plugins/decrypter/DecrypterForRedirectServicesWithoutDirectRedirects.java index 6db05e899c..02306cbf06 100644 --- a/src/jd/plugins/decrypter/DecrypterForRedirectServicesWithoutDirectRedirects.java +++ b/src/jd/plugins/decrypter/DecrypterForRedirectServicesWithoutDirectRedirects.java @@ -32,13 +32,10 @@ import jd.plugins.DecrypterPlugin; import jd.plugins.DownloadLink; import jd.plugins.components.SiteType.SiteTemplate; -@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 3, names = { "adfoc.us", "songspk.info", "academicearth.org", "tm-exchange.com", "mafia.to" }, urls = { "http://(www\\.)?adfoc\\.us/(serve/\\?id=[a-z0-9]+|(?!serve|privacy|terms)[a-z0-9]+)", "http://[\\w\\.]*?(link\\.songs\\.pk/(popsong|song1|bhangra)\\.php\\?songid=|songspk\\.info/ghazals/download/ghazals\\.php\\?id=|link\\.songspk\\.help/\\S+/download\\.php\\?id=)[0-9]+", "http://[\\w\\.]*?academicearth\\.org/lectures/.{2,}", "http://[\\w\\.]*?tm-exchange\\.com/(get\\.aspx\\?action=trackgbx|\\?action=trackshow)\\&id=\\d+", "http://[\\w\\.]*?mafia\\.to/download-[a-z0-9]+\\.cfm" }) +@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 3, names = { "adfoc.us", "academicearth.org", "tm-exchange.com", "mafia.to" }, urls = { "http://(www\\.)?adfoc\\.us/(serve/\\?id=[a-z0-9]+|(?!serve|privacy|terms)[a-z0-9]+)", "http://[\\w\\.]*?academicearth\\.org/lectures/.{2,}", "http://[\\w\\.]*?tm-exchange\\.com/(get\\.aspx\\?action=trackgbx|\\?action=trackshow)\\&id=\\d+", "http://[\\w\\.]*?mafia\\.to/download-[a-z0-9]+\\.cfm" }) public class DecrypterForRedirectServicesWithoutDirectRedirects extends antiDDoSForDecrypt { @Override public String[] siteSupportedNames() { - if ("songspk.info".equals(this.getHost())) { - return new String[] { "link.songspk.help", "songspk.info" }; - } return super.siteSupportedNames(); } @@ -66,10 +63,7 @@ public class DecrypterForRedirectServicesWithoutDirectRedirects extends antiDDoS if (!new Regex(parameter, "tm-exchange\\.com/|is\\.gd/").matches()) { getPage(parameter); } - if (parameter.contains("link.songs.pk/") || parameter.contains("songspk.info/ghazals/download/ghazals.php?id=") || parameter.contains("link.songspk.help/")) { - finallink = br.getRedirectLocation(); - dh = true; - } else if (parameter.contains("academicearth.org/")) { + if (parameter.contains("academicearth.org/")) { if (!(br.getRedirectLocation() != null && br.getRedirectLocation().contains("users/login"))) { if (br.containsHTML(">Looks like the Internet may require a little disciplinary action")) { offline = true; diff --git a/src/jd/plugins/decrypter/VivaTvDecrypt.java b/src/jd/plugins/decrypter/VivaTvDecrypt.java index be5803fe6c..b9c6561533 100644 --- a/src/jd/plugins/decrypter/VivaTvDecrypt.java +++ b/src/jd/plugins/decrypter/VivaTvDecrypt.java @@ -47,7 +47,7 @@ import jd.plugins.hoster.GenericM3u8; import jd.plugins.hoster.VivaTv; import jd.utils.JDUtilities; -@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 3, names = { "mtv.de", "mtviggy.com", "southpark.de", "southpark.cc.com", "southparkstudios.cm", "mtv.com.au", "mtv.co.uk", "mtv.com", "cc.com", "funnyclips.cc", "comedycentral.tv", "nick.de", "tvland.com", "spike.com", "thedailyshow.cc.com", "tosh.cc.com", "mtvu.com" }, urls = { "https?://(?:www\\.)?mtv\\.de/.+", "https?://(?:www\\.)?(?:mtviggy|mtvdesi|mtvk)\\.com/.+", "https?://(?:www\\.)?southpark\\.de/.+", "https?://southpark\\.cc\\.com/.+", "https?://(?:www\\.)?southparkstudios\\.com/.+", "https?://(?:www\\.)?mtv\\.com\\.au/.+", "https?://(?:www\\.)?mtv\\.co\\.uk/.+", "https?://(?:www\\.)?mtv\\.com/.+", "https?://(?:www\\.)?cc\\.com/.+", "https?://de\\.funnyclips\\.cc/.+", "https?://(?:www\\.)?comedycentral\\.tv/.+", "https?://(?:www\\.)?nick\\.de/.+", "https?://(?:www\\.)?tvland\\.com/.+", +@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 3, names = { "mtv.de", "mtviggy.com", "southpark.de", "southpark.cc.com", "southparkstudios.com", "mtv.com.au", "mtv.co.uk", "mtv.com", "cc.com", "funnyclips.cc", "comedycentral.tv", "nick.de", "tvland.com", "spike.com", "thedailyshow.cc.com", "tosh.cc.com", "mtvu.com" }, urls = { "https?://(?:www\\.)?mtv\\.de/.+", "https?://(?:www\\.)?(?:mtviggy|mtvdesi|mtvk)\\.com/.+", "https?://(?:www\\.)?southpark\\.de/.+", "https?://southpark\\.cc\\.com/.+", "https?://(?:www\\.)?southparkstudios\\.com/.+", "https?://(?:www\\.)?mtv\\.com\\.au/.+", "https?://(?:www\\.)?mtv\\.co\\.uk/.+", "https?://(?:www\\.)?mtv\\.com/.+", "https?://(?:www\\.)?cc\\.com/.+", "https?://de\\.funnyclips\\.cc/.+", "https?://(?:www\\.)?comedycentral\\.tv/.+", "https?://(?:www\\.)?nick\\.de/.+", "https?://(?:www\\.)?tvland\\.com/.+", "https?://(?:www\\.)?spike\\.com/.+", "https?://thedailyshow\\.cc\\.com/.+", "https?://tosh\\.cc\\.com/.+", "https?://(?:www\\.)?mtvu\\.com/.+" }) public class VivaTvDecrypt extends PluginForDecrypt { public VivaTvDecrypt(PluginWrapper wrapper) { diff --git a/src/jd/plugins/hoster/DepositFiles.java b/src/jd/plugins/hoster/DepositFiles.java index d7ccf6251f..29d201558b 100644 --- a/src/jd/plugins/hoster/DepositFiles.java +++ b/src/jd/plugins/hoster/DepositFiles.java @@ -668,7 +668,7 @@ public class DepositFiles extends antiDDoSForHost { final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss", Locale.UK); account.setType(AccountType.PREMIUM); final Date date = dateFormat.parse(expire); - ai.setValidUntil(date.getTime()); + ai.setValidUntil(date.getTime(), br); } return ai; } @@ -689,6 +689,7 @@ public class DepositFiles extends antiDDoSForHost { return; } logger.info("Validating login cookies"); + br.getPage(MAINPAGE.get()); if (this.isLoggedIN(br)) { logger.info("Cookie login successful"); account.saveCookies(br.getCookies(br.getHost()), ""); @@ -698,7 +699,6 @@ public class DepositFiles extends antiDDoSForHost { br.clearCookies(null); } } - // web fail over method logger.info("Performing full login"); br.getPage(MAINPAGE.get() + "/login.php?return=%2Fde%2F"); Thread.sleep(1000); @@ -739,7 +739,7 @@ public class DepositFiles extends antiDDoSForHost { } private boolean isLoggedIN(final Browser br) { - if (br.containsHTML("logout\\.php") && br.getCookie(br.getHost(), "autologin", Cookies.NOTDELETEDPATTERN) != null) { + if (br.containsHTML("(?i)logout\\.php") && br.getCookie(br.getHost(), "autologin", Cookies.NOTDELETEDPATTERN) != null) { return true; } else { return false; @@ -768,7 +768,7 @@ public class DepositFiles extends antiDDoSForHost { private Map getAccountData(Account account) { synchronized (account) { - final Object ret = account.getProperty("accountData", null); + final Object ret = account.getProperty("accountData"); if (ret instanceof Map) { return (Map) ret; } else { @@ -862,6 +862,10 @@ public class DepositFiles extends antiDDoSForHost { account.setConcurrentUsePossible(false); } saveAccountData(accountData, account); + /** + * We can't validate logins so we always need to generate a fresh token.
+ * API will request login captchas if we're doing this too frequently. + */ account.setRefreshTimeout(5 * 60 * 60 * 1000l); } catch (final PluginException e) { if (e.getLinkStatus() == LinkStatus.ERROR_PREMIUM) { @@ -869,7 +873,6 @@ public class DepositFiles extends antiDDoSForHost { } throw e; } - // } return ai; } @@ -892,8 +895,9 @@ public class DepositFiles extends antiDDoSForHost { query.add("file_password", Encoding.urlEncode(passCode)); } apiGetPage(API_BASE + "/download/file?" + query.toString()); - Map entries = this.handleErrorsApi(link, account, "FileIsPasswordProtected"); - if ("FileIsPasswordProtected".equalsIgnoreCase((String) entries.get("error"))) { + final String errorPasswordProtected = "FileIsPasswordProtected"; + Map entries = this.handleErrorsApi(link, account, errorPasswordProtected); + if (errorPasswordProtected.equalsIgnoreCase((String) entries.get("error"))) { /* File is password protected */ link.setPasswordProtected(true); passCode = getUserInput("Password?", link); @@ -912,8 +916,10 @@ public class DepositFiles extends antiDDoSForHost { /* This should never happen. */ throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Bad API response"); } - // download modes seem to indicate if the user can download as 'gold' or 'free' connection ratios?. User can download there - // own uploads under gold even though they don't have gold account status. + /* + * download modes seem to indicate if the user can download as 'gold' or 'free' connection ratios?. User can download their own + * uploads under gold even though they don't have gold account status. + */ if ("gold".equalsIgnoreCase(mode)) { // resume = true; maxchunks = premiumChunklimit; @@ -935,6 +941,7 @@ public class DepositFiles extends antiDDoSForHost { } String directurl = (String) data.get("download_url"); if (StringUtils.isEmpty(directurl)) { + /* This should never happen. */ throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Bad API response: Failed to find final downloadurl"); } directurl = adjustProtocol(directurl); @@ -1018,9 +1025,9 @@ public class DepositFiles extends antiDDoSForHost { private String adjustProtocol(String link) { if (preferHTTPS()) { - link = link.replace("http://", "https://"); + link = link.replaceFirst("(?i)http://", "https://"); } else { - link = link.replace("https://", "http://"); + link = link.replaceFirst("(?i)https://", "http://"); } return link; } diff --git a/src/jd/plugins/hoster/JulesjordanCom.java b/src/jd/plugins/hoster/JulesjordanCom.java index 934a00df17..72f34593eb 100644 --- a/src/jd/plugins/hoster/JulesjordanCom.java +++ b/src/jd/plugins/hoster/JulesjordanCom.java @@ -287,7 +287,10 @@ public class JulesjordanCom extends antiDDoSForHost { // br.setCookies(newcookies); // } br.postPage("/auth.form", postdata); - if (br.getURL().matches("(?i).+/expired/?$")) { + if (br.containsHTML("captcha_x=1")) { + /* User entered invalid login-captcha */ + throw new PluginException(LinkStatus.ERROR_CAPTCHA); + } else if (br.getURL().matches("(?i).+/expired/?$")) { /* Login is valid but account is not premium anymore. */ throw new AccountInvalidException("Account is expired"); } else if (!isLoggedin(br)) {