mime.type:

-added wav/tiff support
-fixes thread 94037
UpToBoxCom:
-updated error handling in handleFree
MegaConz:
-updated error handling in requestFileInformation
-fixes thread 91834
CyberdropMe:
-updated getContentURL to fix broken cyberdrop URLs
-moved findDirectURL into hoster plugin
-added new cdn domain scheme
-refs #90382
ArchiveOrg:
-override isSpeedLimited, premium doesn't provide better speeds


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

Former-commit-id: 966bdbbe686583f8dd5205a6fa5efea50b0e5b19
This commit is contained in:
jiaz 2023-08-07 16:19:34 +00:00
parent 8fb641fcaf
commit 50430f8f63
9 changed files with 187 additions and 199 deletions

View File

@ -25,16 +25,6 @@ import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import org.appwork.storage.TypeRef;
import org.appwork.utils.Regex;
import org.appwork.utils.StringUtils;
import org.appwork.utils.formatter.SizeFormatter;
import org.appwork.utils.net.URLHelper;
import org.jdownloader.plugins.controller.UpdateRequiredClassNotFoundException;
import org.jdownloader.plugins.controller.host.HostPluginController;
import org.jdownloader.plugins.controller.host.LazyHostPlugin;
import org.jdownloader.scripting.JavaScriptEngineFactory;
import jd.PluginWrapper;
import jd.controlling.ProgressController;
import jd.http.Browser;
@ -53,8 +43,19 @@ import jd.plugins.Plugin;
import jd.plugins.PluginException;
import jd.plugins.PluginForDecrypt;
import jd.plugins.PluginForHost;
import jd.plugins.hoster.CyberdropMe;
import jd.plugins.hoster.DirectHTTP;
import org.appwork.storage.TypeRef;
import org.appwork.utils.Regex;
import org.appwork.utils.StringUtils;
import org.appwork.utils.formatter.SizeFormatter;
import org.appwork.utils.net.URLHelper;
import org.jdownloader.plugins.controller.UpdateRequiredClassNotFoundException;
import org.jdownloader.plugins.controller.host.HostPluginController;
import org.jdownloader.plugins.controller.host.LazyHostPlugin;
import org.jdownloader.scripting.JavaScriptEngineFactory;
@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 3, names = {}, urls = {})
public class CyberdropMeAlbum extends PluginForDecrypt {
public CyberdropMeAlbum(PluginWrapper wrapper) {
@ -95,25 +96,25 @@ public class CyberdropMeAlbum extends PluginForDecrypt {
final List<String> ret = new ArrayList<String>();
for (final String[] domains : pluginDomains) {
String regex = "https?://(?:www\\.)?" + buildHostsPatternPart(domains) + "/a/[A-Za-z0-9]+";
regex += "|https?://(files\\.)?" + buildHostsPatternPart(domains) + "/(?:v|d)/[^/]+\\." + EXTENSIONS;
regex += "|https?://(files\\.)?" + buildHostsPatternPart(domains) + "/v/[A-Za-z0-9]+";
regex += "|https?://stream\\d*\\." + buildHostsPatternPart(domains) + "/(?:v|d)/[^/]+\\." + EXTENSIONS;
regex += "|https?://cdn\\d*\\." + buildHostsPatternPart(domains) + "/[^/]+\\." + EXTENSIONS;
regex += "|https?://media-files\\d*\\." + buildHostsPatternPart(domains) + "/[^/]+\\." + EXTENSIONS;
regex += "|https?://fs-\\d+\\." + buildHostsPatternPart(domains) + "/.+\\." + EXTENSIONS;
regex += "|https?://(files\\.)?" + buildHostsPatternPart(domains) + "/(?:v|d)/[^/]+\\." + EXTENSIONS;// TYPE_SINGLE_FILE
regex += "|https?://(files\\.)?" + buildHostsPatternPart(domains) + "/v/[A-Za-z0-9]+";// TYPE_SINGLE_FILE_WITHOUT_EXT
regex += "|https?://stream\\d*\\." + buildHostsPatternPart(domains) + "/(?:v|d)/[^/]+\\." + EXTENSIONS;// TYPE_STREAM
regex += "|https?://c(?:dn)?\\d*\\." + buildHostsPatternPart(domains) + "/[^/]+\\." + EXTENSIONS;// TYPE_CDN
regex += "|https?://media-files\\d*\\." + buildHostsPatternPart(domains) + "/[^/]+\\." + EXTENSIONS;// TYPE_MEDIA_FILES
regex += "|https?://fs-\\d+\\." + buildHostsPatternPart(domains) + "/.+\\." + EXTENSIONS;// TYPE_FS
ret.add(regex);
}
return ret.toArray(new String[0]);
}
public static final String TYPE_ALBUM = "(?i)https?://[^/]+/a/([A-Za-z0-9]+)"; // album
public static final String TYPE_ALBUM = "(?i)https?://[^/]+/a/([A-Za-z0-9]+)"; // album
/* 2023-03-24: bunkr, files subdomain seems outdated? */
public static final String TYPE_SINGLE_FILE = "(?i)https?://(files\\.)?[^/]+/(?:v|d)/([^/]*?\\." + EXTENSIONS + ")";
public static final String TYPE_SINGLE_FILE_WITHOUT_EXT = "(?i)https?://(files\\.)?[^/]+/v/([A-Za-z0-9]+)";
public static final String TYPE_STREAM = "(?i)https?://stream(\\d*)\\.[^/]+/(?:v|d)/(.+\\." + EXTENSIONS + ")"; // bunkr
public static final String TYPE_CDN = "(?i)https?://cdn(\\d*)\\.[^/]+/(.+\\." + EXTENSIONS + ")"; // bunkr
public static final String TYPE_FS = "(?i)https?://fs-(\\d+)\\.[^/]+/(.+\\." + EXTENSIONS + ")"; // cyberdrop
public static final String TYPE_MEDIA_FILES = "(?i)https?://media-files(\\d*)\\.[^/]+/(.+\\." + EXTENSIONS + ")"; // bunkr
public static final String TYPE_CDN = "(?i)https?://c(?:dn)?(\\d*)\\.[^/]+/(.+\\." + EXTENSIONS + ")"; // bunkr
public static final String TYPE_FS = "(?i)https?://fs-(\\d+)\\.[^/]+/(.+\\." + EXTENSIONS + ")"; // cyberdrop
public static final String TYPE_MEDIA_FILES = "(?i)https?://media-files(\\d*)\\.[^/]+/(.+\\." + EXTENSIONS + ")"; // bunkr
private PluginForHost plugin = null;
private DownloadLink add(final List<DownloadLink> ret, Set<String> dups, String directurl, String filename, final String filesizeBytes, final String filesize) throws Exception {
@ -121,7 +122,7 @@ public class CyberdropMeAlbum extends PluginForDecrypt {
// bunkr, html encoding in filename and directurl
filename = Encoding.htmlOnlyDecode(filename);
directurl = Encoding.htmlOnlyDecode(directurl);
final String correctedDirectURL = correctDirecturl(directurl);
final String correctedDirectURL = isSingleMediaURL(directurl);
final DownloadLink dl;
if (correctedDirectURL != null) {
dl = this.createDownloadlink(correctedDirectURL);
@ -166,7 +167,7 @@ public class CyberdropMeAlbum extends PluginForDecrypt {
}
}
private String parseFilename(Browser br, String html) {
private String parseMediaFilename(Browser br, String html) {
String filename = new Regex(html, "target\\s*=\\s*\"_blank\"\\s*title\\s*=\\s*\"([^<>\"]+)\"").getMatch(0);
if (filename == null) {
// bunkr.is
@ -178,7 +179,7 @@ public class CyberdropMeAlbum extends PluginForDecrypt {
return filename;
}
private String parseDirectURL(final Browser br, final String html) throws IOException {
private String parseMediaURL(final Browser br, final String html) throws IOException {
String directurl = new Regex(html, "href\\s*=\\s*\"(https?://[^\"]+)\"").getMatch(0);
if (directurl == null) {
directurl = new Regex(html, "href\\s*=\\s*\"(/(?:d|v)/[^\"]+)\"").getMatch(0);
@ -191,7 +192,7 @@ public class CyberdropMeAlbum extends PluginForDecrypt {
public ArrayList<DownloadLink> decryptIt(final CryptedLink param, ProgressController progress) throws Exception {
final ArrayList<DownloadLink> ret = new ArrayList<DownloadLink>();
final String correctedDirectURL = correctDirecturl(param.getCryptedUrl());
final String correctedDirectURL = isSingleMediaURL(param.getCryptedUrl());
if (correctedDirectURL != null) {
/* Direct downloadable URL. */
add(ret, null, param.getCryptedUrl(), null, null, null);
@ -306,8 +307,8 @@ public class CyberdropMeAlbum extends PluginForDecrypt {
}
final String[] htmls = br.getRegex("<div class=\"image-container column\"[^>]*>(.*?)/p>\\s*</div>").getColumn(0);
for (final String html : htmls) {
final String filename = parseFilename(br, html);
final String directurl = parseDirectURL(br, html);
final String filename = parseMediaFilename(br, html);
final String directurl = parseMediaURL(br, html);
if (directurl != null) {
final String filesizeBytes = new Regex(html, "class=\"(?:is-hidden)?\\s*file-size\"[^>]*>\\s*(\\d+) B").getMatch(0);
final String filesize = new Regex(html, "class=\"(?:is-hidden)?\\s*file-size\"[^>]*>\\s*([0-9\\.]+\\s+[MKG]B)").getMatch(0);
@ -317,8 +318,8 @@ public class CyberdropMeAlbum extends PluginForDecrypt {
/* 2023-02-13: bunkr.su */
final String[] htmls2 = br.getRegex("<div class=\"grid-images_box rounded-lg[^\"]+\"(.*?)</div>\\s+</div>").getColumn(0);
for (final String html : htmls2) {
final String filename = parseFilename(br, html);
final String directurl = parseDirectURL(br, html);
final String filename = parseMediaFilename(br, html);
final String directurl = parseMediaURL(br, html);
if (directurl != null) {
final String filesize = new Regex(html, "<p class=\"mt-0 dark:text-white-900\"[^>]*>\\s*([^<]*?)\\s*</p>").getMatch(0);
add(ret, dups, directurl, filename, null, filesize);
@ -329,7 +330,7 @@ public class CyberdropMeAlbum extends PluginForDecrypt {
if (ret.isEmpty()) {
/* Look for single directurl */
/* 2023-07-06: E.g. bunkr.su/v/fileID */
final String directurl = findDirectURL(br);
final String directurl = CyberdropMe.findDirectURL(this, br);
final String filesize = br.getRegex("class=\"[^>]*text[^>]*\"[^>]*>\\s*([0-9\\.]+\\s+[MKG]B)").getMatch(0);
final String fileExtensionFromURL = filesize != null ? Plugin.getFileNameExtensionFromURL(directurl) : null;
/* Check if URL we got looks like a direct-URL and only then add it. */
@ -359,49 +360,19 @@ public class CyberdropMeAlbum extends PluginForDecrypt {
return ret;
}
public static String findDirectURL(final Browser br) {
String directurl = br.getRegex("link\\.href\\s*=\\s*\"(https?://[^\"]+)\"").getMatch(0);
if (directurl == null) {
directurl = br.getRegex("(?i)href=\"(https?://[^\"]+)[^>]*>\\s*Download").getMatch(0);
if (directurl == null) {
/* Video stream (URL is usually the same as downloadurl) */
directurl = br.getRegex("<source src=\"(https?://[^\"]+)\"[^>]*type=.video/mp4").getMatch(0);
}
}
return directurl;
}
/**
* Corrects given URL. </br>
* Returns null if given URL is not a known stream/cdn URL. </br>
* 2022-03-14: Especially required for bunkr.is video-URLs.
* Corrects given URL. </br> Returns null if given URL is not a known stream/cdn URL. </br> 2022-03-14: Especially required for bunkr.is
* video-URLs.
*/
private String correctDirecturl(final String url) {
String host = getHost();
final Regex streamregex = new Regex(url, TYPE_STREAM);
final Regex cdnregex = new Regex(url, TYPE_CDN);
final boolean allowCorrectionOfURLs = false;
if (streamregex.matches()) {
private String isSingleMediaURL(final String url) {
if (url == null) {
return null;
} else if (url.matches(TYPE_STREAM)) {
/* cdn can be empty(!) -> stream.bunkr.is -> media-files.bunkr.is */
if (MAIN_BUNKR_DOMAIN.equals(host)) {
/* 2023-03-24: looks like media/cdn domain is still bunkr.ru */
host = "bunkr.ru";
}
if (allowCorrectionOfURLs) {
return "https://media-files" + StringUtils.valueOrEmpty(streamregex.getMatch(0)) + "." + host + "/" + streamregex.getMatch(1);
} else {
return url;
}
} else if (cdnregex.matches()) {
return url;
} else if (url.matches(TYPE_CDN)) {
/* cdn can be empty(!) -> cdn.bunkr.is -> media-files.bunkr.is */
if (MAIN_BUNKR_DOMAIN.equals(host)) { /* 2023-03-24: looks like media/cdn domain is still bunkr.ru */
host = "bunkr.ru";
}
if (allowCorrectionOfURLs) {
return "https://media-files" + StringUtils.valueOrEmpty(cdnregex.getMatch(0)) + "." + host + "/" + cdnregex.getMatch(1);
} else {
return url;
}
return url;
} else if (url.matches(TYPE_FS)) {
// cyberdrop
return url;

View File

@ -31,6 +31,31 @@ import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import jd.PluginWrapper;
import jd.controlling.ProgressController;
import jd.controlling.linkcollector.LinkCollector;
import jd.controlling.linkcrawler.CrawledLink;
import jd.controlling.linkcrawler.CrawledPackage;
import jd.controlling.packagecontroller.AbstractNodeVisitor;
import jd.http.Browser;
import jd.nutils.encoding.Encoding;
import jd.parser.Regex;
import jd.plugins.Account;
import jd.plugins.CryptedLink;
import jd.plugins.DecrypterPlugin;
import jd.plugins.DecrypterRetryException;
import jd.plugins.DecrypterRetryException.RetryReason;
import jd.plugins.DownloadLink;
import jd.plugins.DownloadLink.AvailableStatus;
import jd.plugins.FilePackage;
import jd.plugins.LinkStatus;
import jd.plugins.PluginException;
import jd.plugins.PluginForDecrypt;
import jd.plugins.components.UserAgents;
import jd.plugins.components.UserAgents.BrowserName;
import jd.plugins.hoster.YoutubeDashV2;
import jd.utils.locale.JDL;
import org.appwork.storage.JSonStorage;
import org.appwork.storage.TypeRef;
import org.appwork.uio.ConfirmDialogInterface;
@ -85,31 +110,6 @@ import org.jdownloader.plugins.controller.LazyPlugin;
import org.jdownloader.scripting.JavaScriptEngineFactory;
import org.jdownloader.settings.staticreferences.CFG_YOUTUBE;
import jd.PluginWrapper;
import jd.controlling.ProgressController;
import jd.controlling.linkcollector.LinkCollector;
import jd.controlling.linkcrawler.CrawledLink;
import jd.controlling.linkcrawler.CrawledPackage;
import jd.controlling.packagecontroller.AbstractNodeVisitor;
import jd.http.Browser;
import jd.nutils.encoding.Encoding;
import jd.parser.Regex;
import jd.plugins.Account;
import jd.plugins.CryptedLink;
import jd.plugins.DecrypterPlugin;
import jd.plugins.DecrypterRetryException;
import jd.plugins.DecrypterRetryException.RetryReason;
import jd.plugins.DownloadLink;
import jd.plugins.DownloadLink.AvailableStatus;
import jd.plugins.FilePackage;
import jd.plugins.LinkStatus;
import jd.plugins.PluginException;
import jd.plugins.PluginForDecrypt;
import jd.plugins.components.UserAgents;
import jd.plugins.components.UserAgents.BrowserName;
import jd.plugins.hoster.YoutubeDashV2;
import jd.utils.locale.JDL;
@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 3, names = {}, urls = {})
public class TbCmV2 extends PluginForDecrypt {
private static final int DDOS_WAIT_MAX = Application.isJared(null) ? 1000 : 10;
@ -1223,8 +1223,8 @@ public class TbCmV2 extends PluginForDecrypt {
}
}
/**
* This message can also contain information like "2 unavailable videos won't be displayed in this list". </br>
* Only mind this errormessage if we can't find any content.
* This message can also contain information like "2 unavailable videos won't be displayed in this list". </br> Only mind this
* errormessage if we can't find any content.
*/
alerts = (List<Map<String, Object>>) rootMap.get("alerts");
errorOrWarningMessage = null;
@ -1263,9 +1263,8 @@ public class TbCmV2 extends PluginForDecrypt {
videosCountText = (String) JavaScriptEngineFactory.walkJson(playlistHeaderRenderer, "numVideosText/runs/{0}/text");
}
/**
* Find extra information about channel </br>
* Do not do this if tab is e.g. "shorts" as we'd then pickup an incorrect number. YT ui does not display the total number of
* shorts of a user.
* Find extra information about channel </br> Do not do this if tab is e.g. "shorts" as we'd then pickup an incorrect number. YT
* ui does not display the total number of shorts of a user.
*/
final Map<String, Object> channelHeaderRenderer = (Map<String, Object>) JavaScriptEngineFactory.walkJson(rootMap, "header/c4TabbedHeaderRenderer");
if (channelHeaderRenderer != null && StringUtils.equalsIgnoreCase(desiredChannelTab, "Videos")) {
@ -1421,7 +1420,7 @@ public class TbCmV2 extends PluginForDecrypt {
/* E.g. at the beginning after sorting */
varray = (List<Map<String, Object>>) JavaScriptEngineFactory.walkJson(lastReceivedAction, "reloadContinuationItemsCommand/continuationItems");
}
} catch (final Throwable e) {
} catch (final Exception e) {
if (ret.isEmpty()) {
throw e;
} else {
@ -1429,9 +1428,8 @@ public class TbCmV2 extends PluginForDecrypt {
if (alerts != null && alerts.size() > 0) {
/**
* 2023-08-03: E.g. playlist with 700 videos but 680 of them are hidden/unavailable which means first pagination
* attempt will fail. </br>
* Even via website this seems to be and edge case as the loading icon will never disappear and no error is
* displayed.
* attempt will fail. </br> Even via website this seems to be and edge case as the loading icon will never disappear
* and no error is displayed.
*/
logger.info("Pagination failed -> Possible reason: " + errorOrWarningMessage);
} else {

View File

@ -22,23 +22,6 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import org.appwork.storage.TypeRef;
import org.appwork.utils.Files;
import org.appwork.utils.Regex;
import org.appwork.utils.StringUtils;
import org.appwork.utils.Time;
import org.appwork.utils.net.URLHelper;
import org.appwork.utils.parser.UrlQuery;
import org.jdownloader.controlling.filter.CompiledFiletypeFilter;
import org.jdownloader.controlling.filter.CompiledFiletypeFilter.ExtensionsFilterInterface;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.plugins.components.archiveorg.ArchiveOrgConfig;
import org.jdownloader.plugins.components.archiveorg.ArchiveOrgConfig.PlaylistFilenameScheme;
import org.jdownloader.plugins.components.archiveorg.ArchiveOrgLendingInfo;
import org.jdownloader.plugins.config.PluginConfigInterface;
import org.jdownloader.plugins.config.PluginJsonConfig;
import org.jdownloader.plugins.controller.LazyPlugin;
import jd.PluginWrapper;
import jd.controlling.AccountController;
import jd.http.Browser;
@ -60,6 +43,23 @@ import jd.plugins.PluginException;
import jd.plugins.PluginForHost;
import jd.plugins.decrypter.ArchiveOrgCrawler;
import org.appwork.storage.TypeRef;
import org.appwork.utils.Files;
import org.appwork.utils.Regex;
import org.appwork.utils.StringUtils;
import org.appwork.utils.Time;
import org.appwork.utils.net.URLHelper;
import org.appwork.utils.parser.UrlQuery;
import org.jdownloader.controlling.filter.CompiledFiletypeFilter;
import org.jdownloader.controlling.filter.CompiledFiletypeFilter.ExtensionsFilterInterface;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.plugins.components.archiveorg.ArchiveOrgConfig;
import org.jdownloader.plugins.components.archiveorg.ArchiveOrgConfig.PlaylistFilenameScheme;
import org.jdownloader.plugins.components.archiveorg.ArchiveOrgLendingInfo;
import org.jdownloader.plugins.config.PluginConfigInterface;
import org.jdownloader.plugins.config.PluginJsonConfig;
import org.jdownloader.plugins.controller.LazyPlugin;
@HostPlugin(revision = "$Revision$", interfaceVersion = 3, names = { "archive.org" }, urls = { "https?://(?:[\\w\\.]+)?archive\\.org/download/[^/]+/[^/]+(/.+)?" })
public class ArchiveOrg extends PluginForHost {
public ArchiveOrg(PluginWrapper wrapper) {
@ -86,6 +86,11 @@ public class ArchiveOrg extends PluginForHost {
}
}
@Override
public boolean isSpeedLimited(DownloadLink link, Account account) {
return false;
}
/* Connection stuff */
private final int MAXDOWNLOADS = -1;
private final String PROPERTY_DOWNLOAD_SERVERSIDE_BROKEN = "download_serverside_broken";
@ -227,9 +232,8 @@ public class ArchiveOrg extends PluginForHost {
}
/**
* Returns true if this book page is borrowed at this moment. </br>
* This information is only useful with the combination of the borrow-cookies and can become invalid at any point of time if e.g. the
* user returns the book manually via browser.
* Returns true if this book page is borrowed at this moment. </br> This information is only useful with the combination of the
* borrow-cookies and can become invalid at any point of time if e.g. the user returns the book manually via browser.
*/
private boolean isLendAtThisMoment(final DownloadLink link) {
final long borrowedUntilTimestamp = link.getLongProperty(PROPERTY_IS_BORROWED_UNTIL_TIMESTAMP, -1);
@ -263,8 +267,8 @@ public class ArchiveOrg extends PluginForHost {
}
/**
* A special string that is the same as the bookID but different for multi volume books. </br>
* ...thus only relevant for multi volume books.
* A special string that is the same as the bookID but different for multi volume books. </br> ...thus only relevant for multi volume
* books.
*/
private String getBookSubPrefix(final DownloadLink link) {
return link.getStringProperty(PROPERTY_BOOK_SUB_PREFIX);
@ -562,8 +566,7 @@ public class ArchiveOrg extends PluginForHost {
}
/**
* Borrows given bookID which gives us a token we can use to download all pages of that book. </br>
* It is typically valid for one hour.
* Borrows given bookID which gives us a token we can use to download all pages of that book. </br> It is typically valid for one hour.
*/
private void borrowBook(final Browser br, final Account account, final String bookID, final boolean skipAllExceptLastStep) throws Exception {
if (account == null) {
@ -597,9 +600,9 @@ public class ArchiveOrg extends PluginForHost {
if (StringUtils.equalsIgnoreCase(error, "This book is not available to borrow at this time. Please try again later.")) {
/**
* Happens if you try to borrow a book that can't be borrowed or if you try to borrow a book while too many
* (2022-08-31: max 10) books per hour have already been borrowed with the current account. </br>
* With setting this timestamp we can ensure not to waste more http requests on trying to borrow books but simply
* set error status on all future links [for the next 60 minutes].
* (2022-08-31: max 10) books per hour have already been borrowed with the current account. </br> With setting this
* timestamp we can ensure not to waste more http requests on trying to borrow books but simply set error status on
* all future links [for the next 60 minutes].
*/
account.setProperty(PROPERTY_ACCOUNT_TIMESTAMP_BORROW_LIMIT_REACHED, Time.systemIndependentCurrentJVMTimeMillis());
/*

View File

@ -4,10 +4,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.appwork.utils.StringUtils;
import org.jdownloader.plugins.controller.LazyPlugin;
import org.jdownloader.plugins.controller.host.PluginFinder;
import jd.PluginWrapper;
import jd.controlling.linkcrawler.CheckableLink;
import jd.http.Browser;
@ -23,6 +19,10 @@ import jd.plugins.PluginException;
import jd.plugins.PluginForHost;
import jd.plugins.decrypter.CyberdropMeAlbum;
import org.appwork.utils.StringUtils;
import org.jdownloader.plugins.controller.LazyPlugin;
import org.jdownloader.plugins.controller.host.PluginFinder;
@HostPlugin(revision = "$Revision$", interfaceVersion = 3, names = {}, urls = {})
@PluginDependencies(dependencies = { CyberdropMeAlbum.class })
public class CyberdropMe extends PluginForHost {
@ -129,12 +129,10 @@ public class CyberdropMe extends PluginForHost {
}
private String getContentURL(final DownloadLink link) {
if (false && CyberdropMeAlbum.MAIN_CYBERDROP_DOMAIN.equals(getHost())) {
if (CyberdropMeAlbum.MAIN_CYBERDROP_DOMAIN.equals(getHost())) {
final String url = link.getPluginPatternMatcher();
/* 2022-11-10: fs-(03|04|05|06) are offline, rewrite to fs-01, fs-02 redirects to fs-01 */
/* 2023-03-24: looks like fs-(03|04|05|06) are working again */
final String newUrl = url.replaceFirst("://fs-(03|04|05|06)", "://fs-01");
return newUrl;
final String newURL = url.replaceFirst("cyberdrop\\.[a-z]+/", CyberdropMeAlbum.MAIN_CYBERDROP_DOMAIN + "/");
return newURL;
} else {
return link.getPluginPatternMatcher();
}
@ -161,6 +159,18 @@ public class CyberdropMe extends PluginForHost {
return requestFileInformation(link, false);
}
public static String findDirectURL(final Plugin plugin, final Browser br) {
String directurl = br.getRegex("link\\.href\\s*=\\s*\"(https?://[^\"]+)\"").getMatch(0);
if (directurl == null) {
directurl = br.getRegex("(?i)href\\s*=\\s*\"(https?://[^\"]+)[^>]*>\\s*Download").getMatch(0);
if (directurl == null) {
/* Video stream (URL is usually the same as downloadurl) */
directurl = br.getRegex("<source src\\s*=\\s*\"(https?://[^\"]+)\"[^>]*type=.video/mp4").getMatch(0);
}
}
return directurl;
}
private AvailableStatus requestFileInformation(final DownloadLink link, final boolean isDownload) throws Exception {
this.setBrowserExclusive();
br.setFollowRedirects(true);
@ -186,7 +196,7 @@ public class CyberdropMe extends PluginForHost {
} catch (final PluginException e) {
/* E.g. cdn.bunkr.ru -> bunkr.su/v/... -> Try to find fresh directurl */
logger.info("Directurl did not lead to downloadable content -> Looking for freh directurl");
final String alternativeFreshDirecturl = CyberdropMeAlbum.findDirectURL(br);
final String alternativeFreshDirecturl = findDirectURL(this, br);
if (alternativeFreshDirecturl == null) {
logger.info("Failed to find fresh directurl");
throw e;

View File

@ -40,6 +40,34 @@ import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;
import jd.PluginWrapper;
import jd.config.Property;
import jd.controlling.downloadcontroller.DiskSpaceReservation;
import jd.controlling.downloadcontroller.ManagedThrottledConnectionHandler;
import jd.controlling.downloadcontroller.SingleDownloadController;
import jd.http.Browser;
import jd.http.Browser.BrowserException;
import jd.http.URLConnectionAdapter;
import jd.http.requests.PostRequest;
import jd.nutils.encoding.Base64;
import jd.parser.Regex;
import jd.plugins.Account;
import jd.plugins.Account.AccountType;
import jd.plugins.AccountInfo;
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.download.DownloadInterface;
import jd.plugins.download.DownloadLinkDownloadable;
import jd.plugins.download.Downloadable;
import jd.plugins.download.HashResult;
import org.appwork.shutdown.ShutdownController;
import org.appwork.shutdown.ShutdownRequest;
import org.appwork.shutdown.ShutdownVetoException;
@ -78,34 +106,6 @@ import org.jdownloader.settings.GraphicalUserInterfaceSettings.SIZEUNIT;
import org.jdownloader.settings.staticreferences.CFG_GUI;
import org.jdownloader.translate._JDT;
import jd.PluginWrapper;
import jd.config.Property;
import jd.controlling.downloadcontroller.DiskSpaceReservation;
import jd.controlling.downloadcontroller.ManagedThrottledConnectionHandler;
import jd.controlling.downloadcontroller.SingleDownloadController;
import jd.http.Browser;
import jd.http.Browser.BrowserException;
import jd.http.URLConnectionAdapter;
import jd.http.requests.PostRequest;
import jd.nutils.encoding.Base64;
import jd.parser.Regex;
import jd.plugins.Account;
import jd.plugins.Account.AccountType;
import jd.plugins.AccountInfo;
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.download.DownloadInterface;
import jd.plugins.download.DownloadLinkDownloadable;
import jd.plugins.download.Downloadable;
import jd.plugins.download.HashResult;
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "mega.co.nz" }, urls = { "(https?://(www\\.)?mega\\.(co\\.)?nz/.*?(#!?N?|\\$)|chrome://mega/content/secure\\.html#)(!|%21|\\?)[a-zA-Z0-9]+(!|%21)[a-zA-Z0-9_,\\-%]{16,}((=###n=|!)[a-zA-Z0-9]+)?|mega:/*#(?:!|%21)[a-zA-Z0-9]+(?:!|%21)[a-zA-Z0-9_,\\-%]{16,}" })
public class MegaConz extends PluginForHost {
private final String USED_PLUGIN = "usedPlugin";
@ -151,8 +151,7 @@ public class MegaConz extends PluginForHost {
public AccountInfo fetchAccountInfo(final Account account) throws Exception {
synchronized (account) {
final String sid = apiLogin(account);
final Map<String, Object> uq = apiRequest(account, sid, null, "uq"/* userQuota */, new Object[] { "xfer"/* xfer */, 1 },
new Object[] { "pro"/* pro */, 1 });
final Map<String, Object> uq = apiRequest(account, sid, null, "uq"/* userQuota */, new Object[] { "xfer"/* xfer */, 1 }, new Object[] { "pro"/* pro */, 1 });
// mxfer - maximum transfer allowance
// caxfer - PRO transfer quota consumed by yourself
// csxfer - PRO transfer quota served to others
@ -375,8 +374,7 @@ public class MegaConz extends PluginForHost {
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
try {
response = apiRequest(account, null, null, "us"/* logIn */, new Object[] { "user"/* email */, lowerCaseEmail },
new Object[] { "uh"/* emailHash */, uh });
response = apiRequest(account, null, null, "us"/* logIn */, new Object[] { "user"/* email */, lowerCaseEmail }, new Object[] { "uh"/* emailHash */, uh });
} catch (PluginException e) {
if (e.getLinkStatus() == LinkStatus.ERROR_PREMIUM && e.getValue() == PluginException.VALUE_ID_PREMIUM_TEMP_DISABLE && account.getBooleanProperty("mfa", Boolean.FALSE)) {
try {
@ -384,8 +382,7 @@ public class MegaConz extends PluginForHost {
mfaDialog.setTimeout(5 * 60 * 1000);
final InputDialogInterface handler = UIOManager.I().show(InputDialogInterface.class, mfaDialog);
handler.throwCloseExceptions();
response = apiRequest(account, null, null, "us"/* logIn */, new Object[] { "user"/* email */, lowerCaseEmail },
new Object[] { "uh"/* emailHash */, uh }, new Object[] { "mfa"/* ping */, handler.getText() });
response = apiRequest(account, null, null, "us"/* logIn */, new Object[] { "user"/* email */, lowerCaseEmail }, new Object[] { "uh"/* emailHash */, uh }, new Object[] { "mfa"/* ping */, handler.getText() });
} catch (DialogNoAnswerException e2) {
throw Exceptions.addSuppressed(e, e2);
}
@ -797,11 +794,15 @@ public class MegaConz extends PluginForHost {
// https://github.com/meganz/sdk/blob/master/include/mega/types.h
final String error = getError(br);
if ("-6".equals(error)) {
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND, "Too many requests for this resource");
} else if ("-7".equals(error)) {
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND, "Resource access out of range");
} else if ("-8".equals(error)) {
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND, "Resource expired");
} else if ("-9".equals(error)) {
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND, "Resource does not exist");
} else if ("-11".equals(error)) {
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND, "Access denied");
} else if ("-16".equals(error)) {
// file offline, maybe preview is still available
if (getPreviewURL(link) != null) {
@ -818,7 +819,7 @@ public class MegaConz extends PluginForHost {
}
return AvailableStatus.TRUE;
} else {
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND, "Resource administratively blocked");
}
}
checkServerBusy(br.getHttpConnection(), null);
@ -1063,8 +1064,7 @@ public class MegaConz extends PluginForHost {
/**
* MEGA limits can be tricky: They can sit on specific files, on IP ("global limit") or also quota based (also global) e.g. 5GB per day
* per IP or per Free-Account. For these reasons the user can define the max wait time. The wait time given by MEGA must not be true.
* </br>
* 2021-01-21 TODO: Use this for ALL limit based errors
* </br> 2021-01-21 TODO: Use this for ALL limit based errors
*/
private void fileOrIPDownloadlimitReached(final Account account, final String msg, final long waitMilliseconds) throws PluginException {
final long userDefinedMaxWaitMilliseconds = PluginJsonConfig.get(MegaConzConfig.class).getMaxWaittimeOnLimitReachedMinutes() * 60 * 1000;

View File

@ -25,6 +25,24 @@ import java.util.Map;
import javax.swing.JComponent;
import javax.swing.JLabel;
import jd.PluginWrapper;
import jd.gui.swing.components.linkbutton.JLink;
import jd.http.Browser;
import jd.nutils.encoding.Encoding;
import jd.parser.html.Form;
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 org.appwork.storage.JSonMapperException;
import org.appwork.storage.TypeRef;
import org.appwork.swing.MigPanel;
@ -45,24 +63,6 @@ import org.jdownloader.plugins.config.PluginJsonConfig;
import org.jdownloader.plugins.controller.LazyPlugin.FEATURE;
import org.jdownloader.scripting.JavaScriptEngineFactory;
import jd.PluginWrapper;
import jd.gui.swing.components.linkbutton.JLink;
import jd.http.Browser;
import jd.nutils.encoding.Encoding;
import jd.parser.html.Form;
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;
@HostPlugin(revision = "$Revision$", interfaceVersion = 3, names = {}, urls = {})
public class UpToBoxCom extends PluginForHost {
public UpToBoxCom(PluginWrapper wrapper) {
@ -597,13 +597,17 @@ public class UpToBoxCom extends PluginForHost {
throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Hot linking is not allowed on Uptobox", 3 * 60 * 1000l);
} else if (br.containsHTML("(?i)>\\s*This file is temporarily unavailable, please retry")) {
errorFileTemporarilyUnavailable();
} else if (br.containsHTML("id=('|\")ban('|\")")) {
} else if (br.containsHTML("id\\s*=\\s*('|\")ban('|\")")) {
/*
* 2020-06-12: E.g. "<h1>This page is not allowed in the US</h1>",
* "We're sorry but it appears your IP comes from the US so you're not allowed to download or stream.",
* "If you have a premium account, please login to remove the limitation."
*/
throw new PluginException(LinkStatus.ERROR_HOSTER_TEMPORARILY_UNAVAILABLE, "GEO-blocked");
if (account != null) {
throw new AccountUnavailableException("GEO-blocked", 5 * 60 * 1000l);
} else {
throw new PluginException(LinkStatus.ERROR_HOSTER_TEMPORARILY_UNAVAILABLE, "GEO-blocked");
}
}
}

View File

@ -56,5 +56,7 @@ FLV:::464c56.*:::Flv Video:::.((.*\.flv)|(.*\.mp4))
CSO:::4349534f.*:::Compressed ISO Image:::.+\.cso
RMF:::2E524D46.*:::RealMediaFile:::.+\.rmvb
FLAC:::664c6143.*:::FLAC:::.+\.flac
WAV:::52494646[a-f0-9]{8}57415645.*:::WAVE:::.+\.wav
TIF:::(49492a00|4d4d002a).*:::TIFF:::.+\.(tiff|tif)
ISZ:::49735A.*:::ISZ:::.+\.isz
MOV:::0000002066747970.*:::MOV:::.((.*\.mov)|(.*\.flv))