mirror of
https://github.com/mirror/jdownloader.git
synced 2024-11-23 12:09:43 +00:00
AdvancedConfigManager:
-fixed initialization race condition with HosterRuleController YoutubeHelper: -added applyReplacer method -fixes post 538188 -refs post 538187 LinkCrawlerRetry: -updated getHost to make use of LinkCrawler.cleanURL EvilangelCore: -updated pattern to allow % for urlencoded chars -updated getURLTitle to urldecode -fixes #WVPG4454-FGLJ-5570NVOY GenericHTTPDirectoryIndexCrawler: -added support for AuthenticationController.buildAuthenticationFactories -fixes #ZULZ9282-UNED-7292NJXY git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@49586 ebf7c1c2-ba36-0410-9fe8-c592906822b4 Former-commit-id: bff38a5802bd18a600d7ce3903b030e6ba8abd4d
This commit is contained in:
parent
a01f5e396f
commit
763abfe8f3
@ -1717,6 +1717,7 @@ public class LinkCrawler {
|
||||
if ((con.getResponseCode() == 401 || con.getResponseCode() == 403) && con.getHeaderField(HTTPConstants.HEADER_RESPONSE_WWW_AUTHENTICATE) != null) {
|
||||
/* Invalid or missing auth */
|
||||
br.followConnection(true);
|
||||
req.resetConnection();
|
||||
con = null;
|
||||
continue authloop;
|
||||
} else {
|
||||
@ -4190,7 +4191,7 @@ public class LinkCrawler {
|
||||
if (directoryContent != null && directoryContent.size() > 0) {
|
||||
/* Let http directory crawler process this link. */
|
||||
final ArrayList<CrawledLink> ret = new ArrayList<CrawledLink>();
|
||||
ret.add(lc.crawledLinkFactorybyURL("jd://directoryindex://" + br._getURL().toExternalForm()));
|
||||
ret.add(lc.crawledLinkFactorybyURL("jd://directoryindex://" + br._getURL(true).toExternalForm()));
|
||||
return ret;
|
||||
}
|
||||
} catch (final Throwable e) {
|
||||
|
@ -20,15 +20,11 @@ import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.appwork.utils.Regex;
|
||||
import org.appwork.utils.StringUtils;
|
||||
import org.appwork.utils.formatter.SizeFormatter;
|
||||
import org.jdownloader.plugins.components.abstractGenericHTTPDirectoryIndexCrawler;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
import java.util.List;
|
||||
|
||||
import jd.PluginWrapper;
|
||||
import jd.controlling.ProgressController;
|
||||
import jd.http.AuthenticationFactory;
|
||||
import jd.http.Browser;
|
||||
import jd.http.URLConnectionAdapter;
|
||||
import jd.http.requests.GetRequest;
|
||||
@ -36,12 +32,21 @@ import jd.nutils.encoding.Encoding;
|
||||
import jd.plugins.CryptedLink;
|
||||
import jd.plugins.DecrypterPlugin;
|
||||
import jd.plugins.DecrypterRetryException;
|
||||
import jd.plugins.DecrypterRetryException.RetryReason;
|
||||
import jd.plugins.DownloadLink;
|
||||
import jd.plugins.FilePackage;
|
||||
import jd.plugins.LinkStatus;
|
||||
import jd.plugins.PluginException;
|
||||
import jd.plugins.hoster.DirectHTTP;
|
||||
|
||||
import org.appwork.net.protocol.http.HTTPConstants;
|
||||
import org.appwork.utils.Regex;
|
||||
import org.appwork.utils.StringUtils;
|
||||
import org.appwork.utils.formatter.SizeFormatter;
|
||||
import org.jdownloader.auth.AuthenticationController;
|
||||
import org.jdownloader.plugins.components.abstractGenericHTTPDirectoryIndexCrawler;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
|
||||
@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 3, names = { "HTTPDirectoryCrawler" }, urls = { "jd://directoryindex://.+" })
|
||||
public class GenericHTTPDirectoryIndexCrawler extends abstractGenericHTTPDirectoryIndexCrawler {
|
||||
private enum DirectoryListingMode {
|
||||
@ -73,15 +78,29 @@ public class GenericHTTPDirectoryIndexCrawler extends abstractGenericHTTPDirecto
|
||||
}
|
||||
|
||||
protected ArrayList<DownloadLink> crawlHTTPDirectory(final CryptedLink param) throws IOException, PluginException, DecrypterRetryException {
|
||||
/* First check if maybe the user has added a directURL. */
|
||||
// TODO: Add authentication handling see jd.plugins.decrypter.LinkCrawlerDeepHelper
|
||||
final String url = param.getCryptedUrl().replaceFirst("(?i)^jd://directoryindex://", "");
|
||||
final GetRequest getRequest = br.createGetRequest(url);
|
||||
final URLConnectionAdapter con = this.br.openRequestConnection(getRequest);
|
||||
final GetRequest request = br.createGetRequest(url);
|
||||
final List<AuthenticationFactory> authenticationFactories = AuthenticationController.getInstance().buildAuthenticationFactories(request.getURL(), null);
|
||||
URLConnectionAdapter con = null;
|
||||
try {
|
||||
for (final AuthenticationFactory authenticationFactory : authenticationFactories) {
|
||||
br.setCustomAuthenticationFactory(authenticationFactory);
|
||||
con = br.openRequestConnection(request);
|
||||
if (looksLikeDownloadableContent(con)) {
|
||||
break;
|
||||
} else if ((con.getResponseCode() == 401 || con.getResponseCode() == 403) && con.getHeaderField(HTTPConstants.HEADER_RESPONSE_WWW_AUTHENTICATE) != null) {
|
||||
/* Invalid or missing auth */
|
||||
br.followConnection(true);
|
||||
request.resetConnection();
|
||||
continue;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (this.looksLikeDownloadableContent(con)) {
|
||||
/* First check if maybe the user has added a directURL. */
|
||||
final ArrayList<DownloadLink> ret = new ArrayList<DownloadLink>();
|
||||
final DownloadLink direct = getCrawler().createDirectHTTPDownloadLink(getRequest, con);
|
||||
final DownloadLink direct = getCrawler().createDirectHTTPDownloadLink(request, con);
|
||||
final String pathToFile = getCurrentDirectoryPath(url);
|
||||
/* Set relative path if one is available. */
|
||||
if (pathToFile.contains("/")) {
|
||||
@ -92,7 +111,10 @@ public class GenericHTTPDirectoryIndexCrawler extends abstractGenericHTTPDirecto
|
||||
return ret;
|
||||
} else {
|
||||
br.followConnection();
|
||||
if (br.getHttpConnection().getResponseCode() == 404) {
|
||||
con = br.getHttpConnection();
|
||||
if ((con.getResponseCode() == 401 || con.getResponseCode() == 403) && con.getHeaderField(HTTPConstants.HEADER_RESPONSE_WWW_AUTHENTICATE) != null) {
|
||||
throw new DecrypterRetryException(RetryReason.PASSWORD);
|
||||
} else if (con.getResponseCode() == 404) {
|
||||
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
|
||||
} else if (!con.isOK()) {
|
||||
/* E.g. response 403 */
|
||||
|
@ -84,7 +84,6 @@ import org.jdownloader.plugins.components.youtube.YoutubeConfig.IfUrlisAPlaylist
|
||||
import org.jdownloader.plugins.components.youtube.YoutubeConfig.IfUrlisAVideoAndPlaylistAction;
|
||||
import org.jdownloader.plugins.components.youtube.YoutubeConfig.ProfileCrawlMode;
|
||||
import org.jdownloader.plugins.components.youtube.YoutubeHelper;
|
||||
import org.jdownloader.plugins.components.youtube.YoutubeReplacer;
|
||||
import org.jdownloader.plugins.components.youtube.YoutubeStreamData;
|
||||
import org.jdownloader.plugins.components.youtube.configpanel.AbstractVariantWrapper;
|
||||
import org.jdownloader.plugins.components.youtube.configpanel.YoutubeVariantCollection;
|
||||
@ -608,10 +607,7 @@ public class TbCmV2 extends PluginForDecrypt {
|
||||
channelOrPlaylistPackage.setAllowMerge(true);
|
||||
final DownloadLink dummy = this.createDownloadlink("ytdummy");
|
||||
dummy.setProperties(globalPropertiesForDownloadLink);
|
||||
String formattedPackagename = channelOrPlaylistPackageNamePattern;
|
||||
for (YoutubeReplacer r : YoutubeHelper.REPLACER) {
|
||||
formattedPackagename = r.replace(formattedPackagename, this.helper, dummy);
|
||||
}
|
||||
String formattedPackagename = YoutubeHelper.applyReplacer(channelOrPlaylistPackageNamePattern, helper, dummy);
|
||||
if (!StringUtils.isEmpty(formattedPackagename)) {
|
||||
/* Formatted result is valid -> Use it */
|
||||
channelOrPlaylistPackage.setName(formattedPackagename);
|
||||
|
@ -26,20 +26,6 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.appwork.storage.TypeRef;
|
||||
import org.appwork.utils.StringUtils;
|
||||
import org.appwork.utils.formatter.SizeFormatter;
|
||||
import org.appwork.utils.formatter.TimeFormatter;
|
||||
import org.appwork.utils.parser.UrlQuery;
|
||||
import org.jdownloader.captcha.v2.challenge.recaptcha.v2.CaptchaHelperHostPluginRecaptchaV2;
|
||||
import org.jdownloader.downloader.hls.HLSDownloader;
|
||||
import org.jdownloader.gui.translate._GUI;
|
||||
import org.jdownloader.plugins.components.config.EvilangelComConfig.Quality;
|
||||
import org.jdownloader.plugins.components.config.EvilangelCoreConfig;
|
||||
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.http.Browser;
|
||||
@ -62,6 +48,21 @@ import jd.plugins.LinkStatus;
|
||||
import jd.plugins.PluginException;
|
||||
import jd.plugins.PluginForHost;
|
||||
|
||||
import org.appwork.storage.TypeRef;
|
||||
import org.appwork.utils.StringUtils;
|
||||
import org.appwork.utils.encoding.URLEncode;
|
||||
import org.appwork.utils.formatter.SizeFormatter;
|
||||
import org.appwork.utils.formatter.TimeFormatter;
|
||||
import org.appwork.utils.parser.UrlQuery;
|
||||
import org.jdownloader.captcha.v2.challenge.recaptcha.v2.CaptchaHelperHostPluginRecaptchaV2;
|
||||
import org.jdownloader.downloader.hls.HLSDownloader;
|
||||
import org.jdownloader.gui.translate._GUI;
|
||||
import org.jdownloader.plugins.components.config.EvilangelComConfig.Quality;
|
||||
import org.jdownloader.plugins.components.config.EvilangelCoreConfig;
|
||||
import org.jdownloader.plugins.config.PluginJsonConfig;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
import org.jdownloader.scripting.JavaScriptEngineFactory;
|
||||
|
||||
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = {}, urls = {})
|
||||
public abstract class EvilangelCore extends PluginForHost {
|
||||
public EvilangelCore(PluginWrapper wrapper) {
|
||||
@ -113,10 +114,10 @@ public abstract class EvilangelCore extends PluginForHost {
|
||||
|
||||
private String dllink = null;
|
||||
@Deprecated
|
||||
private final String URL_EVILANGEL_FILM = "(?i)https?://members\\.evilangel.com/[a-z]{2}/([A-Za-z0-9\\-_]+)/film/(\\d+)";
|
||||
private final String URL_EVILANGEL_FILM = "(?i)https?://members\\.evilangel.com/[a-z]{2}/([A-Za-z0-9\\-_%]+)/film/(\\d+)";
|
||||
@Deprecated
|
||||
private final String URL_EVILANGEL_FREE_TRAILER = "(?i)https?://(?:www\\.)?evilangel\\.com/[a-z]{2}/video/([A-Za-z0-9\\-]+)/(\\d+)";
|
||||
private final String URL_VIDEO = "(?i)https?://[^/]+/[a-z]{2}/(?:video|movie)/([A-Za-z0-9\\-_]+)(?:/([A-Za-z0-9\\-_]+))?/(\\d+)";
|
||||
private final String URL_EVILANGEL_FREE_TRAILER = "(?i)https?://(?:www\\.)?evilangel\\.com/[a-z]{2}/video/([A-Za-z0-9\\-_%]+)/(\\d+)";
|
||||
private final String URL_VIDEO = "(?i)https?://[^/]+/[a-z]{2}/(?:video|movie)/([A-Za-z0-9\\-_%]+)(?:/([A-Za-z0-9\\-_%]+))?/(\\d+)";
|
||||
private final String PROPERTY_ACTORS = "actors";
|
||||
private final String PROPERTY_DATE = "date";
|
||||
private final String PROPERTY_QUALITY = "quality";
|
||||
@ -127,7 +128,7 @@ public abstract class EvilangelCore extends PluginForHost {
|
||||
final List<String> ret = new ArrayList<String>();
|
||||
for (final String[] domains : pluginDomains) {
|
||||
/* Default regex for most of all supported websites. */
|
||||
ret.add("https?://(?:(?:www|members)\\.)?" + buildHostsPatternPart(domains) + "/[a-z]{2}/(?:movie|video)/[A-Za-z0-9\\-_]+(?:/[A-Za-z0-9\\-_]+)?/\\d+");
|
||||
ret.add("https?://(?:(?:www|members)\\.)?" + buildHostsPatternPart(domains) + "/[a-z]{2}/(?:movie|video)/[A-Za-z0-9\\-_%]+(?:/[A-Za-z0-9\\-_%]+)?/\\d+");
|
||||
}
|
||||
return ret.toArray(new String[0]);
|
||||
}
|
||||
@ -265,8 +266,7 @@ public abstract class EvilangelCore extends PluginForHost {
|
||||
List<Map<String, Object>> qualitiesList = null;
|
||||
if (htmlVideoJson == null && htmlVideoJson2 == null) {
|
||||
/**
|
||||
* 2023-04-19: New (tested with: evilangel.com) </br>
|
||||
* TODO: Test this with other supported websites such as wicked.com.
|
||||
* 2023-04-19: New (tested with: evilangel.com) </br> TODO: Test this with other supported websites such as wicked.com.
|
||||
*/
|
||||
final Browser brc = br.cloneBrowser();
|
||||
brc.getHeaders().put("X-Requested-With", "XMLHttpRequest");
|
||||
@ -366,8 +366,8 @@ public abstract class EvilangelCore extends PluginForHost {
|
||||
}
|
||||
}
|
||||
/**
|
||||
* A scene can also contain DVD-information. </br>
|
||||
* --> Ensure to set the correct information which is later used for filenames.
|
||||
* A scene can also contain DVD-information. </br> --> Ensure to set the correct information which is later used for
|
||||
* filenames.
|
||||
*/
|
||||
final Map<String, Object> movieInfos = (Map<String, Object>) root.get("movieInfos");
|
||||
if (movieInfos != null) {
|
||||
@ -627,24 +627,26 @@ public abstract class EvilangelCore extends PluginForHost {
|
||||
}
|
||||
|
||||
protected String getURLTitle(final DownloadLink link) {
|
||||
final String ret;
|
||||
if (link.getPluginPatternMatcher().matches(URL_EVILANGEL_FILM)) {
|
||||
return new Regex(link.getPluginPatternMatcher(), URL_EVILANGEL_FILM).getMatch(0);
|
||||
ret = new Regex(link.getPluginPatternMatcher(), URL_EVILANGEL_FILM).getMatch(0);
|
||||
} else if (link.getPluginPatternMatcher().matches(URL_EVILANGEL_FREE_TRAILER)) {
|
||||
return new Regex(link.getPluginPatternMatcher(), URL_EVILANGEL_FREE_TRAILER).getMatch(0);
|
||||
ret = new Regex(link.getPluginPatternMatcher(), URL_EVILANGEL_FREE_TRAILER).getMatch(0);
|
||||
} else if (link.getPluginPatternMatcher().matches(URL_VIDEO)) {
|
||||
final Regex urlinfo = new Regex(link.getPluginPatternMatcher(), URL_VIDEO);
|
||||
/* Sometimes author/studio + title is given and sometimes title(=param1) only. */
|
||||
final String param1 = urlinfo.getMatch(0);
|
||||
final String param2 = urlinfo.getMatch(1);
|
||||
if (param1 != null && param2 != null) {
|
||||
return param1 + "_" + param2;
|
||||
ret = param1 + "_" + param2;
|
||||
} else {
|
||||
return param1;
|
||||
ret = param1;
|
||||
}
|
||||
} else {
|
||||
logger.warning("!Developer mistake! Unsupported URL!");
|
||||
return null;
|
||||
}
|
||||
return URLEncode.decodeURIComponent(ret);
|
||||
}
|
||||
|
||||
private String getQualityFilesizeMapping(final String str) {
|
||||
@ -768,8 +770,8 @@ public abstract class EvilangelCore extends PluginForHost {
|
||||
}
|
||||
login.remove("submit");
|
||||
/**
|
||||
* 2021-09-01: Form may contain "rememberme" two times with value "0" AND "1"! Same via browser! </br>
|
||||
* Only add "rememberme": "1" if that is not already present in our form.
|
||||
* 2021-09-01: Form may contain "rememberme" two times with value "0" AND "1"! Same via browser! </br> Only add "rememberme":
|
||||
* "1" if that is not already present in our form.
|
||||
*/
|
||||
final String remembermeCookieKey = "rememberme";
|
||||
boolean containsRemembermeFieldWithValue1 = false;
|
||||
@ -875,8 +877,8 @@ public abstract class EvilangelCore extends PluginForHost {
|
||||
account.setUser(username);
|
||||
}
|
||||
/**
|
||||
* TODO: Add support for "scheduledCancelDate" whenever a test account with such a date is available. </br>
|
||||
* "scheduledCancelDate" can also be a Boolean!
|
||||
* TODO: Add support for "scheduledCancelDate" whenever a test account with such a date is available. </br> "scheduledCancelDate"
|
||||
* can also be a Boolean!
|
||||
*/
|
||||
if (Boolean.TRUE.equals(user.get("isExpired"))) {
|
||||
ai.setExpired(true);
|
||||
|
@ -15,6 +15,7 @@ import jd.controlling.linkcollector.LinkCollector;
|
||||
import jd.controlling.linkcollector.LinkCollector.JobLinkCrawler;
|
||||
import jd.controlling.linkcollector.LinkOrigin;
|
||||
import jd.controlling.linkcrawler.CrawledLink;
|
||||
import jd.controlling.linkcrawler.LinkCrawler;
|
||||
import jd.http.Browser;
|
||||
import jd.plugins.Account;
|
||||
import jd.plugins.DownloadLink;
|
||||
@ -47,7 +48,11 @@ public class LinkCrawlerRetry extends PluginForHost {
|
||||
@Override
|
||||
public String getHost(DownloadLink link, Account account, boolean includeSubdomain) {
|
||||
if (link != null) {
|
||||
return Browser.getHost(link.getPluginPatternMatcher(), includeSubdomain);
|
||||
String url = LinkCrawler.cleanURL(link.getPluginPatternMatcher());
|
||||
if (url == null) {
|
||||
url = link.getPluginPatternMatcher();
|
||||
}
|
||||
return Browser.getHost(url, includeSubdomain);
|
||||
} else {
|
||||
return getHost();
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.script.ScriptEngine;
|
||||
@ -175,7 +176,7 @@ public class YoutubeHelper {
|
||||
return logger;
|
||||
}
|
||||
|
||||
private String base;
|
||||
private String base;
|
||||
// private List<YoutubeBasicVariant> variants;
|
||||
// public List<YoutubeBasicVariant> getVariants() {
|
||||
// return variants;
|
||||
@ -184,7 +185,60 @@ public class YoutubeHelper {
|
||||
// public Map<String, YoutubeBasicVariant> getVariantsMap() {
|
||||
// return variantsMap;
|
||||
// }
|
||||
public static final List<YoutubeReplacer> REPLACER = new ArrayList<YoutubeReplacer>();
|
||||
private static final Map<String, YoutubeReplacer> REPLACER_MAP = new HashMap<String, YoutubeReplacer>();
|
||||
public static final List<YoutubeReplacer> REPLACER = new ArrayList<YoutubeReplacer>() {
|
||||
@Override
|
||||
public boolean add(final YoutubeReplacer e) {
|
||||
for (final String tag : e.getTags()) {
|
||||
if (REPLACER_MAP.put(tag, e) != null) {
|
||||
if (DebugMode.TRUE_IN_IDE_ELSE_FALSE) {
|
||||
throw new WTFException("Duplicate error:" + tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.add(e);
|
||||
};
|
||||
};
|
||||
|
||||
public static String applyReplacer(String name, YoutubeHelper helper, DownloadLink link) {
|
||||
final Matcher tagMatcher = Pattern.compile("(?i)([A-Z0-9\\_]+)(\\[[^\\]]*\\])?").matcher("");
|
||||
final Matcher tagsMatcher = Pattern.compile("\\*([^\\*]*)\\*").matcher(name);
|
||||
if (!tagsMatcher.find()) {
|
||||
return name;
|
||||
} else {
|
||||
final StringBuffer sb = new StringBuffer();
|
||||
do {
|
||||
final String tagSection = tagsMatcher.group(1);
|
||||
String replacement = null;
|
||||
tagMatcher.reset(tagSection);
|
||||
replacerLookup: while (tagMatcher.find()) {
|
||||
final String tagID = tagMatcher.group(1);
|
||||
YoutubeReplacer replacer = REPLACER_MAP.get(tagID);
|
||||
if (replacer == null) {
|
||||
replacer = REPLACER_MAP.get(tagID.toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
if (replacer != null) {
|
||||
final String completeTag = tagMatcher.group(0);
|
||||
final String replaced = replacer.replace("*" + completeTag + "*", helper, link);
|
||||
if (StringUtils.isNotEmpty(replaced)) {
|
||||
replacement = tagSection.replace(completeTag, replaced);
|
||||
} else {
|
||||
replacement = "";
|
||||
}
|
||||
break replacerLookup;
|
||||
}
|
||||
}
|
||||
if (replacement == null) {
|
||||
// keep tags with no assigned REPLACER
|
||||
replacement = Matcher.quoteReplacement(tagsMatcher.group(0));
|
||||
}
|
||||
tagsMatcher.appendReplacement(sb, replacement);
|
||||
} while (tagsMatcher.find());
|
||||
tagsMatcher.appendTail(sb);
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
REPLACER.add(new YoutubeReplacer("GROUP") {
|
||||
@Override
|
||||
@ -1182,33 +1236,33 @@ public class YoutubeHelper {
|
||||
}
|
||||
});
|
||||
}
|
||||
public static final String YT_TITLE = "YT_TITLE";
|
||||
public static final String YT_TITLE_ALTERNATIVE = "YT_TITLE_ALTERNATIVE";
|
||||
public static final String YT_CATEGORY = "YT_CATEGORY";
|
||||
public static final String YT_ID = "YT_ID";
|
||||
public static final String YT_CHAPTERS = "YT_CHAPTERS";
|
||||
public static final String YT_CHANNEL_TITLE = "YT_CHANNEL";
|
||||
public static final String YT_CHANNEL_TITLE_ALTERNATIVE = "YT_CHANNEL_ALTERNATIVE";
|
||||
public static final String YT_DATE = "YT_DATE";
|
||||
public static final String YT_VARIANTS = "YT_VARIANTS";
|
||||
public static final String YT_VARIANT = "YT_VARIANT";
|
||||
public static final String YT_TITLE = "YT_TITLE";
|
||||
public static final String YT_TITLE_ALTERNATIVE = "YT_TITLE_ALTERNATIVE";
|
||||
public static final String YT_CATEGORY = "YT_CATEGORY";
|
||||
public static final String YT_ID = "YT_ID";
|
||||
public static final String YT_CHAPTERS = "YT_CHAPTERS";
|
||||
public static final String YT_CHANNEL_TITLE = "YT_CHANNEL";
|
||||
public static final String YT_CHANNEL_TITLE_ALTERNATIVE = "YT_CHANNEL_ALTERNATIVE";
|
||||
public static final String YT_DATE = "YT_DATE";
|
||||
public static final String YT_VARIANTS = "YT_VARIANTS";
|
||||
public static final String YT_VARIANT = "YT_VARIANT";
|
||||
/**
|
||||
* @deprecated use {@link #YT_VARIANT_INFO}
|
||||
*/
|
||||
public static final String YT_STREAMURL_VIDEO = "YT_STREAMURL_VIDEO";
|
||||
public static final String YT_STREAMURL_VIDEO = "YT_STREAMURL_VIDEO";
|
||||
/**
|
||||
* @deprecated use {@link #YT_VARIANT_INFO}
|
||||
*/
|
||||
public static final String YT_STREAMURL_AUDIO = "YT_STREAMURL_AUDIO";
|
||||
public static final String YT_STREAMURL_AUDIO = "YT_STREAMURL_AUDIO";
|
||||
/**
|
||||
* @deprecated use {@link #YT_VARIANT_INFO}
|
||||
*/
|
||||
public static final String YT_STREAMURL_VIDEO_SEGMENTS = "YT_STREAMURL_VIDEO_SEGMENTS";
|
||||
public static final String YT_STREAMURL_VIDEO_SEGMENTS = "YT_STREAMURL_VIDEO_SEGMENTS";
|
||||
/**
|
||||
* @deprecated use {@link #YT_VARIANT_INFO}
|
||||
*/
|
||||
public static final String YT_STREAMURL_AUDIO_SEGMENTS = "YT_STREAMURL_AUDIO_SEGMENTS";
|
||||
private static final String REGEX_HLSMPD_FROM_JSPLAYER_SETUP = "\"hlsvp\"\\s*:\\s*(\".*?\")";
|
||||
public static final String YT_STREAMURL_AUDIO_SEGMENTS = "YT_STREAMURL_AUDIO_SEGMENTS";
|
||||
private static final String REGEX_HLSMPD_FROM_JSPLAYER_SETUP = "\"hlsvp\"\\s*:\\s*(\".*?\")";
|
||||
|
||||
private static String handleRule(String s, final String line) throws PluginException {
|
||||
final String method = new Regex(line, "\\.([\\w\\d]+?)\\(\\s*\\)").getMatch(0);
|
||||
@ -3482,11 +3536,11 @@ public class YoutubeHelper {
|
||||
AbstractVariant variant = AbstractVariant.get(link);
|
||||
String formattedFilename = variant.getFileNamePattern();
|
||||
// validate the pattern
|
||||
if (!formattedFilename.toLowerCase(Locale.ENGLISH).contains("*ext*")) {
|
||||
if (formattedFilename != null && !formattedFilename.toLowerCase(Locale.ENGLISH).matches(".*\\*[^\\*]*ext[^\\*]*\\*.*")) {
|
||||
formattedFilename = null;
|
||||
}
|
||||
if (formattedFilename == null || formattedFilename.equals("")) {
|
||||
formattedFilename = "*videoname* (*quality*) *ext*";
|
||||
formattedFilename = "*VIDEONAME* (*QUALITY*).*EXT*";
|
||||
}
|
||||
formattedFilename = replaceVariables(link, formattedFilename);
|
||||
final String playlistID = link.getStringProperty(YoutubeHelper.YT_PLAYLIST_ID);
|
||||
@ -3502,19 +3556,17 @@ public class YoutubeHelper {
|
||||
if (logger == null) {
|
||||
logger = Log.DF;
|
||||
}
|
||||
AbstractVariant variant = AbstractVariant.get(link);
|
||||
final AbstractVariant variant = AbstractVariant.get(link);
|
||||
try {
|
||||
formattedFilename = variant.modifyFileName(formattedFilename, link);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
for (YoutubeReplacer r : REPLACER) {
|
||||
formattedFilename = r.replace(formattedFilename, this, link);
|
||||
logger.log(e);
|
||||
}
|
||||
formattedFilename = YoutubeHelper.applyReplacer(formattedFilename, this, link);
|
||||
try {
|
||||
formattedFilename = variant.modifyFileName(formattedFilename, link);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
logger.log(e);
|
||||
}
|
||||
return formattedFilename;
|
||||
}
|
||||
|
@ -7,6 +7,11 @@ import java.util.Set;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
import jd.controlling.downloadcontroller.DownloadControllerConfig;
|
||||
import jd.controlling.faviconcontroller.FavIconsConfig;
|
||||
import jd.controlling.linkchecker.LinkCheckerConfig;
|
||||
import jd.controlling.linkcrawler.LinkCrawlerConfig;
|
||||
|
||||
import org.appwork.storage.StorableValidatorIgnoresMissingSetter;
|
||||
import org.appwork.storage.config.ConfigInterface;
|
||||
import org.appwork.storage.config.JsonConfig;
|
||||
@ -50,13 +55,13 @@ import org.jdownloader.updatev2.LastChanceSettings;
|
||||
import org.jdownloader.updatev2.UpdateSettings;
|
||||
import org.jdownloader.updatev2.gui.LAFOptions;
|
||||
|
||||
import jd.controlling.downloadcontroller.DownloadControllerConfig;
|
||||
import jd.controlling.faviconcontroller.FavIconsConfig;
|
||||
import jd.controlling.linkchecker.LinkCheckerConfig;
|
||||
import jd.controlling.linkcrawler.LinkCrawlerConfig;
|
||||
|
||||
public class AdvancedConfigManager {
|
||||
private static final AdvancedConfigManager INSTANCE = new AdvancedConfigManager();
|
||||
private static final AdvancedConfigManager INSTANCE;
|
||||
static {
|
||||
INSTANCE = new AdvancedConfigManager();
|
||||
// does access AdvancedConfigManager.getInstance
|
||||
HosterRuleController.getInstance();// ensure HosterRuleController has been registered in AdvancedConfigManager
|
||||
}
|
||||
|
||||
public static AdvancedConfigManager getInstance() {
|
||||
return AdvancedConfigManager.INSTANCE;
|
||||
@ -103,7 +108,6 @@ public class AdvancedConfigManager {
|
||||
logger.log(e);
|
||||
}
|
||||
}
|
||||
HosterRuleController.getInstance();// ensure HosterRuleController has been registered in AdvancedConfigManager
|
||||
}
|
||||
|
||||
public AdvancedConfigEventSender getEventSender() {
|
||||
|
Loading…
Reference in New Issue
Block a user