Skip to content

Youtube using google only mode #320

Closed

Description

@mudsharp

I've been experimenting with youtube in google only mode and it seems to work but not reliable.
youtube successfully loads but doesn't play the video but if i wait for a few minutes it successfully plays the video with a 200 code in the network tab in dev tools but after playing for a minute or so it stops playing and in the network tab there's no response header for the googlevideo playback request and it fails with status (canceled) at exactly 7.23 seconds this keeps happening until it suddenly works again and gets a 200 response code
this keeps happening over and over.
also this works better in m.youtube.com

The success response:
request URL
https://rr3---sn-5ualdnlr.googlevideo.com/videoplayback?expire=1777310242&ei=wkXvab21Jp_S6dsP5q2VyQE&ip=217.218.30.236&id=o-AFPElgqVtzQcYuXkBDvVD91SEuW7X391O4HSvU6-Jv-s&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&rms=au%2Cau&siu=1&spc=96Xrv-HpEMJyO90hJLwKMY9A3TqsJH9zmvXKTuagzt-2kFP804HJ&svpuc=1&ns=AK8r-LeJBGrKKl4evdQOYFcU&sabr=1&rqh=1&keepalive=yes&fexp=51565115,51565682,51869322&c=WEB&n=-NbpB53PV_EIZw&sparams=expire%2Cei%2Cip%2Cid%2Csource%2Crequiressl%2Cxpc%2Csiu%2Cspc%2Csvpuc%2Cns%2Csabr%2Crqh&sig=AHEqNM4wRQIgPTWHWmGzGz3GJuERrFq4DWHkrSMCamFR_B38EByq6LQCIQDC7pBPW5mXcBhjJylSSuXb0ivgB53lpZgsmz7iMTm5iA%3D%3D&cpn=E3bYTbAIqHC1mn2H&cver=2.20260424.01.00&redirect_counter=1&rm=sn-4g5l767z&rrc=104&cms_redirect=yes&cmsv=e&cps=306&ipbypass=yes&met=1777288680,&mh=ID&mip=34.116.28.67&mm=31&mn=sn-5ualdnlr&ms=au&mt=1777288429&mv=m&mvi=3&pl=28&lsparams=cps,ipbypass,met,mh,mip,mm,mn,ms,mv,mvi,pl,rms&lsig=APaTxxMwRAIgcLEcczsqZncmmFooaBOsM9I8-mcUhdwvdPA7d00nzzMCIHcMwNXf6njD39SGStojaDNmYOthvmuhPiJ5T8UavugD&rn=28&alr=yes
Request Method
POST
Status Code
200 OK
Remote Address
127.0.0.1:10808
Referrer Policy
strict-origin-when-cross-origin

Fail:
Request URL
https://rr3---sn-5ualdnlr.googlevideo.com/videoplayback?expire=1777310242&ei=wkXvab21Jp_S6dsP5q2VyQE&ip=217.218.30.236&id=o-AFPElgqVtzQcYuXkBDvVD91SEuW7X391O4HSvU6-Jv-s&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&rms=au%2Cau&siu=1&spc=96Xrv-HpEMJyO90hJLwKMY9A3TqsJH9zmvXKTuagzt-2kFP804HJ&svpuc=1&ns=AK8r-LeJBGrKKl4evdQOYFcU&sabr=1&rqh=1&keepalive=yes&fexp=51565115,51565682,51869322&c=WEB&n=-NbpB53PV_EIZw&sparams=expire%2Cei%2Cip%2Cid%2Csource%2Crequiressl%2Cxpc%2Csiu%2Cspc%2Csvpuc%2Cns%2Csabr%2Crqh&sig=AHEqNM4wRQIgPTWHWmGzGz3GJuERrFq4DWHkrSMCamFR_B38EByq6LQCIQDC7pBPW5mXcBhjJylSSuXb0ivgB53lpZgsmz7iMTm5iA%3D%3D&cpn=E3bYTbAIqHC1mn2H&cver=2.20260424.01.00&redirect_counter=1&rm=sn-4g5l767z&rrc=104&cms_redirect=yes&cmsv=e&cps=306&ipbypass=yes&met=1777288680,&mh=ID&mip=34.116.28.67&mm=31&mn=sn-5ualdnlr&ms=au&mt=1777288429&mv=m&mvi=3&pl=28&lsparams=cps,ipbypass,met,mh,mip,mm,mn,ms,mv,mvi,pl,rms&lsig=APaTxxMwRAIgcLEcczsqZncmmFooaBOsM9I8-mcUhdwvdPA7d00nzzMCIHcMwNXf6njD39SGStojaDNmYOthvmuhPiJ5T8UavugD&rn=34&alr=yes
Referrer Policy
strict-origin-when-cross-origin

(no response headers)

Activity

  1. therealaleph commented on Apr 27, 2026

    @therealaleph
    Owner

    @mudsharp — the symptom (works briefly, fails at exactly 7.23s, recovers, repeats) is consistent with ISP-side throttling on googlevideo.com, not an mhrv-rs internal failure. Here's why this happens specifically in google_only mode:

    google_only mode + googlevideo.com bypasses mhrv-rs entirely.

    In google_only mode, mhrv-rs only SNI-rewrites traffic to a few Google-edge hostnames (google.com, gmail.com, etc.). googlevideo.com is intentionally not in that SNI rewrite list — see proxy_server.rs:2727 for the comment. The reason: googlevideo is served by Google's separate "EVA" edge IPs, not the same set as www.google.com's GFE — and SNI-rewriting googlevideo.com:443 to a GFE IP causes the gvs1 content servers to refuse to serve video chunks (this was the regression in v1.7.4 → reverted in v1.7.6).

    So in google_only mode, googlevideo.com:443 traffic goes direct TCP passthrough — your ISP sees the real googlevideo.com SNI and can throttle it as it pleases. The 7.23s exact-time cutoff is a fingerprint of Iran ISP's per-domain traffic shaping (other users reported the same number on different videos — pretty consistent with a fixed budget / fixed connection-time policy).

    Three options to actually play YouTube reliably:

    1. Switch to apps_script mode + enable youtube_via_relay

      {
        "mode": "apps_script",
        "youtube_via_relay": true,  // routes googlevideo through Apps Script
        ...
      }

      This sends googlevideo.com requests through Apps Script's UrlFetchApp.fetch(), bypassing your ISP's per-domain throttle. Trade-off: Apps Script's response-buffer model has a 60-second cliff for SABR streaming (لود نشدن ویدیو های یوتیوب بیشتر از 59 ثانیه #300), so videos longer than ~1 minute may stall. Works for short clips reliably though.

    2. Switch to full mode + VPS (best video experience)

      • mhrv-rs Full mode + tunnel-node on a clean VPS = your ISP sees only TLS to your VPS, googlevideo traffic doesn't get throttled
      • 5 minutes setup if you have a VPS (Hetzner €4/mo works): docker run -d --name mhrv-tunnel -p 8443:8443 -e MHRV_AUTH_KEY=... ghcr.io/therealaleph/mhrv-tunnel-node:latest
      • Configure mhrv-rs with "mode": "full", "tunnel_url": "https://YOUR_VPS:8443", "tunnel_auth_key": "..."
    3. Stick with google_only for everything else, accept that YouTube is broken in this mode — the mode is designed for bootstrap (Search/Gmail/static Google services), not media streaming.

    About m.youtube.com working better: the mobile site uses different SABR cadence (more, smaller chunks vs. desktop's larger streaming chunks). Your ISP's throttle hits the desktop pattern harder. Not an mhrv-rs effect.

    Recommendation: option 1 (youtube_via_relay) if you don't have a VPS — it's the single config flag toggle and works around your ISP's throttle without infrastructure cost. If you do have a VPS, option 2 is strictly better.

    For SABR-streaming-on-Apps-Script (option 1), the 60-second cliff is tracked at #300 — that's a separate architectural fix for v1.8.x (googlevideo_ip config field to direct-connect googlevideo to a clean residential IP at the user's choice).


    [reply via Anthropic Claude | reviewed by @therealaleph]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions