mirror of
https://github.com/mirror/jdownloader.git
synced 2024-11-27 14:00:39 +00:00
*Plugins: Fixes/Changes/Maintenance*
- KernelVideoSharingComV2: removed duplicated code, do not check if a quality is downloadable if only one exists/is left git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@49463 ebf7c1c2-ba36-0410-9fe8-c592906822b4 Former-commit-id: 13ec73275b056642ac296f95f53a00202ab885d2
This commit is contained in:
parent
e820a00aca
commit
58455a83f6
@ -850,7 +850,7 @@ public abstract class KernelVideoSharingComV2 extends antiDDoSForHost {
|
||||
return AvailableStatus.TRUE;
|
||||
} else {
|
||||
this.dllink = this.getDllinkViaAPI(br, link, videoID);
|
||||
if (!isDownload) {
|
||||
if (!isDownload && !link.isSizeSet()) {
|
||||
/* Only check directurl during availablecheck, not if user has started downloading. */
|
||||
URLConnectionAdapter con = null;
|
||||
try {
|
||||
@ -870,7 +870,7 @@ public abstract class KernelVideoSharingComV2 extends antiDDoSForHost {
|
||||
}
|
||||
return AvailableStatus.TRUE;
|
||||
}
|
||||
// Enf of function
|
||||
// End of function
|
||||
}
|
||||
|
||||
protected String getAPIParam1(final String videoID) {
|
||||
@ -1325,6 +1325,7 @@ public abstract class KernelVideoSharingComV2 extends antiDDoSForHost {
|
||||
} else if (videoQualityStr.equalsIgnoreCase("4K")) {
|
||||
videoQuality = 2160;
|
||||
} else if (videoQualityStr.equalsIgnoreCase("HD")) {
|
||||
// Can also be 720p (e.g. love4porn.com)
|
||||
videoQuality = 1080;
|
||||
} else {
|
||||
/* This should never happen */
|
||||
@ -1403,38 +1404,6 @@ public abstract class KernelVideoSharingComV2 extends antiDDoSForHost {
|
||||
/* Skip duplicates */
|
||||
continue;
|
||||
}
|
||||
checkurl: if (!this.isHLS(dllinkTmp)) {
|
||||
URLConnectionAdapter con = null;
|
||||
try {
|
||||
final Browser brc = this.br.cloneBrowser();
|
||||
brc.setFollowRedirects(true);
|
||||
brc.setAllowedResponseCodes(new int[] { 405 });
|
||||
con = openAntiDDoSRequestConnection(brc, brc.createHeadRequest(dllinkTmp));
|
||||
if (this.looksLikeHLS(con)) {
|
||||
logger.info("Found HLS stream instead of expected progressive video stream download");
|
||||
break checkurl;
|
||||
}
|
||||
final String workaroundURL = getHttpServerErrorWorkaroundURL(con);
|
||||
if (workaroundURL != null && !this.looksLikeDownloadableContent(con)) {
|
||||
con.disconnect();
|
||||
con = openAntiDDoSRequestConnection(brc, brc.createHeadRequest(workaroundURL));
|
||||
}
|
||||
if (!this.looksLikeDownloadableContent(con)) {
|
||||
brc.followConnection(true);
|
||||
logger.info("Skipping invalid directurl: " + dllinkTmp);
|
||||
continue;
|
||||
} else {
|
||||
break checkurl;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.log(e);
|
||||
continue;
|
||||
} finally {
|
||||
if (con != null) {
|
||||
con.disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!addQualityURL(this.getDownloadLink(), qualityMap, dllinkTmp)) {
|
||||
if (uncryptedUrlWithoutQualityIndicator == null) {
|
||||
uncryptedUrlWithoutQualityIndicator = dllinkTmp;
|
||||
@ -1765,50 +1734,58 @@ public abstract class KernelVideoSharingComV2 extends antiDDoSForHost {
|
||||
if (DebugMode.TRUE_IN_IDE_ELSE_FALSE) {
|
||||
link.setComment("ChosenQuality: " + chosenQuality + "p");
|
||||
}
|
||||
if (downloadurl != null) {
|
||||
if (chosenQuality == link.getIntegerProperty(PROPERTY_CHOSEN_QUALITY, -1)) {
|
||||
// no need to reevaluate again, chosenQuality is unchanged
|
||||
return downloadurl;
|
||||
} else if (this.isHLS(downloadurl)) {
|
||||
if (downloadurl == null) {
|
||||
return null;
|
||||
}
|
||||
if (chosenQuality == link.getIntegerProperty(PROPERTY_CHOSEN_QUALITY, -1)) {
|
||||
// no need to reevaluate again, chosenQuality is unchanged
|
||||
return downloadurl;
|
||||
} else if (this.isHLS(downloadurl)) {
|
||||
link.setProperty(PROPERTY_CHOSEN_QUALITY, chosenQuality);
|
||||
return downloadurl;
|
||||
} else if (qualityMap.size() == 1) {
|
||||
/* Only one quality available -> No point in checking if that one is valid. */
|
||||
return downloadurl;
|
||||
} else if (this.isHLS(downloadurl)) {
|
||||
/* Do not check HLS URLs */
|
||||
return downloadurl;
|
||||
}
|
||||
/* Check if chosen quality is valid / if link works. */
|
||||
URLConnectionAdapter con = null;
|
||||
try {
|
||||
final Browser brc = br.cloneBrowser();
|
||||
brc.setFollowRedirects(true);
|
||||
brc.setAllowedResponseCodes(new int[] { 405 });
|
||||
con = openAntiDDoSRequestConnection(brc, brc.createHeadRequest(downloadurl));
|
||||
if (this.looksLikeHLS(con)) {
|
||||
brc.followConnection();
|
||||
logger.info("Found HLS stream instead of expected progressive video stream download");
|
||||
link.setProperty(PROPERTY_CHOSEN_QUALITY, chosenQuality);
|
||||
return downloadurl;
|
||||
}
|
||||
URLConnectionAdapter con = null;
|
||||
try {
|
||||
final Browser brc = br.cloneBrowser();
|
||||
brc.setFollowRedirects(true);
|
||||
brc.setAllowedResponseCodes(new int[] { 405 });
|
||||
con = openAntiDDoSRequestConnection(brc, brc.createHeadRequest(downloadurl));
|
||||
if (this.looksLikeHLS(con)) {
|
||||
brc.followConnection();
|
||||
logger.info("Found HLS stream instead of expected progressive video stream download");
|
||||
link.setProperty(PROPERTY_CHOSEN_QUALITY, chosenQuality);
|
||||
return downloadurl;
|
||||
}
|
||||
final String workaroundURL = getHttpServerErrorWorkaroundURL(con);
|
||||
if (workaroundURL != null && !this.looksLikeDownloadableContent(con)) {
|
||||
brc.followConnection(true);
|
||||
con = openAntiDDoSRequestConnection(brc, brc.createHeadRequest(workaroundURL));
|
||||
}
|
||||
if (!this.looksLikeDownloadableContent(con)) {
|
||||
brc.followConnection(true);
|
||||
logger.info("Skipping invalid directurl: " + downloadurl);
|
||||
} else {
|
||||
link.setProperty(PROPERTY_CHOSEN_QUALITY, chosenQuality);
|
||||
return downloadurl;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.log(e);
|
||||
} finally {
|
||||
if (con != null) {
|
||||
con.disconnect();
|
||||
}
|
||||
final String workaroundURL = getHttpServerErrorWorkaroundURL(con);
|
||||
if (workaroundURL != null && !this.looksLikeDownloadableContent(con)) {
|
||||
brc.followConnection(true);
|
||||
con = openAntiDDoSRequestConnection(brc, brc.createHeadRequest(workaroundURL));
|
||||
}
|
||||
if (this.looksLikeDownloadableContent(con)) {
|
||||
link.setProperty(PROPERTY_CHOSEN_QUALITY, chosenQuality);
|
||||
link.setDownloadSize(con.getCompleteContentLength());
|
||||
return downloadurl;
|
||||
}
|
||||
/* Check next URL */
|
||||
brc.followConnection(true);
|
||||
logger.info("Skipping invalid quality: " + chosenQuality + " | directurl: " + downloadurl);
|
||||
} catch (Exception e) {
|
||||
logger.log(e);
|
||||
} finally {
|
||||
if (con != null) {
|
||||
con.disconnect();
|
||||
}
|
||||
final HashMap<Integer, String> nextQualityMap = new HashMap<Integer, String>(qualityMap);
|
||||
nextQualityMap.remove(chosenQuality);
|
||||
return handleQualitySelection(br, link, nextQualityMap);
|
||||
}
|
||||
return null;
|
||||
final HashMap<Integer, String> nextQualityMap = new HashMap<Integer, String>(qualityMap);
|
||||
nextQualityMap.remove(chosenQuality);
|
||||
return handleQualitySelection(br, link, nextQualityMap);
|
||||
}
|
||||
|
||||
/** Checks "/get_file/"-style URLs for validity by "blacklist"-style behavior. */
|
||||
|
Loading…
Reference in New Issue
Block a user