[YouTube] Fix NPE when getting channel header for videos channel tab
This commit is contained in:
parent
8be64574e4
commit
10704dfc94
|
@ -336,8 +336,7 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
|
|||
}
|
||||
}
|
||||
|
||||
// The description is cut and the original one can be only accessed from the About tab
|
||||
return jsonResponse.getObject("title")
|
||||
return jsonResponse.getObject(METADATA)
|
||||
.getObject("channelMetadataRenderer")
|
||||
.getString("description");
|
||||
} catch (final Exception e) {
|
||||
|
@ -432,7 +431,8 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
|
|||
channelId,
|
||||
ChannelTabs.VIDEOS,
|
||||
(service, linkHandler) -> new VideosTabExtractor(
|
||||
service, linkHandler, tabRenderer, name, id, url)));
|
||||
service, linkHandler, tabRenderer, channelHeader,
|
||||
name, id, url)));
|
||||
|
||||
break;
|
||||
case "shorts":
|
||||
|
|
|
@ -60,7 +60,7 @@ public class YoutubeChannelTabExtractor extends ChannelTabExtractor {
|
|||
@Nullable
|
||||
private String visitorData;
|
||||
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
|
||||
private Optional<YoutubeChannelHelper.ChannelHeader> channelHeader;
|
||||
protected Optional<YoutubeChannelHelper.ChannelHeader> channelHeader;
|
||||
|
||||
public YoutubeChannelTabExtractor(final StreamingService service,
|
||||
final ListLinkHandler linkHandler) {
|
||||
|
@ -450,20 +450,24 @@ public class YoutubeChannelTabExtractor extends ChannelTabExtractor {
|
|||
*/
|
||||
public static final class VideosTabExtractor extends YoutubeChannelTabExtractor {
|
||||
private final JsonObject tabRenderer;
|
||||
private final String channelName;
|
||||
private final String channelId;
|
||||
private final String channelName;
|
||||
private final String channelUrl;
|
||||
|
||||
VideosTabExtractor(final StreamingService service,
|
||||
final ListLinkHandler linkHandler,
|
||||
final JsonObject tabRenderer,
|
||||
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
|
||||
final Optional<YoutubeChannelHelper.ChannelHeader> channelHeader,
|
||||
final String channelName,
|
||||
final String channelId,
|
||||
final String channelUrl) {
|
||||
super(service, linkHandler);
|
||||
this.channelHeader = channelHeader;
|
||||
|
||||
this.tabRenderer = tabRenderer;
|
||||
this.channelName = channelName;
|
||||
this.channelId = channelId;
|
||||
this.channelName = channelName;
|
||||
this.channelUrl = channelUrl;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue