Skip to content

Commit

Permalink
fix(YouTube - Spoof video streams): Ignore harmless error toast if hi…
Browse files Browse the repository at this point in the history
…de ads is disabled
  • Loading branch information
LisoUseInAIKyrios committed Dec 27, 2024
1 parent 519d57c commit c3423bb
Showing 1 changed file with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,25 @@ public static void fetchStreams(String url, Map<String, String> requestHeaders)
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;
}
// 'ad_break' has no video id.
if (path.contains("heartbeat") || path.contains("refresh") || path.contains("ad_break")) {
Logger.printDebug(() -> "Ignoring path: " + path);
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) {
Logger.printException(() -> "buildRequest failure", ex);
}
Expand Down

0 comments on commit c3423bb

Please sign in to comment.