Add ability to set po_token and visitordata ID (#4789)

This PR adds two new config option, to pass a PO token (config 'po_token') and
a visitor ID (config 'visitor_data') to Youtube. These two strings are required
to play videos using the WEB client.

Warning: These strings gives much more identifiable information to Google!

If the po_token setting is filled in, then the WEB client is used. If not, the
Android client is used. TvHtml5ScreenEmbed will still be used as a fallback.

Script for generating po_token and visitor_data:
https://github.com/iv-org/youtube-trusted-session-generator

Helps with issue 4734
This commit is contained in:
Samantaz Fox
2024-08-13 20:35:43 +02:00
5 changed files with 37 additions and 3 deletions

View File

@@ -115,6 +115,7 @@ struct Video
n = DECRYPT_FUNCTION.try &.decrypt_nsig(params["n"])
params["n"] = n if n
params["pot"] = CONFIG.po_token if CONFIG.po_token
params["host"] = url.host.not_nil!
if region = self.info["region"]?.try &.as_s