mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2025-04-29 00:10:35 +05:30
Get original untranslated title for YouTube.
This commit is contained in:
parent
1dc80957d8
commit
7635aeed2c
@ -163,17 +163,18 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||
@Override
|
||||
public String getName() throws ParsingException {
|
||||
assertPageFetched();
|
||||
String title = null;
|
||||
String title;
|
||||
|
||||
// Try to get the video's original title, which is untranslated
|
||||
title = playerResponse.getObject("videoDetails").getString("title");
|
||||
|
||||
if (isNullOrEmpty(title)) {
|
||||
try {
|
||||
title = getTextFromObject(getVideoPrimaryInfoRenderer().getObject("title"));
|
||||
} catch (final ParsingException ignored) {
|
||||
// Age-restricted videos cause a ParsingException here
|
||||
}
|
||||
|
||||
if (isNullOrEmpty(title)) {
|
||||
title = playerResponse.getObject("videoDetails").getString("title");
|
||||
|
||||
if (isNullOrEmpty(title)) {
|
||||
throw new ParsingException("Could not get name");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user