@@ -22,10 +22,19 @@ public class SpoofVideoStreamsPatch {
2222 && BaseSettings .SPOOF_VIDEO_STREAMS_CLIENT_TYPE .get () == ClientType .IOS_UNPLUGGED ;
2323
2424 /**
25- * Any unreachable ip address. Used to intentionally fail requests.
25+ * Domain used for internet connectivity verification.
26+ * It has an empty response body and is only used to check for a 204 response code.
27+ * <p>
28+ * If an unreachable IP address (127.0.0.1) is used, no response code is provided.
29+ * <p>
30+ * YouTube handles unreachable IP addresses without issue.
31+ * YouTube Music has an issue with waiting for the Cronet connect timeout of 30s on mobile networks.
32+ * <p>
33+ * Using a VPN or DNS can temporarily resolve this issue,
34+ * But the ideal workaround is to avoid using an unreachable IP address.
2635 */
27- private static final String UNREACHABLE_HOST_URI_STRING = "https://127.0.0.0 " ;
28- private static final Uri UNREACHABLE_HOST_URI = Uri .parse (UNREACHABLE_HOST_URI_STRING );
36+ private static final String INTERNET_CONNECTION_CHECK_URI_STRING = "https://www.google.com/gen_204 " ;
37+ private static final Uri INTERNET_CONNECTION_CHECK_URI = Uri .parse (INTERNET_CONNECTION_CHECK_URI_STRING );
2938
3039 /**
3140 * @return If this patch was included during patching.
@@ -53,9 +62,9 @@ public static Uri blockGetWatchRequest(Uri playerRequestUri) {
5362 String path = playerRequestUri .getPath ();
5463
5564 if (path != null && path .contains ("get_watch" )) {
56- Logger .printDebug (() -> "Blocking 'get_watch' by returning unreachable uri" );
65+ Logger .printDebug (() -> "Blocking 'get_watch' by returning internet connection check uri" );
5766
58- return UNREACHABLE_HOST_URI ;
67+ return INTERNET_CONNECTION_CHECK_URI ;
5968 }
6069 } catch (Exception ex ) {
6170 Logger .printException (() -> "blockGetWatchRequest failure" , ex );
@@ -77,9 +86,9 @@ public static String blockInitPlaybackRequest(String originalUrlString) {
7786 String path = originalUri .getPath ();
7887
7988 if (path != null && path .contains ("initplayback" )) {
80- Logger .printDebug (() -> "Blocking 'initplayback' by clearing query " );
89+ Logger .printDebug (() -> "Blocking 'initplayback' by returning internet connection check uri " );
8190
82- return originalUri . buildUpon (). clearQuery (). build (). toString () ;
91+ return INTERNET_CONNECTION_CHECK_URI_STRING ;
8392 }
8493 } catch (Exception ex ) {
8594 Logger .printException (() -> "blockInitPlaybackRequest failure" , ex );
0 commit comments