mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-10 07:22:16 +05:30
Add ability to set po_token and visitordata ID
This commit is contained in:
parent
1ae14cc224
commit
9e11d59af4
@ -173,6 +173,16 @@ https_only: false
|
|||||||
##
|
##
|
||||||
# use_innertube_for_captions: false
|
# use_innertube_for_captions: false
|
||||||
|
|
||||||
|
##
|
||||||
|
## Send Google session informations. This gives more identifiable information to Google.
|
||||||
|
##
|
||||||
|
## Useful when Invidious is blocked by the message "This helps protect our community." See https://github.com/iv-org/invidious/issues/4734
|
||||||
|
##
|
||||||
|
## Accepted values: true, false
|
||||||
|
## Default: false
|
||||||
|
##
|
||||||
|
# po_token: XXX
|
||||||
|
# visitor_data: XXX
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# Logging
|
# Logging
|
||||||
|
@ -130,6 +130,11 @@ class Config
|
|||||||
# Use Innertube's transcripts API instead of timedtext for closed captions
|
# Use Innertube's transcripts API instead of timedtext for closed captions
|
||||||
property use_innertube_for_captions : Bool = false
|
property use_innertube_for_captions : Bool = false
|
||||||
|
|
||||||
|
# visitor data ID for Google session
|
||||||
|
property visitor_data : String? = nil
|
||||||
|
# poToken for passing bot attestation
|
||||||
|
property po_token : String? = nil
|
||||||
|
|
||||||
# Saved cookies in "name1=value1; name2=value2..." format
|
# Saved cookies in "name1=value1; name2=value2..." format
|
||||||
@[YAML::Field(converter: Preferences::StringToCookies)]
|
@[YAML::Field(converter: Preferences::StringToCookies)]
|
||||||
property cookies : HTTP::Cookies = HTTP::Cookies.new
|
property cookies : HTTP::Cookies = HTTP::Cookies.new
|
||||||
|
@ -341,6 +341,10 @@ module YoutubeAPI
|
|||||||
client_context["client"]["platform"] = platform
|
client_context["client"]["platform"] = platform
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if CONFIG.visitor_data.is_a?(String)
|
||||||
|
client_context["client"]["visitorData"] = CONFIG.visitor_data.as(String)
|
||||||
|
end
|
||||||
|
|
||||||
return client_context
|
return client_context
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -488,6 +492,9 @@ module YoutubeAPI
|
|||||||
"html5Preference": "HTML5_PREF_WANTS",
|
"html5Preference": "HTML5_PREF_WANTS",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"serviceIntegrityDimensions" => {
|
||||||
|
"poToken" => CONFIG.po_token ? CONFIG.po_token.as(String) : nil,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
# Append the additional parameters if those were provided
|
# Append the additional parameters if those were provided
|
||||||
@ -620,6 +627,10 @@ module YoutubeAPI
|
|||||||
headers["User-Agent"] = user_agent
|
headers["User-Agent"] = user_agent
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if CONFIG.visitor_data.is_a?(String)
|
||||||
|
headers["X-Goog-Visitor-Id"] = CONFIG.visitor_data.as(String)
|
||||||
|
end
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
LOGGER.debug("YoutubeAPI: Using endpoint: \"#{endpoint}\"")
|
LOGGER.debug("YoutubeAPI: Using endpoint: \"#{endpoint}\"")
|
||||||
LOGGER.trace("YoutubeAPI: ClientConfig: #{client_config}")
|
LOGGER.trace("YoutubeAPI: ClientConfig: #{client_config}")
|
||||||
|
Loading…
Reference in New Issue
Block a user