Code improvements

* Throw ContentNotSupportedExceptions when extracting (as was done before)
This commit is contained in:
litetex 2022-08-26 16:52:38 +02:00
parent ff8eb685f3
commit fa57ec08d2
2 changed files with 7 additions and 5 deletions

View File

@ -50,11 +50,9 @@ public class YoutubeOtfDashManifestCreator extends AbstractYoutubeDashManifestCr
// Get all durations and repetitions which are separated by a comma
.split(",");
final int lastIndex = segmentsAndDurationsResponseSplit.length - 1;
if (isBlank(segmentsAndDurationsResponseSplit[lastIndex])) {
segmentDurations = Arrays.copyOf(segmentsAndDurationsResponseSplit, lastIndex);
} else {
segmentDurations = segmentsAndDurationsResponseSplit;
}
segmentDurations = isBlank(segmentsAndDurationsResponseSplit[lastIndex])
? Arrays.copyOf(segmentsAndDurationsResponseSplit, lastIndex)
: segmentsAndDurationsResponseSplit;
} catch (final Exception e) {
throw new DashManifestCreationException("Could not get segment durations", e);
}

View File

@ -523,6 +523,8 @@ public class StreamInfo extends Info {
/* Extract video stream url */
try {
streamInfo.setVideoStreams(extractor.getVideoStreams());
} catch (final ContentNotSupportedException e) {
throw e;
} catch (final Exception e) {
streamInfo.addError(new ExtractionException("Couldn't get video streams", e));
}
@ -530,6 +532,8 @@ public class StreamInfo extends Info {
/* Extract video only stream url */
try {
streamInfo.setVideoOnlyStreams(extractor.getVideoOnlyStreams());
} catch (final ContentNotSupportedException e) {
throw e;
} catch (final Exception e) {
streamInfo.addError(new ExtractionException("Couldn't get video only streams", e));
}