Skip to content

api/youtube: reuse web visitor data for android vr - #1581

Open
Rexarrior wants to merge 1 commit into
imputnet:mainfrom
Rexarrior:fix/youtube-android-vr-visitor
Open

api/youtube: reuse web visitor data for android vr#1581
Rexarrior wants to merge 1 commit into
imputnet:mainfrom
Rexarrior:fix/youtube-android-vr-visitor

Conversation

@Rexarrior

Copy link
Copy Markdown

summary

  • bootstrap anonymous visitor data from the public YouTube watch page when using ANDROID_VR
  • cache it briefly and refresh the Innertube session when it changes
  • send the matching Android VR user agent and treat its direct media URLs as no-cipher

why

YouTube currently ties playable Android VR player responses to visitor data issued by the watch page. youtubei.js otherwise creates an unrelated visitor session, which returns LOGIN_REQUIRED; the default iOS flow may produce tunnels whose Google Video responses are empty.

This is opt-in through CUSTOM_INNERTUBE_CLIENT=ANDROID_VR.

Addresses #1455 and its duplicate #1475.

testing

  • node --check api/src/processing/services/youtube.js
  • git diff --check
  • built and ran the Docker image with CUSTOM_INNERTUBE_CLIENT=ANDROID_VR
  • requested https://youtu.be/c5cb0pqky3s?list=RDc5cb0pqky3s; the API returned a tunnel
  • read 1 MiB from the tunnel successfully (previously 0 bytes)

YouTube ties playable Android VR responses to visitor data issued by the watch page. Cache that value briefly and use the matching client user agent so media URLs remain accessible without a poToken.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant