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

Commit

Permalink
Merge pull request #307 from bravenewpipe/use-serviceId-to-determine-…
Browse files Browse the repository at this point in the history
…youtube-service

sponsorblock: use serviceId instead of string comparison to determine…
  • Loading branch information
polymorphicshade authored Apr 8, 2023
2 parents 5f701c8 + d74cc92 commit 5c4f0f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
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 {
Expand All @@ -35,7 +36,7 @@ public static int getDislikes(final Context context,
return -1;
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
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;
Expand Down Expand Up @@ -56,7 +57,7 @@ public static VideoSegment[] getYouTubeVideoSegments(final Context context,
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;
Expand Down

0 comments on commit 5c4f0f4

Please sign in to comment.