diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelExtractor.java index 19e0fca44..6abdc50ba 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelExtractor.java @@ -8,6 +8,7 @@ import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler; import org.schabi.newpipe.extractor.stream.StreamInfoItem; import javax.annotation.Nonnull; +import java.util.Collections; import java.util.List; /* @@ -48,6 +49,11 @@ public abstract class ChannelExtractor extends ListExtractor { public abstract String getParentChannelAvatarUrl() throws ParsingException; public abstract boolean isVerified() throws ParsingException; @Nonnull - public abstract List getTabs() throws ParsingException; - + public List getTabs() throws ParsingException { + return Collections.emptyList(); + } + @Nonnull + public List getTags() throws ParsingException { + return Collections.emptyList(); + } } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfo.java b/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfo.java index 0b7766bfe..0ee96c1bc 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfo.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfo.java @@ -139,6 +139,11 @@ public class ChannelInfo extends ListInfo { } catch (final Exception e) { info.addError(e); } + try { + info.setTags(extractor.getTags()); + } catch (final Exception e) { + info.addError(e); + } return info; } @@ -156,6 +161,8 @@ public class ChannelInfo extends ListInfo { private List tabs = Collections.emptyList(); + private List tags = Collections.emptyList(); + public String getParentChannelName() { return parentChannelName; } @@ -244,4 +251,11 @@ public class ChannelInfo extends ListInfo { public void setTabs(@Nonnull final List tabs) { this.tabs = tabs; } + + @Nonnull + public List getTags() { return tags; } + + public void setTags(@Nonnull final List tags) { + this.tags = tags; + } } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelExtractor.java index 670735c2c..a4b31fbe0 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelExtractor.java @@ -30,6 +30,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.Consumer; +import java.util.stream.Collectors; import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.ChannelResponseData; import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.DISABLE_PRETTY_PRINT_PARAMETER; @@ -230,6 +231,15 @@ public class YoutubeChannelExtractor extends ChannelExtractor { return tabs; } + @Nonnull + @Override + public List getTags() throws ParsingException { + final JsonArray tags = initialData.getObject("microformat") + .getObject("microformatDataRenderer").getArray("tags"); + + return tags.stream().map(Object::toString).collect(Collectors.toList()); + } + @Nonnull @Override public InfoItemsPage getInitialPage() throws IOException, ExtractionException {