Merge pull request #307 from bravenewpipe/use-serviceId-to-determine-youtube-service

sponsorblock: use serviceId instead of string comparison to determine…
This commit is contained in:
poly 2023-04-08 14:33:32 -06:00 committed by GitHub
commit 5c4f0f495f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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;
@ -56,7 +57,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;