diff --git a/src/main/java/mServer/crawler/sender/orfon/json/OrfOnEpisodeDeserializer.java b/src/main/java/mServer/crawler/sender/orfon/json/OrfOnEpisodeDeserializer.java index 5aaaab79..16ce043d 100644 --- a/src/main/java/mServer/crawler/sender/orfon/json/OrfOnEpisodeDeserializer.java +++ b/src/main/java/mServer/crawler/sender/orfon/json/OrfOnEpisodeDeserializer.java @@ -44,7 +44,7 @@ public class OrfOnEpisodeDeserializer implements JsonDeserializer> parseUrl(JsonElement jsonElement) { return Optional.empty(); } // We need to fallback to episode.sources in case there are many elements in the playlist - if (videoPath1.get().getAsJsonArray().size() > 1) { - return parseFallbackVideo(jsonElement); - } - - Optional videoPath2 = JsonUtils.getElement(videoPath1.get().getAsJsonArray().get(0), TAG_VIDEO_PATH_2); - if (videoPath2.isEmpty() || !videoPath2.get().isJsonArray()) { - return Optional.empty(); - } - for (String key : PREFERED_CODEC) { - Optional> resultingVideos = readVideoForTargetCodec(videoPath2.get(), key); - if (resultingVideos.isPresent()) { - return resultingVideos; + if (videoPath1.get().getAsJsonArray().size() == 1) { + Optional videoPath2 = JsonUtils.getElement(videoPath1.get().getAsJsonArray().get(0), TAG_VIDEO_PATH_2); + if (videoPath2.isEmpty() || !videoPath2.get().isJsonArray()) { + return Optional.empty(); + } + for (String key : PREFERED_CODEC) { + Optional> resultingVideos = readVideoForTargetCodec(videoPath2.get(), key); + if (resultingVideos.isPresent()) { + return resultingVideos; + } } } - - return Optional.empty(); + return parseFallbackVideo(jsonElement); } private Optional> parseFallbackVideo(JsonElement root) { @@ -172,7 +169,7 @@ private Optional> parseFallbackVideo(JsonElement root) { if (codecs.isPresent() && codecs.get().isJsonArray()) { for (JsonElement singleVideo : codecs.get().getAsJsonArray()) { Optional tgtUrl = JsonUtils.getElementValueAsString(singleVideo, TAG_VIDEO_FALLBACK_URL); - if (tgtUrl.isPresent()) { + if (tgtUrl.isPresent() && !tgtUrl.get().contains("/Jugendschutz") && !tgtUrl.get().contains("/no_drm_support") && !tgtUrl.get().contains("/schwarzung")) { urls.put(Qualities.NORMAL, tgtUrl.get()); return Optional.of(urls); } @@ -190,9 +187,11 @@ private Optional> readVideoForTargetCodec(JsonElement url Optional qualityValue = JsonUtils.getElementValueAsString(videoElement, TAG_VIDEO_QUALITY); Optional url = JsonUtils.getElementValueAsString(videoElement, TAG_VIDEO_URL); if (url.isPresent() && codec.isPresent() && qualityValue.isPresent() && targetCodec.equalsIgnoreCase(codec.get()) && OrfOnEpisodeDeserializer.getQuality(qualityValue.get()).isPresent()) { - final Optional quality = OrfOnEpisodeDeserializer.getQuality(qualityValue.get()); - if (quality.isPresent()) { - urls.put(quality.get(), url.get()); + if (!url.get().contains("/Jugendschutz") && !url.get().contains("/no_drm_support") && !url.get().contains("/schwarzung")) { + final Optional quality = OrfOnEpisodeDeserializer.getQuality(qualityValue.get()); + if (quality.isPresent()) { + urls.put(quality.get(), url.get()); + } } } }