Skip to content

Commit a39a2cc

Browse files
committed
fix redirect channels
1 parent a8665fd commit a39a2cc

1 file changed

Lines changed: 5 additions & 13 deletions

File tree

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

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.grack.nanojson.JsonArray;
44
import com.grack.nanojson.JsonObject;
5-
65
import org.schabi.newpipe.extractor.Page;
76
import org.schabi.newpipe.extractor.StreamingService;
87
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
@@ -18,13 +17,10 @@
1817
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
1918
import org.schabi.newpipe.extractor.utils.Utils;
2019

21-
import java.io.IOException;
22-
2320
import javax.annotation.Nonnull;
21+
import java.io.IOException;
2422

25-
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.fixThumbnailUrl;
26-
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getJsonResponse;
27-
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getTextFromObject;
23+
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.*;
2824
import static org.schabi.newpipe.extractor.utils.JsonUtils.EMPTY_STRING;
2925
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
3026

@@ -87,7 +83,8 @@ public void onFetchPage(@Nonnull Downloader downloader) throws IOException, Extr
8783

8884
final String browseId = endpoint.getObject("browseEndpoint").getString("browseId", EMPTY_STRING);
8985

90-
if (webPageType.equalsIgnoreCase("WEB_PAGE_TYPE_BROWSE") && !browseId.isEmpty()) {
86+
if (webPageType.equalsIgnoreCase("WEB_PAGE_TYPE_BROWSE")
87+
|| webPageType.equalsIgnoreCase("WEB_PAGE_TYPE_CHANNEL") && !browseId.isEmpty()) {
9188
if (!browseId.startsWith("UC")) {
9289
throw new ExtractionException("Redirected id is not pointing to a channel");
9390
}
@@ -191,12 +188,7 @@ public long getSubscriberCount() throws ParsingException {
191188
throw new ParsingException("Could not get subscriber count", e);
192189
}
193190
} else {
194-
// If there's no subscribe button, the channel has the subscriber count disabled
195-
if (c4TabbedHeaderRenderer.has("subscribeButton")) {
196-
return 0;
197-
} else {
198-
return -1;
199-
}
191+
return ITEM_COUNT_UNKNOWN;
200192
}
201193
}
202194

0 commit comments

Comments
 (0)