Skip to content

Commit a6da202

Browse files
committed
try YoutubeChannelExtractor.getName() hack
1 parent 540237d commit a6da202

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
4545
private static final String CHANNEL_FEED_BASE = "https://www.youtube.com/feeds/videos.xml?channel_id=";
4646
private static final String CHANNEL_URL_PARAMETERS = "/videos?view=0&flow=list&sort=dd&live_view=10000";
4747

48+
private String channelName = ""; //Small hack used to make the channelName available to NextStreams
49+
4850
private Document doc;
4951
/**
5052
* It's lazily initialized (when getNextStreams is called)
@@ -100,7 +102,8 @@ public String getName() throws ParsingException {
100102
@Override
101103
public String getAvatarUrl() throws ParsingException {
102104
try {
103-
return doc.select("img[class=\"channel-header-profile-image\"]").first().attr("abs:src");
105+
channelName = doc.select("img[class=\"channel-header-profile-image\"]").first().attr("abs:src");
106+
return channelName;
104107
} catch (Exception e) {
105108
throw new ParsingException("Could not get avatar", e);
106109
}
@@ -232,7 +235,11 @@ public String getName() throws ParsingException {
232235

233236
@Override
234237
public String getUploaderName() throws ParsingException {
235-
return YoutubeChannelExtractor.this.getName();
238+
if(channelName.isEmpty()) {
239+
return "";
240+
} else {
241+
return channelName;
242+
}
236243
}
237244

238245
@Override

0 commit comments

Comments
 (0)