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