[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(METADATA)
|
||||||
return jsonResponse.getObject("title")
|
|
||||||
.getObject("channelMetadataRenderer")
|
.getObject("channelMetadataRenderer")
|
||||||
.getString("description");
|
.getString("description");
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
|
@ -432,7 +431,8 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
|
||||||
channelId,
|
channelId,
|
||||||
ChannelTabs.VIDEOS,
|
ChannelTabs.VIDEOS,
|
||||||
(service, linkHandler) -> new VideosTabExtractor(
|
(service, linkHandler) -> new VideosTabExtractor(
|
||||||
service, linkHandler, tabRenderer, name, id, url)));
|
service, linkHandler, tabRenderer, channelHeader,
|
||||||
|
name, id, url)));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "shorts":
|
case "shorts":
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class YoutubeChannelTabExtractor extends ChannelTabExtractor {
|
||||||
@Nullable
|
@Nullable
|
||||||
private String visitorData;
|
private String visitorData;
|
||||||
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
|
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
|
||||||
private Optional<YoutubeChannelHelper.ChannelHeader> channelHeader;
|
protected Optional<YoutubeChannelHelper.ChannelHeader> channelHeader;
|
||||||
|
|
||||||
public YoutubeChannelTabExtractor(final StreamingService service,
|
public YoutubeChannelTabExtractor(final StreamingService service,
|
||||||
final ListLinkHandler linkHandler) {
|
final ListLinkHandler linkHandler) {
|
||||||
|
@ -450,20 +450,24 @@ public class YoutubeChannelTabExtractor extends ChannelTabExtractor {
|
||||||
*/
|
*/
|
||||||
public static final class VideosTabExtractor extends YoutubeChannelTabExtractor {
|
public static final class VideosTabExtractor extends YoutubeChannelTabExtractor {
|
||||||
private final JsonObject tabRenderer;
|
private final JsonObject tabRenderer;
|
||||||
private final String channelName;
|
|
||||||
private final String channelId;
|
private final String channelId;
|
||||||
|
private final String channelName;
|
||||||
private final String channelUrl;
|
private final String channelUrl;
|
||||||
|
|
||||||
VideosTabExtractor(final StreamingService service,
|
VideosTabExtractor(final StreamingService service,
|
||||||
final ListLinkHandler linkHandler,
|
final ListLinkHandler linkHandler,
|
||||||
final JsonObject tabRenderer,
|
final JsonObject tabRenderer,
|
||||||
|
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
|
||||||
|
final Optional<YoutubeChannelHelper.ChannelHeader> channelHeader,
|
||||||
final String channelName,
|
final String channelName,
|
||||||
final String channelId,
|
final String channelId,
|
||||||
final String channelUrl) {
|
final String channelUrl) {
|
||||||
super(service, linkHandler);
|
super(service, linkHandler);
|
||||||
|
this.channelHeader = channelHeader;
|
||||||
|
|
||||||
this.tabRenderer = tabRenderer;
|
this.tabRenderer = tabRenderer;
|
||||||
this.channelName = channelName;
|
|
||||||
this.channelId = channelId;
|
this.channelId = channelId;
|
||||||
|
this.channelName = channelName;
|
||||||
this.channelUrl = channelUrl;
|
this.channelUrl = channelUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue