Skip to content

Commit 04257a0

Browse files
committed
Return an empty title string for YouTube videos with no title
1 parent 824486d commit 04257a0

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,15 @@ public String getUrl() throws ParsingException {
130130

131131
@Override
132132
public String getName() throws ParsingException {
133-
final String name = getTextFromObject(videoInfo.getObject("title"));
133+
final JsonObject title = videoInfo.getObject("title");
134+
final String name = getTextFromObject(title);
134135
if (!isNullOrEmpty(name)) {
135136
return name;
136137
}
138+
// Videos can have no title, e.g. https://www.youtube.com/watch?v=nc1kN8ZSfGQ
139+
if (!isNullOrEmpty(title) && !title.has("runs")) {
140+
return "";
141+
}
137142
throw new ParsingException("Could not get name");
138143
}
139144

0 commit comments

Comments
 (0)