diff --git a/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/SpoofVideoStreamsPatch.java b/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/SpoofVideoStreamsPatch.java index ef11885da..f2c0df925 100644 --- a/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/SpoofVideoStreamsPatch.java +++ b/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/SpoofVideoStreamsPatch.java @@ -115,20 +115,25 @@ public class SpoofVideoStreamsPatch { try { Uri uri = Uri.parse(url); String path = uri.getPath(); + if (path == null || !path.contains("player")) { + return; + } // 'heartbeat' has no video id and appears to be only after playback has started. // 'refresh' has no video id and appears to happen when waiting for a livestream to start. - if (path != null && path.contains("player") && !path.contains("heartbeat") - && !path.contains("refresh")) { - String id = uri.getQueryParameter("id"); - if (id == null) { - Logger.printException(() -> "Ignoring request that has no video id." + - " Url: " + url + " headers: " + requestHeaders); - return; - } - - StreamingDataRequest.fetchRequest(id, requestHeaders); + // 'ad_break' has no video id. + if (path.contains("heartbeat") || path.contains("refresh") || path.contains("ad_break")) { + Logger.printDebug(() -> "Ignoring path: " + path); + return; } + + String id = uri.getQueryParameter("id"); + if (id == null) { + Logger.printException(() -> "Ignoring request with no id. Url: " + url); + return; + } + + StreamingDataRequest.fetchRequest(id, requestHeaders); } catch (Exception ex) { Logger.printException(() -> "buildRequest failure", ex); }