Skip to content

Commit ec77820

Browse files
committed
Add comments to the code
1 parent 81459e2 commit ec77820

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ public String getName() throws ParsingException {
122122

123123
try {
124124
title = getTextFromObject(getVideoPrimaryInfoRenderer().getObject("title"));
125-
} catch (ParsingException ignored) { }
125+
} catch (ParsingException ignored) {
126+
// age-restricted videos cause a ParsingException here
127+
}
126128

127129
if (isNullOrEmpty(title)) {
128130
title = playerResponse.getObject("videoDetails").getString("title");
@@ -206,7 +208,9 @@ public Description getDescription() {
206208
try {
207209
String description = getTextFromObject(getVideoSecondaryInfoRenderer().getObject("description"), true);
208210
if (description != null && !description.isEmpty()) return new Description(description, Description.HTML);
209-
} catch (ParsingException ignored) { }
211+
} catch (ParsingException ignored) {
212+
// age-restricted videos cause a ParsingException here
213+
}
210214

211215
// raw non-html description
212216
return new Description(playerResponse.getObject("videoDetails").getString("shortDescription"), Description.PLAIN_TEXT);
@@ -260,7 +264,9 @@ public long getViewCount() throws ParsingException {
260264
try {
261265
views = getTextFromObject(getVideoPrimaryInfoRenderer().getObject("viewCount")
262266
.getObject("videoViewCountRenderer").getObject("viewCount"));
263-
} catch (ParsingException ignored) {}
267+
} catch (ParsingException ignored) {
268+
// age-restricted videos cause a ParsingException here
269+
}
264270

265271
if (isNullOrEmpty(views)) {
266272
views = playerResponse.getObject("videoDetails").getString("viewCount");
@@ -332,7 +338,9 @@ public String getUploaderUrl() throws ParsingException {
332338
if (!isNullOrEmpty(uploaderUrl)) {
333339
return uploaderUrl;
334340
}
335-
} catch (ParsingException ignored) { }
341+
} catch (ParsingException ignored) {
342+
// age-restricted videos cause a ParsingException here
343+
}
336344

337345
String uploaderId = playerResponse.getObject("videoDetails").getString("channelId");
338346
if (!isNullOrEmpty(uploaderId)) {
@@ -373,7 +381,9 @@ public String getUploaderAvatarUrl() throws ParsingException {
373381
try {
374382
url = getVideoSecondaryInfoRenderer().getObject("owner").getObject("videoOwnerRenderer")
375383
.getObject("thumbnail").getArray("thumbnails").getObject(0).getString("url");
376-
} catch (ParsingException ignored) { }
384+
} catch (ParsingException ignored) {
385+
// age-restricted videos cause a ParsingException here
386+
}
377387

378388
if (isNullOrEmpty(url)) {
379389
if (ageLimit == 18) return "";

0 commit comments

Comments
 (0)