mirror of
https://github.com/revanced/revanced-patches
synced 2024-12-30 21:35:54 +01:00
fix(YouTube - Spoof video streams): Ignore harmless error toast if hide ads is disabled
This commit is contained in:
parent
519d57c04f
commit
c3423bb9e5
@ -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")) {
|
||||
// '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 that has no video id." +
|
||||
" Url: " + url + " headers: " + requestHeaders);
|
||||
Logger.printException(() -> "Ignoring request with no id. Url: " + url);
|
||||
return;
|
||||
}
|
||||
|
||||
StreamingDataRequest.fetchRequest(id, requestHeaders);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Logger.printException(() -> "buildRequest failure", ex);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user