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 // Get all durations and repetitions which are separated by a comma
.split(","); .split(",");
final int lastIndex = segmentsAndDurationsResponseSplit.length - 1; final int lastIndex = segmentsAndDurationsResponseSplit.length - 1;
if (isBlank(segmentsAndDurationsResponseSplit[lastIndex])) { segmentDurations = isBlank(segmentsAndDurationsResponseSplit[lastIndex])
segmentDurations = Arrays.copyOf(segmentsAndDurationsResponseSplit, lastIndex); ? Arrays.copyOf(segmentsAndDurationsResponseSplit, lastIndex)
} else { : segmentsAndDurationsResponseSplit;
segmentDurations = segmentsAndDurationsResponseSplit;
}
} catch (final Exception e) { } catch (final Exception e) {
throw new DashManifestCreationException("Could not get segment durations", 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 */ /* Extract video stream url */
try { try {
streamInfo.setVideoStreams(extractor.getVideoStreams()); streamInfo.setVideoStreams(extractor.getVideoStreams());
} catch (final ContentNotSupportedException e) {
throw e;
} catch (final Exception e) { } catch (final Exception e) {
streamInfo.addError(new ExtractionException("Couldn't get video streams", 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 */ /* Extract video only stream url */
try { try {
streamInfo.setVideoOnlyStreams(extractor.getVideoOnlyStreams()); streamInfo.setVideoOnlyStreams(extractor.getVideoOnlyStreams());
} catch (final ContentNotSupportedException e) {
throw e;
} catch (final Exception e) { } catch (final Exception e) {
streamInfo.addError(new ExtractionException("Couldn't get video only streams", e)); streamInfo.addError(new ExtractionException("Couldn't get video only streams", e));
} }