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
|
@Override
|
||||||
public String getName() throws ParsingException {
|
public String getName() throws ParsingException {
|
||||||
assertPageFetched();
|
assertPageFetched();
|
||||||
String title = null;
|
String title;
|
||||||
|
|
||||||
try {
|
// Try to get the video's original title, which is untranslated
|
||||||
title = getTextFromObject(getVideoPrimaryInfoRenderer().getObject("title"));
|
title = playerResponse.getObject("videoDetails").getString("title");
|
||||||
} catch (final ParsingException ignored) {
|
|
||||||
// Age-restricted videos cause a ParsingException here
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isNullOrEmpty(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)) {
|
if (isNullOrEmpty(title)) {
|
||||||
throw new ParsingException("Could not get name");
|
throw new ParsingException("Could not get name");
|
||||||
|
|
Loading…
Reference in New Issue