2
0
mirror of https://github.com/TeamNewPipe/NewPipeExtractor synced 2025-08-22 01:48:58 +00:00

Fix missing paranthesis in condition and improve null-safety

This commit is contained in:
TobiGr 2025-07-31 11:01:18 +02:00
parent aa70b5a04b
commit 6397b2ec3f

View File

@ -96,7 +96,7 @@ public final class YoutubeChannelHelper {
webPageType = endpoint.getObject("commandMetadata")
.getObject("webCommandMetadata")
.getString("webPageType", "");
.getString("webPageType");
urlToResolve = "WEB_PAGE_TYPE_UNKNOWN".equals(webPageType)
? endpoint.getObject("urlEndpoint").getString("url")
@ -106,8 +106,8 @@ public final class YoutubeChannelHelper {
final String browseId = endpoint.getObject(BROWSE_ENDPOINT)
.getString(BROWSE_ID, "");
if (webPageType.equalsIgnoreCase("WEB_PAGE_TYPE_BROWSE")
|| webPageType.equalsIgnoreCase("WEB_PAGE_TYPE_CHANNEL")
if (("WEB_PAGE_TYPE_BROWSE".equalsIgnoreCase(webPageType)
|| "WEB_PAGE_TYPE_CHANNEL".equalsIgnoreCase(webPageType))
&& !browseId.isEmpty()) {
if (!browseId.startsWith("UC")) {
throw new ExtractionException("Redirected id is not pointing to a channel");
@ -116,7 +116,7 @@ public final class YoutubeChannelHelper {
return browseId;
}
// Otherwise the code after that will run into an IndexOutOfBoundsException
// Otherwise, the code after that will run into an IndexOutOfBoundsException
if (channelId.length < 2) {
throw new ExtractionException("Failed to resolve channelId for " + idOrPath);
}
@ -201,13 +201,13 @@ public final class YoutubeChannelHelper {
final String webPageType = endpoint.getObject("commandMetadata")
.getObject("webCommandMetadata")
.getString("webPageType", "");
.getString("webPageType");
final String browseId = endpoint.getObject(BROWSE_ENDPOINT)
.getString(BROWSE_ID, "");
if (webPageType.equalsIgnoreCase("WEB_PAGE_TYPE_BROWSE")
|| webPageType.equalsIgnoreCase("WEB_PAGE_TYPE_CHANNEL")
if (("WEB_PAGE_TYPE_BROWSE".equalsIgnoreCase(webPageType)
|| "WEB_PAGE_TYPE_CHANNEL".equalsIgnoreCase(webPageType))
&& !browseId.isEmpty()) {
if (!browseId.startsWith("UC")) {
throw new ExtractionException("Redirected id is not pointing to a channel");