Skip to content

Commit a104cf3

Browse files
committed
[YouTube] Fix docs in channel helper
1 parent bb47f05 commit a104cf3

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ public static String resolveChannelId(@Nonnull final String idOrPath)
4343
}
4444

4545
// If the URL is not a /channel URL, we need to use the navigation/resolve_url endpoint of
46-
// the InnerTube API to get the channel id.
47-
// Otherwise, we couldn't get information about the channel associated with this URL, if
48-
// there is one.
46+
// the InnerTube API to get the channel id. If this fails or if the URL is not a /channel
47+
// URL, then no information about the channel associated with this URL was found,
48+
// so the unresolved url will be returned.
4949
if (!channelId[0].equals("channel")) {
5050
final byte[] body = JsonWriter.string(
5151
prepareDesktopJsonBuilder(Localization.DEFAULT, ContentCountry.DEFAULT)
@@ -78,6 +78,7 @@ public static String resolveChannelId(@Nonnull final String idOrPath)
7878
}
7979
}
8080

81+
// return the unresolved URL
8182
return channelId[1];
8283
}
8384

@@ -110,11 +111,11 @@ private ChannelResponseData(@Nonnull final JsonObject jsonResponse,
110111
* Fetch a YouTube channel tab response, using the given channel ID and tab parameters.
111112
*
112113
* <p>
113-
* Redirections to other channels such as are supported to up to 3 redirects, which could
114-
* happen for instance for localized channels or auto-generated ones such as the {@code Movies
115-
* and Shows} (channel IDs {@code UCuJcl0Ju-gPDoksRjK1ya-w}, {@code UChBfWrfBXL9wS6tQtgjt_OQ}
116-
* and {@code UCok7UTQQEP1Rsctxiv3gwSQ} of this channel redirect to the
117-
* {@code UClgRkhTL3_hImCAmdLfDE4g} one).
114+
* Redirections to other channels are supported to up to 3 redirects, which could happen for
115+
* instance for localized channels or for auto-generated ones. For instance, there are three IDs
116+
* of the auto-generated "Movies and Shows" channel, i.e. {@code UCuJcl0Ju-gPDoksRjK1ya-w},
117+
* {@code UChBfWrfBXL9wS6tQtgjt_OQ} and {@code UCok7UTQQEP1Rsctxiv3gwSQ}, and they all redirect
118+
* to the {@code UClgRkhTL3_hImCAmdLfDE4g} one.
118119
* </p>
119120
*
120121
* @param channelId a valid YouTube channel ID
@@ -177,7 +178,7 @@ public static ChannelResponseData getChannelResponse(@Nonnull final String chann
177178
}
178179

179180
if (ajaxJson == null) {
180-
throw new ExtractionException("Got no channel response");
181+
throw new ExtractionException("Got no channel response after 3 redirects");
181182
}
182183

183184
defaultAlertsCheck(ajaxJson);

0 commit comments

Comments
 (0)