sponsorblock: use serviceId instead of string comparison to determine if youtube service selected

This commit is contained in:
evermind 2023-02-17 22:56:50 +01:00
parent 5d222fce16
commit d74cc92104
2 changed files with 4 additions and 2 deletions

View file

@ -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;
}

View file

@ -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;