From ec778200d9bb22b5b996d8a0e06916c3fa345dc7 Mon Sep 17 00:00:00 2001 From: TobiGr Date: Sun, 26 Jul 2020 14:15:13 +0200 Subject: [PATCH] Add comments to the code --- .../extractors/YoutubeStreamExtractor.java | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java index a1ac12969..de800799f 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java @@ -122,7 +122,9 @@ public class YoutubeStreamExtractor extends StreamExtractor { try { title = getTextFromObject(getVideoPrimaryInfoRenderer().getObject("title")); - } catch (ParsingException ignored) { } + } catch (ParsingException ignored) { + // age-restricted videos cause a ParsingException here + } if (isNullOrEmpty(title)) { title = playerResponse.getObject("videoDetails").getString("title"); @@ -206,7 +208,9 @@ public class YoutubeStreamExtractor extends StreamExtractor { try { String description = getTextFromObject(getVideoSecondaryInfoRenderer().getObject("description"), true); if (description != null && !description.isEmpty()) return new Description(description, Description.HTML); - } catch (ParsingException ignored) { } + } catch (ParsingException ignored) { + // age-restricted videos cause a ParsingException here + } // raw non-html description return new Description(playerResponse.getObject("videoDetails").getString("shortDescription"), Description.PLAIN_TEXT); @@ -260,7 +264,9 @@ public class YoutubeStreamExtractor extends StreamExtractor { try { views = getTextFromObject(getVideoPrimaryInfoRenderer().getObject("viewCount") .getObject("videoViewCountRenderer").getObject("viewCount")); - } catch (ParsingException ignored) {} + } catch (ParsingException ignored) { + // age-restricted videos cause a ParsingException here + } if (isNullOrEmpty(views)) { views = playerResponse.getObject("videoDetails").getString("viewCount"); @@ -332,7 +338,9 @@ public class YoutubeStreamExtractor extends StreamExtractor { if (!isNullOrEmpty(uploaderUrl)) { return uploaderUrl; } - } catch (ParsingException ignored) { } + } catch (ParsingException ignored) { + // age-restricted videos cause a ParsingException here + } String uploaderId = playerResponse.getObject("videoDetails").getString("channelId"); if (!isNullOrEmpty(uploaderId)) { @@ -373,7 +381,9 @@ public class YoutubeStreamExtractor extends StreamExtractor { try { url = getVideoSecondaryInfoRenderer().getObject("owner").getObject("videoOwnerRenderer") .getObject("thumbnail").getArray("thumbnails").getObject(0).getString("url"); - } catch (ParsingException ignored) { } + } catch (ParsingException ignored) { + // age-restricted videos cause a ParsingException here + } if (isNullOrEmpty(url)) { if (ageLimit == 18) return "";