Skip to content

Commit db3596c

Browse files
StypoxTobiGr
authored andcommitted
Fix "Could not get id" for channels w/o "Subscribe" button
1 parent 94e7f0d commit db3596c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelExtractor.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ public String getUrl() throws ParsingException {
8282
@Nonnull
8383
@Override
8484
public String getId() throws ParsingException {
85+
try {
86+
return doc.select("meta[itemprop=\"channelId\"]").first().attr("content");
87+
} catch (Exception ignored) {}
88+
89+
// fallback method; does not work with channels that have no "Subscribe" button (e.g. EminemVEVO)
8590
try {
8691
Element element = doc.getElementsByClass("yt-uix-subscription-button").first();
8792
if (element == null) element = doc.getElementsByClass("yt-uix-subscription-preferences-button").first();

0 commit comments

Comments
 (0)