From d74cc9210415ab983b00e2d0cee484c14bf1d832 Mon Sep 17 00:00:00 2001 From: evermind Date: Fri, 17 Feb 2023 22:56:50 +0100 Subject: [PATCH] sponsorblock: use serviceId instead of string comparison to determine if youtube service selected --- .../org/schabi/newpipe/util/ReturnYouTubeDislikeUtils.java | 3 ++- .../main/java/org/schabi/newpipe/util/SponsorBlockUtils.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/util/ReturnYouTubeDislikeUtils.java b/app/src/main/java/org/schabi/newpipe/util/ReturnYouTubeDislikeUtils.java index c7031f427..2cd107932 100644 --- a/app/src/main/java/org/schabi/newpipe/util/ReturnYouTubeDislikeUtils.java +++ b/app/src/main/java/org/schabi/newpipe/util/ReturnYouTubeDislikeUtils.java @@ -12,6 +12,7 @@ import com.grack.nanojson.JsonParser; import org.schabi.newpipe.DownloaderImpl; import org.schabi.newpipe.MainActivity; import org.schabi.newpipe.R; +import org.schabi.newpipe.extractor.ServiceList; import org.schabi.newpipe.extractor.stream.StreamInfo; public final class ReturnYouTubeDislikeUtils { @@ -35,7 +36,7 @@ public final class ReturnYouTubeDislikeUtils { return -1; } - if (!streamInfo.getUrl().startsWith("https://www.youtube.com")) { + if (streamInfo.getServiceId() != ServiceList.YouTube.getServiceId()) { return -1; } diff --git a/app/src/main/java/org/schabi/newpipe/util/SponsorBlockUtils.java b/app/src/main/java/org/schabi/newpipe/util/SponsorBlockUtils.java index 35870e3d3..f31ce9496 100644 --- a/app/src/main/java/org/schabi/newpipe/util/SponsorBlockUtils.java +++ b/app/src/main/java/org/schabi/newpipe/util/SponsorBlockUtils.java @@ -18,6 +18,7 @@ import org.schabi.newpipe.App; import org.schabi.newpipe.DownloaderImpl; import org.schabi.newpipe.MainActivity; import org.schabi.newpipe.R; +import org.schabi.newpipe.extractor.ServiceList; import org.schabi.newpipe.extractor.stream.StreamInfo; import org.schabi.newpipe.player.playqueue.PlayQueueItem; import org.schabi.newpipe.views.MarkableSeekBar; @@ -53,7 +54,7 @@ public final class SponsorBlockUtils { final String apiUrl = prefs.getString(context .getString(R.string.sponsor_block_api_url_key), null); - if (!streamInfo.getUrl().startsWith("https://www.youtube.com") + if (streamInfo.getServiceId() != ServiceList.YouTube.getServiceId() || apiUrl == null || apiUrl.isEmpty()) { return null;