Add ability to set po_token and visitordata ID

This commit is contained in:
Emilien Devos
2024-07-24 19:28:47 +02:00
parent 325561e755
commit 53223f99b0
4 changed files with 36 additions and 3 deletions

View File

@@ -320,6 +320,10 @@ module YoutubeAPI
client_context["client"]["platform"] = platform
end
if CONFIG.visitor_data.is_a?(String)
client_context["client"]["visitorData"] = CONFIG.visitor_data.as(String)
end
return client_context
end
@@ -467,6 +471,9 @@ module YoutubeAPI
"html5Preference": "HTML5_PREF_WANTS",
},
},
"serviceIntegrityDimensions" => {
"poToken" => CONFIG.po_token,
},
}
# Append the additional parameters if those were provided
@@ -599,6 +606,10 @@ module YoutubeAPI
headers["User-Agent"] = user_agent
end
if CONFIG.visitor_data.is_a?(String)
headers["X-Goog-Visitor-Id"] = CONFIG.visitor_data.as(String)
end
# Logging
LOGGER.debug("YoutubeAPI: Using endpoint: \"#{endpoint}\"")
LOGGER.trace("YoutubeAPI: ClientConfig: #{client_config}")