Skip to content

Commit 6397b2e

Browse files
committed
Fix missing paranthesis in condition and improve null-safety
1 parent aa70b5a commit 6397b2e

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public static String resolveChannelId(@Nonnull final String idOrPath)
9696

9797
webPageType = endpoint.getObject("commandMetadata")
9898
.getObject("webCommandMetadata")
99-
.getString("webPageType", "");
99+
.getString("webPageType");
100100

101101
urlToResolve = "WEB_PAGE_TYPE_UNKNOWN".equals(webPageType)
102102
? endpoint.getObject("urlEndpoint").getString("url")
@@ -106,8 +106,8 @@ public static String resolveChannelId(@Nonnull final String idOrPath)
106106
final String browseId = endpoint.getObject(BROWSE_ENDPOINT)
107107
.getString(BROWSE_ID, "");
108108

109-
if (webPageType.equalsIgnoreCase("WEB_PAGE_TYPE_BROWSE")
110-
|| webPageType.equalsIgnoreCase("WEB_PAGE_TYPE_CHANNEL")
109+
if (("WEB_PAGE_TYPE_BROWSE".equalsIgnoreCase(webPageType)
110+
|| "WEB_PAGE_TYPE_CHANNEL".equalsIgnoreCase(webPageType))
111111
&& !browseId.isEmpty()) {
112112
if (!browseId.startsWith("UC")) {
113113
throw new ExtractionException("Redirected id is not pointing to a channel");
@@ -116,7 +116,7 @@ public static String resolveChannelId(@Nonnull final String idOrPath)
116116
return browseId;
117117
}
118118

119-
// Otherwise the code after that will run into an IndexOutOfBoundsException
119+
// Otherwise, the code after that will run into an IndexOutOfBoundsException
120120
if (channelId.length < 2) {
121121
throw new ExtractionException("Failed to resolve channelId for " + idOrPath);
122122
}
@@ -201,13 +201,13 @@ public static ChannelResponseData getChannelResponse(@Nonnull final String chann
201201

202202
final String webPageType = endpoint.getObject("commandMetadata")
203203
.getObject("webCommandMetadata")
204-
.getString("webPageType", "");
204+
.getString("webPageType");
205205

206206
final String browseId = endpoint.getObject(BROWSE_ENDPOINT)
207207
.getString(BROWSE_ID, "");
208208

209-
if (webPageType.equalsIgnoreCase("WEB_PAGE_TYPE_BROWSE")
210-
|| webPageType.equalsIgnoreCase("WEB_PAGE_TYPE_CHANNEL")
209+
if (("WEB_PAGE_TYPE_BROWSE".equalsIgnoreCase(webPageType)
210+
|| "WEB_PAGE_TYPE_CHANNEL".equalsIgnoreCase(webPageType))
211211
&& !browseId.isEmpty()) {
212212
if (!browseId.startsWith("UC")) {
213213
throw new ExtractionException("Redirected id is not pointing to a channel");

0 commit comments

Comments
 (0)