*Plugins: Fixes/Changes/Maintenance*

- EvilangelCore: fixed failing login for websites which do not provide extra json information with "next rebill date" RE forum 96489
- KernelVideoSharingComThepornbangCom: enabled fast linkcheck and set html tag "title" as Packagizer property RE forum 96207
- ZDFMediathekDecrypter: fixed bug in subtitle handling, improved detection of subtitle type RE forum 96485

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

Former-commit-id: 566cd8b16fa7e861025a0fb3702254842c2cc1fa
This commit is contained in:
psp 2024-09-25 07:29:45 +00:00
parent 6708f512b8
commit c8d4b2278e
3 changed files with 53 additions and 22 deletions

View File

@ -632,12 +632,12 @@ public class ZDFMediathekDecrypter extends PluginForDecrypt {
final Object captionsO = JavaScriptEngineFactory.walkJson(player, "captions");
if (captionsO instanceof List && this.subtitlesByLanguage.isEmpty()) {
/* Captions can be available in different versions (languages- and types) */
final List<Object> subtitlesO = (List<Object>) player.get("captions");
for (final Object subtitleO : subtitlesO) {
final Map<String, Object> subInfo = (Map<String, Object>) subtitleO;
final String subtitleType = subInfo.get("class").toString();
final String uri = subInfo.get("uri").toString();
final String subtitleLanguage = subInfo.get("language").toString();
final List<Map<String, Object>> subtitles = (List<Map<String, Object>>) player.get("captions");
for (final Map<String, Object> subinfo : subtitles) {
final String subtitleType = subinfo.get("class").toString();
final String uri = subinfo.get("uri").toString();
final String subtitleLanguage = subinfo.get("language").toString();
final String format = (String) subinfo.get("format");
/* E.g. "ebu-tt-d-basic-de" or "webvtt" */
// final String format = (String) subInfo.get("format");
/* Skip unsupported formats */
@ -656,9 +656,9 @@ public class ZDFMediathekDecrypter extends PluginForDecrypt {
subtitlesVTT = new HashMap<String, String>();
subtitlesThisLanguage.put("vtt", subtitlesVTT);
}
if (uri.toLowerCase(Locale.ENGLISH).endsWith(".xml")) {
if (uri.toLowerCase(Locale.ENGLISH).endsWith(".xml") || StringUtils.equalsIgnoreCase(format, "ebu-tt-d-basic-de")) {
subtitlesXML.put(subtitleType, uri);
} else if (uri.toLowerCase(Locale.ENGLISH).endsWith(".vtt")) {
} else if (uri.toLowerCase(Locale.ENGLISH).endsWith(".vtt") || StringUtils.equalsIgnoreCase(format, "webvtt")) {
subtitlesVTT.put(subtitleType, uri);
} else {
logger.info("Detected unsupported subtitle-format: " + uri);
@ -829,10 +829,10 @@ public class ZDFMediathekDecrypter extends PluginForDecrypt {
if (duration > 0 && hlscontainer.getBandwidth() > 0) {
dl.setDownloadSize(duration / 1000 * hlscontainer.getBandwidth() / 8);
}
dl.setProperty(ZdfDeMediathek.PROPERTY_language, language);
final String qualitySelectorString = generateQualitySelectorString(protocol, ext, Integer.toString(hlscontainer.getHeight()), language, audio_class);
all_found_downloadlinks.put(qualitySelectorString, dl);
addDownloadLinkAndGenerateSubtitleDownloadLink(allDownloadLinks, dl);
dl.setProperty(ZdfDeMediathek.PROPERTY_language, language);
if (containsQuality(selectedQualityStrings, qualitySelectorString)) {
userSelectedQualitiesTmp.add(dl);
selectedQualitiesMapTmp.put(qualitySelectorString, dl);

View File

@ -87,7 +87,7 @@ public abstract class EvilangelCore extends PluginForHost {
protected Browser prepBrowser(final Browser br) {
/* Define custom browser headers and language settings */
br.setCookie(this.getHost(), "enterSite", "en");
br.setCookie(getHost(), "enterSite", "en");
br.setFollowRedirects(true);
return br;
}
@ -904,18 +904,29 @@ public abstract class EvilangelCore extends PluginForHost {
if (!StringUtils.isEmpty(expirationDate)) {
ai.setValidUntil(TimeFormatter.getMilliSeconds(expirationDate + " 23:59:59", "yyyy-MM-dd HH:mm:ss", Locale.ENGLISH), br);
}
if (account.getType() == AccountType.PREMIUM) {
final Browser brc = br.cloneBrowser();
brc.getHeaders().put("Accept", "application/json, text/plain, */*");
brc.getHeaders().put("Referer", "https://" + br.getHost(true) + "/en/payment-info");
brc.getHeaders().put("x-requested-with", "XMLHttpRequest");
brc.getPage("/membership/info");
final Map<String, Object> additionalinfo = restoreFromString(brc.getRequest().getHtmlCode(), TypeRef.MAP);
final String nextRebillDate = (String) additionalinfo.get("nextRebillDate");
if (!StringUtils.isEmpty(nextRebillDate)) {
ai.setValidUntil(TimeFormatter.getMilliSeconds(nextRebillDate + " 23:59:59", "yyyy-MM-dd HH:mm:ss", Locale.ENGLISH), br);
} else {
logger.warning("Failed to find nextRebillDate");
if (account.getType() == AccountType.PREMIUM && StringUtils.isEmpty(expirationDate)) {
/**
* Use next rebill date as expire date. Doesn't work for all websites. <br>
* Examples: <br>
* Working for: filthykings.com <br>
* Not working for: dfxtra.com
*/
try {
final Browser brc = br.cloneBrowser();
brc.getHeaders().put("Accept", "application/json, text/plain, */*");
brc.getHeaders().put("Referer", "https://" + br.getHost(true) + "/en/payment-info");
brc.getHeaders().put("x-requested-with", "XMLHttpRequest");
brc.getPage("/membership/info");
final Map<String, Object> additionalinfo = restoreFromString(brc.getRequest().getHtmlCode(), TypeRef.MAP);
final String nextRebillDate = (String) additionalinfo.get("nextRebillDate");
if (!StringUtils.isEmpty(nextRebillDate)) {
ai.setValidUntil(TimeFormatter.getMilliSeconds(nextRebillDate + " 23:59:59", "yyyy-MM-dd HH:mm:ss", Locale.ENGLISH), br);
} else {
logger.warning("Failed to find nextRebillDate");
}
} catch (final Throwable e) {
logger.log(e);
logger.info("Failed to find additional expire date information");
}
}
return ai;

View File

@ -22,6 +22,10 @@ import org.jdownloader.plugins.components.config.KVSConfig;
import org.jdownloader.plugins.components.config.KVSConfigThepornbangCom;
import jd.PluginWrapper;
import jd.nutils.encoding.Encoding;
import jd.plugins.Account;
import jd.plugins.DownloadLink;
import jd.plugins.DownloadLink.AvailableStatus;
import jd.plugins.HostPlugin;
@HostPlugin(revision = "$Revision$", interfaceVersion = 3, names = {}, urls = {})
@ -73,8 +77,24 @@ public class KernelVideoSharingComThepornbangCom extends KernelVideoSharingComV2
return true;
}
@Override
protected AvailableStatus requestFileInformationWebsite(final DownloadLink link, final Account account, final boolean isDownload) throws Exception {
final AvailableStatus status = super.requestFileInformationWebsite(link, account, isDownload);
final String htmlTitleTag = br.getRegex("<title>([^<]+)").getMatch(0);
if (htmlTitleTag != null) {
link.setProperty("title", Encoding.htmlDecode(htmlTitleTag).trim());
}
return status;
}
@Override
public Class<? extends KVSConfig> getConfigInterface() {
return KVSConfigThepornbangCom.class;
}
@Override
protected boolean enableFastLinkcheck() {
/* 2024-09-25: Experiment to counter problems reported here: https://board.jdownloader.org/showthread.php?t=96207 */
return true;
}
}