diff --git a/source/net/filebot/web/TMDbClient.java b/source/net/filebot/web/TMDbClient.java index 44964f90..f1c68246 100644 --- a/source/net/filebot/web/TMDbClient.java +++ b/source/net/filebot/web/TMDbClient.java @@ -255,18 +255,22 @@ public class TMDbClient implements MovieIdentificationService { List trailers = new ArrayList(); JSONObject trailerResponse = (JSONObject) response.get("trailers"); - for (String section : new String[] { "quicktime", "youtube" }) { - for (JSONObject it : jsonList(trailerResponse.get(section))) { - Map sources = new LinkedHashMap(); - if (it.containsKey("sources")) { - for (JSONObject s : jsonList(it.get("sources"))) { - sources.put(s.get("size").toString(), s.get("source").toString()); + try { + for (String section : new String[] { "quicktime", "youtube" }) { + for (JSONObject it : jsonList(trailerResponse.get(section))) { + Map sources = new LinkedHashMap(); + if (it.containsKey("sources")) { + for (JSONObject s : jsonList(it.get("sources"))) { + sources.put(s.get("size").toString(), s.get("source").toString()); + } + } else { + sources.put(it.get("size").toString(), it.get("source").toString()); } - } else { - sources.put(it.get("size").toString(), it.get("source").toString()); + trailers.add(new Trailer(section, it.get("name").toString(), sources)); } - trailers.add(new Trailer(section, it.get("name").toString(), sources)); } + } catch (Exception e) { + Logger.getLogger(getClass().getName()).log(Level.WARNING, "Illegal trailer data: " + trailerResponse); } return new MovieInfo(fields, alternativeTitles, genres, spokenLanguages, cast, trailers);