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

Commit 5c4f0f4

Browse files
Merge pull request #307 from bravenewpipe/use-serviceId-to-determine-youtube-service
sponsorblock: use serviceId instead of string comparison to determine…
2 parents 5f701c8 + d74cc92 commit 5c4f0f4

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

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;
@@ -56,7 +57,7 @@ public static VideoSegment[] getYouTubeVideoSegments(final Context context,
5657
final String apiUrl = prefs.getString(context
5758
.getString(R.string.sponsor_block_api_url_key), null);
5859

59-
if (!streamInfo.getUrl().startsWith("https://www.youtube.com")
60+
if (streamInfo.getServiceId() != ServiceList.YouTube.getServiceId()
6061
|| apiUrl == null
6162
|| apiUrl.isEmpty()) {
6263
return null;

0 commit comments

Comments
 (0)