Skip to content
This repository was archived by the owner on Jan 21, 2024. It is now read-only.

Commit d74cc92

Browse files
committed
sponsorblock: use serviceId instead of string comparison to determine if youtube service selected
1 parent 5d222fc commit d74cc92

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

app/src/main/java/org/schabi/newpipe/util/ReturnYouTubeDislikeUtils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.schabi.newpipe.DownloaderImpl;
1313
import org.schabi.newpipe.MainActivity;
1414
import org.schabi.newpipe.R;
15+
import org.schabi.newpipe.extractor.ServiceList;
1516
import org.schabi.newpipe.extractor.stream.StreamInfo;
1617

1718
public final class ReturnYouTubeDislikeUtils {
@@ -35,7 +36,7 @@ public static int getDislikes(final Context context,
3536
return -1;
3637
}
3738

38-
if (!streamInfo.getUrl().startsWith("https://www.youtube.com")) {
39+
if (streamInfo.getServiceId() != ServiceList.YouTube.getServiceId()) {
3940
return -1;
4041
}
4142

app/src/main/java/org/schabi/newpipe/util/SponsorBlockUtils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.schabi.newpipe.DownloaderImpl;
1919
import org.schabi.newpipe.MainActivity;
2020
import org.schabi.newpipe.R;
21+
import org.schabi.newpipe.extractor.ServiceList;
2122
import org.schabi.newpipe.extractor.stream.StreamInfo;
2223
import org.schabi.newpipe.player.playqueue.PlayQueueItem;
2324
import org.schabi.newpipe.views.MarkableSeekBar;
@@ -53,7 +54,7 @@ public static VideoSegment[] getYouTubeVideoSegments(final Context context,
5354
final String apiUrl = prefs.getString(context
5455
.getString(R.string.sponsor_block_api_url_key), null);
5556

56-
if (!streamInfo.getUrl().startsWith("https://www.youtube.com")
57+
if (streamInfo.getServiceId() != ServiceList.YouTube.getServiceId()
5758
|| apiUrl == null
5859
|| apiUrl.isEmpty()) {
5960
return null;

0 commit comments

Comments
 (0)