*Plugins: Fixes/Changes/Maintenance*

- RapideoCore: improved errorhandling in website mode
RapidGatorNet:
- more detailed error messages for "subscribe only" files refs #89871
- free(!) download: only check for errors if it looks like we are not on a download page to allow free download of files with error "The files of this publisher "<publisherName>" can be downloaded only by subscribers." that are downloadable at the same time RE forum 96330
- premium download: allow download of "subscribe only" files in premium mode via free handling RE forum 96330

git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@49649 ebf7c1c2-ba36-0410-9fe8-c592906822b4

Former-commit-id: e71e2a42a22be3f4d94799f80075383d5324d527
This commit is contained in:
psp 2024-08-23 10:05:49 +00:00
parent 0030c4a7fe
commit 2e570276e7
3 changed files with 35 additions and 29 deletions

View File

@ -128,12 +128,11 @@ public class GoProCloudDecrypter extends antiDDoSForDecrypt {
protected void decryptMedialibrary(final ArrayList<DownloadLink> decryptedLinks, final Account account, CryptedLink cryptedLink) throws Exception {
final FlexiJSonMapper mapper = new FlexiJSonMapper();
String id = new Regex(cryptedLink.getCryptedUrl(), ".*/media-library/([^/]+)").getMatch(0);
if (account != null) {
login(this.br, account);
} else {
String id = new Regex(cryptedLink.getCryptedUrl(), "(?i).*/media-library/([^/]+)").getMatch(0);
if (account == null) {
throw new AccountRequiredException();
}
login(this.br, account);
if (StringUtils.isNotEmpty(id) && !StringUtils.equalsIgnoreCase(id, "links")) {
scanID(decryptedLinks, account, cryptedLink, mapper, id, null, "premium", null);
} else {

View File

@ -421,13 +421,14 @@ public class RapidGatorNet extends PluginForHost {
this.dl = null;
logger.info("No direct-URL -> Tring to generate fresh directurl");
br.followConnection(true);
final String subscribersOnlyDownload = getErrormessageSubscriberOnlyDownload(br);
if (isPremiumAccount && isBuyFile(br, link, account)) {
/* 2022-11-07: can be *bypassed* for premium users by using API mode */
logger.info("File needs to be bought separately -> Trying to work around this limitation");
handlePremium_api(link, account);
return;
}
if (isPremiumAccount) {
if (isPremiumAccount && subscribersOnlyDownload == null) {
/* Premium account */
finalDownloadURL = br.getRegex("var premium_download_link\\s*=\\s*'(https?://[^<>\"']+)';").getMatch(0);
if (finalDownloadURL == null) {
@ -437,7 +438,7 @@ public class RapidGatorNet extends PluginForHost {
}
}
} else {
/* Free + free account */
/* Free + free account + free download of subscriber-only file in premium mode */
if (cfg.isActivateExperimentalWaittimeHandling()) {
currentIP = new BalancedWebIPCheck(br.getProxy()).getExternalIP().getIP();
logger.info("currentIP = " + currentIP);
@ -449,12 +450,6 @@ public class RapidGatorNet extends PluginForHost {
}
}
logger.info("blockedIPsMap: " + blockedIPsMap);
}
handleErrorsWebsite(this.br, link, account, currentIP, true);
if (account != null && !this.isLoggedINWebsite(br)) {
throw new AccountUnavailableException("Session expired?", 1 * 60 * 1000l);
}
if (cfg.isActivateExperimentalWaittimeHandling()) {
final long lastdownload_timestamp = getPluginSavedLastDownloadTimestamp(currentIP);
final long passedTimeSinceLastFreeDownloadMilliseconds = System.currentTimeMillis() - lastdownload_timestamp;
logger.info("Wait between free downloads to prevent your IP from getting blocked for 1 day!");
@ -463,12 +458,17 @@ public class RapidGatorNet extends PluginForHost {
}
}
final String fid = br.getRegex("var fid = (\\d+);").getMatch(0);
if (fid == null) {
final String waitSecondsStr = br.getRegex("var secs = (\\d+);").getMatch(0);
if (fid == null || waitSecondsStr == null) {
handleErrorsWebsite(this.br, link, account, currentIP, true);
if (account != null && !this.isLoggedINWebsite(br)) {
throw new AccountUnavailableException("Session expired?", 1 * 60 * 1000l);
}
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
final String waitSecondsStr = br.getRegex("var secs = (\\d+);").getMatch(0);
if (waitSecondsStr == null) {
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
if (isPremiumAccount && subscribersOnlyDownload != null) {
/* Use owns premium account but can't download this file as premium user. */
logger.info("Attempting free download in premium mode because only premium subscribers can download this file as premium");
}
logger.info("Pre download wait in seconds: " + waitSecondsStr);
long waitMillis = Long.parseLong(waitSecondsStr) * 1000;
@ -1578,6 +1578,10 @@ public class RapidGatorNet extends PluginForHost {
handleErrorsWebsite(br, link, account, currentIP, false);
}
private String getErrormessageSubscriberOnlyDownload(final Browser br) {
return br.getRegex("(The files of this publisher \"[^\"<>]+\" can be downloaded only by subscribers\\.)").getMatch(0);
}
private void handleErrorsWebsite(final Browser br, final DownloadLink link, final Account account, final String currentIP, final boolean doExtendedOfflineCheck) throws PluginException {
if (account != null) {
/* Errors which should only happen in account mode */
@ -1591,9 +1595,12 @@ public class RapidGatorNet extends PluginForHost {
/* Check for offline file */
checkOfflineWebsite(br, link, doExtendedOfflineCheck);
/* Check if item is only downloadable for premium users. */
final String subscribersOnlyDownload = br.getRegex("(The files of this publisher \"[^\"]+\" can be downloaded only by subscribers)").getMatch(0);
final String subscribersOnlyDownload = getErrormessageSubscriberOnlyDownload(br);
if (subscribersOnlyDownload != null) {
/* This can even happen for premium account owners since an extra subscription is needed to download such files. */
/**
* This can even happen for premium account owners since an extra subscription is needed to download such files. </br>
* This is the same as when "isBuyFile()" returns true but with a more detailed error message.
*/
throw new AccountRequiredException(subscribersOnlyDownload);
}
final String errormsgFreeFilesizeLimit = br.getRegex("'(You can download files up to ([\\d\\.]+ ?(MB|GB)) in free mode)\\s*<").getMatch(0);
@ -1665,11 +1672,7 @@ public class RapidGatorNet extends PluginForHost {
throw new PluginException(LinkStatus.ERROR_HOSTER_TEMPORARILY_UNAVAILABLE, "You can't download more than one file within a certain time period in free mode", PluginJsonConfig.get(RapidGatorConfig.class).getWaitSecondsOnErrorYouCantDownloadMoreThanOneFile() * 1000l);
} else if (isBuyFile(br, link, account)) {
/* 2022-11-07: Files that need to be purchased separately in order to be able to download them. */
if (account == null) {
throw new AccountRequiredException();
} else {
throw new PluginException(LinkStatus.ERROR_FATAL, "You need to buy this file");
}
throw new AccountRequiredException("The files of this publisher can be downloaded only by subscribers.");
}
/* Check for some generic errors */
if (br.getHttpConnection() != null && br.getHttpConnection().getResponseCode() == 403) {

View File

@ -299,7 +299,11 @@ public abstract class RapideoCore extends PluginForHost {
}
private void checkErrorsWebsite(final Browser br, final DownloadLink link, final Account account) throws PluginException {
final String geoLoginFailure = br.getRegex(">\\s*(You login from a different location than usual[^<]*)<").getMatch(0);
String geoLoginFailure = br.getRegex(">\\s*(You login from a different location than usual[^<]*)<").getMatch(0);
if (geoLoginFailure == null) {
/* nopremium.pl, they only have Polish version. */
geoLoginFailure = br.getRegex(">\\s*(Logujesz się z innego miejsca niż zazwyczaj[^<]+)").getMatch(0);
}
if (geoLoginFailure != null) {
/* 2020-11-02: Login from unusual location -> User has to confirm via URL send by mail and then try again in JD (?!). */
throw new AccountUnavailableException(geoLoginFailure + "\r\nOnce done, refresh your account in JDownloader.", 5 * 60 * 1000l);
@ -425,22 +429,22 @@ public abstract class RapideoCore extends PluginForHost {
}
} else {
/* Website */
final int random = new Random().nextInt(1000000);
final DecimalFormat df = new DecimalFormat("000000");
final String random_session = df.format(random);
final String filename = link.getName();
br.getPage("https://www." + getHost() + "/twoje_pliki");
checkErrorsWebsite(br, link, account);
br.postPage("/twoje_pliki", "loadfiles=1");
br.postPage("/twoje_pliki", "loadfiles=2");
br.postPage("/twoje_pliki", "loadfiles=3");
final int random = new Random().nextInt(1000000);
final DecimalFormat df = new DecimalFormat("000000");
final String random_session = df.format(random);
final String filename = link.getName();
br.postPage("/twoje_pliki", "session=" + random_session + "&links=" + url_urlencoded);
if (br.containsHTML("strong>\\s*Brak transferu\\s*</strong>")) {
throw new AccountUnavailableException("Out of traffic", 1 * 60 * 1000l);
}
final String id = br.getRegex("data\\-id=\"([a-z0-9]+)\"").getMatch(0);
if (id == null) {
mhm.handleErrorGeneric(account, link, "Failed to find transferID", 20);
mhm.handleErrorGeneric(account, link, "Failed to find transferID", 50);
}
br.postPage("/twoje_pliki", "downloadprogress=1");
br.postPage("/progress", "session=" + random_session + "&total=1");