mirror of
https://github.com/revanced/revanced-patches
synced 2024-12-30 20:45:55 +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 {
|
try {
|
||||||
Uri uri = Uri.parse(url);
|
Uri uri = Uri.parse(url);
|
||||||
String path = uri.getPath();
|
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.
|
// '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.
|
// '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")
|
// 'ad_break' has no video id.
|
||||||
&& !path.contains("refresh")) {
|
if (path.contains("heartbeat") || path.contains("refresh") || path.contains("ad_break")) {
|
||||||
String id = uri.getQueryParameter("id");
|
Logger.printDebug(() -> "Ignoring path: " + path);
|
||||||
if (id == null) {
|
return;
|
||||||
Logger.printException(() -> "Ignoring request that has no video id." +
|
|
||||||
" Url: " + url + " headers: " + requestHeaders);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
StreamingDataRequest.fetchRequest(id, requestHeaders);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
} catch (Exception ex) {
|
||||||
Logger.printException(() -> "buildRequest failure", ex);
|
Logger.printException(() -> "buildRequest failure", ex);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user