*Plugins: Fixes/Changes/Maintenance*

- K2SApi: added temp workaround for broken mass-linkcheck API RE forum 96459

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

Former-commit-id: 77d9380b6887eba31fbf5c7790c386b05f32bf1d
This commit is contained in:
psp 2024-09-23 14:08:07 +00:00
parent 5450e15cbe
commit 726e473c60

View File

@ -14,6 +14,22 @@ import java.util.WeakHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import org.appwork.storage.JSonMapperException;
import org.appwork.storage.JSonStorage;
import org.appwork.storage.TypeRef;
import org.appwork.utils.StringUtils;
import org.appwork.utils.encoding.RFC2047;
import org.appwork.utils.logging2.LogInterface;
import org.appwork.utils.parser.UrlQuery;
import org.jdownloader.captcha.blacklist.BlockDownloadCaptchasByHost;
import org.jdownloader.captcha.blacklist.CaptchaBlackList;
import org.jdownloader.captcha.v2.Challenge;
import org.jdownloader.captcha.v2.challenge.recaptcha.v2.CaptchaHelperHostPluginRecaptchaV2;
import org.jdownloader.plugins.components.config.Keep2shareConfig;
import org.jdownloader.plugins.components.config.Keep2shareConfig.CaptchaTimeoutBehavior;
import org.jdownloader.plugins.components.config.Keep2shareConfig.LinkcheckMode;
import org.jdownloader.plugins.config.PluginJsonConfig;
import jd.PluginWrapper;
import jd.controlling.AccountController;
import jd.controlling.captcha.SkipRequest;
@ -43,22 +59,6 @@ import jd.plugins.components.PluginJSonUtils;
import jd.plugins.decrypter.Keep2ShareCcDecrypter;
import jd.plugins.download.DownloadInterface;
import org.appwork.storage.JSonMapperException;
import org.appwork.storage.JSonStorage;
import org.appwork.storage.TypeRef;
import org.appwork.utils.StringUtils;
import org.appwork.utils.encoding.RFC2047;
import org.appwork.utils.logging2.LogInterface;
import org.appwork.utils.parser.UrlQuery;
import org.jdownloader.captcha.blacklist.BlockDownloadCaptchasByHost;
import org.jdownloader.captcha.blacklist.CaptchaBlackList;
import org.jdownloader.captcha.v2.Challenge;
import org.jdownloader.captcha.v2.challenge.recaptcha.v2.CaptchaHelperHostPluginRecaptchaV2;
import org.jdownloader.plugins.components.config.Keep2shareConfig;
import org.jdownloader.plugins.components.config.Keep2shareConfig.CaptchaTimeoutBehavior;
import org.jdownloader.plugins.components.config.Keep2shareConfig.LinkcheckMode;
import org.jdownloader.plugins.config.PluginJsonConfig;
/**
* Abstract class supporting keep2share/fileboom/publish2<br/>
* <a href="https://github.com/keep2share/api/">Github documentation</a>
@ -297,8 +297,8 @@ public abstract class K2SApi extends PluginForHost {
}
/**
* There are special long fileIDs most likely used for tracking. </br> There can be multiple of those IDs available for the same file so
* those special IDs can't be reliably used for duplicate-checking.
* There are special long fileIDs most likely used for tracking. </br>
* There can be multiple of those IDs available for the same file so those special IDs can't be reliably used for duplicate-checking.
*/
public static boolean isSpecialFileID(final String fuid) {
if (fuid != null && (fuid.contains("-") || fuid.contains("_"))) {
@ -372,11 +372,16 @@ public abstract class K2SApi extends PluginForHost {
public boolean internal_supportsMassLinkcheck() {
/**
* The need to have a setting for the mass-linkcheck behavior is mainly due to a serverside API bug in mass-linkcheck which leads to
* files being displayed as online while they actually don't exist anymore (abused/deleted). </br> More detailed description:
* https://board.jdownloader.org/showthread.php?t=95537
* files being displayed as online while they actually don't exist anymore (abused/deleted). </br>
* More detailed description: https://board.jdownloader.org/showthread.php?t=95537
*/
final Keep2shareConfig cfg = PluginJsonConfig.get(this.getConfigInterface());
final LinkcheckMode mode = cfg.getFileLinkcheckMode();
// final LinkcheckMode mode = cfg.getFileLinkcheckMode();
/**
* 2024-09-23: Temp workaround for broken API. Context: https://board.jdownloader.org/showthread.php?t=96459 </br>
* TODO: Remove this asap
*/
final LinkcheckMode mode = LinkcheckMode.SINGLE_LINKCHECK;
if (mode == LinkcheckMode.SINGLE_LINKCHECK) {
/* User prefers single linkcheck. */
return false;
@ -455,8 +460,8 @@ public abstract class K2SApi extends PluginForHost {
final Boolean isFolder = (Boolean) fileInfo.get("is_folder");
if (Boolean.TRUE.equals(isFolder)) {
/**
* Check if somehow a fileID has managed to go into the hoster plugin handling. </br> This should never
* happen.
* Check if somehow a fileID has managed to go into the hoster plugin handling. </br>
* This should never happen.
*/
link.setAvailable(false);
if (link.getComment() == null) {
@ -471,8 +476,8 @@ public abstract class K2SApi extends PluginForHost {
if (StringUtils.equals((String) root.get("message"), "Invalid request params")) {
/**
* 2022-02-25: Workaround for when checking only one <b>invalid</b> fileID e.g.
* "2ahUKEwiUlaOqlZv2AhWLyIUKHXOjAmgQuZ0HegQIARBG". </br> This may also happen when there are multiple
* fileIDs to check and all of them are invalid.
* "2ahUKEwiUlaOqlZv2AhWLyIUKHXOjAmgQuZ0HegQIARBG". </br>
* This may also happen when there are multiple fileIDs to check and all of them are invalid.
*/
for (final DownloadLink dl : links) {
dl.setAvailable(false);
@ -882,9 +887,10 @@ public abstract class K2SApi extends PluginForHost {
if (StringUtils.startsWithCaseInsensitive(captchaAddress, "http://")) {
/**
* 2020-02-03: Possible workaround for this issues reported here: board.jdownloader.org/showthread.php?t=82989 and 2020-04-23:
* board.jdownloader.org/showthread.php?t=83927 </br> and board.jdownloader.org/showthread.php?t=83781 </br> Explanation: This
* filehost will block the users' IP if too many un-answered captcha requests are taking place. </br> This method is here to try
* to avoid this.
* board.jdownloader.org/showthread.php?t=83927 </br>
* and board.jdownloader.org/showthread.php?t=83781 </br>
* Explanation: This filehost will block the users' IP if too many un-answered captcha requests are taking place. </br>
* This method is here to try to avoid this.
*/
logger.info("login-captcha_url is not https --> Changing it to https");
captchaAddress = captchaAddress.replaceFirst("(?i)http://", "https://");
@ -1765,9 +1771,9 @@ public abstract class K2SApi extends PluginForHost {
}
/**
* Check single file via single linkcheck using another API call. </br> Can be used as a workaround for this problem:
* https://board.jdownloader.org/showthread.php?t=95537 </br> API call used here:
* https://keep2share.github.io/api/#resources:/getFileStatus:post
* Check single file via single linkcheck using another API call. </br>
* Can be used as a workaround for this problem: https://board.jdownloader.org/showthread.php?t=95537 </br>
* API call used here: https://keep2share.github.io/api/#resources:/getFileStatus:post
*/
private AvailableStatus requestFileInformationViaSingleLinkcheck_GetfilestatusAPICall(final DownloadLink link) throws Exception {
final HashMap<String, Object> postdataGetfilestatus = new HashMap<String, Object>();
@ -2093,7 +2099,6 @@ public abstract class K2SApi extends PluginForHost {
return true;
}
}
// @Override
// public boolean canHandle(final DownloadLink link, final Account account) throws Exception {
// final boolean isAvailableForFree = link.getBooleanProperty(PROPERTY_isAvailableForFree, true);