[YouTube] Add utcOffsetMinutes to all InnerTube payloads

This should make returned dates consistent between timezones and countries on
which the extractor is ran.

It was previously only set on YouTube Music search continuations.
This commit is contained in:
AudricV 2023-10-07 15:04:36 +02:00
parent d97c9e0db1
commit 2c941794c0
No known key found for this signature in database
GPG Key ID: DA92EC7905614198
2 changed files with 8 additions and 1 deletions

View File

@ -552,6 +552,7 @@ public final class YoutubeParsingHelper {
.value("clientName", "WEB") .value("clientName", "WEB")
.value("clientVersion", HARDCODED_CLIENT_VERSION) .value("clientVersion", HARDCODED_CLIENT_VERSION)
.value("platform", "DESKTOP") .value("platform", "DESKTOP")
.value("utcOffsetMinutes", 0)
.end() .end()
.object("request") .object("request")
.array("internalExperimentFlags") .array("internalExperimentFlags")
@ -791,6 +792,7 @@ public final class YoutubeParsingHelper {
.value("hl", "en-GB") .value("hl", "en-GB")
.value("gl", "GB") .value("gl", "GB")
.value("platform", "DESKTOP") .value("platform", "DESKTOP")
.value("utcOffsetMinutes", 0)
.end() .end()
.object("request") .object("request")
.array("internalExperimentFlags") .array("internalExperimentFlags")
@ -1302,7 +1304,8 @@ public final class YoutubeParsingHelper {
.value("clientName", "WEB") .value("clientName", "WEB")
.value("clientVersion", getClientVersion()) .value("clientVersion", getClientVersion())
.value("originalUrl", "https://www.youtube.com") .value("originalUrl", "https://www.youtube.com")
.value("platform", "DESKTOP"); .value("platform", "DESKTOP")
.value("utcOffsetMinutes", 0);
if (visitorData != null) { if (visitorData != null) {
builder.value("visitorData", visitorData); builder.value("visitorData", visitorData);
@ -1350,6 +1353,7 @@ public final class YoutubeParsingHelper {
.value("androidSdkVersion", 34) .value("androidSdkVersion", 34)
.value("hl", localization.getLocalizationCode()) .value("hl", localization.getLocalizationCode())
.value("gl", contentCountry.getCountryCode()) .value("gl", contentCountry.getCountryCode())
.value("utcOffsetMinutes", 0)
.end() .end()
.object("request") .object("request")
.array("internalExperimentFlags") .array("internalExperimentFlags")
@ -1390,6 +1394,7 @@ public final class YoutubeParsingHelper {
.value("osVersion", "17.1.2.21B101") .value("osVersion", "17.1.2.21B101")
.value("hl", localization.getLocalizationCode()) .value("hl", localization.getLocalizationCode())
.value("gl", contentCountry.getCountryCode()) .value("gl", contentCountry.getCountryCode())
.value("utcOffsetMinutes", 0)
.end() .end()
.object("request") .object("request")
.array("internalExperimentFlags") .array("internalExperimentFlags")
@ -1420,6 +1425,7 @@ public final class YoutubeParsingHelper {
.value("platform", "TV") .value("platform", "TV")
.value("hl", localization.getLocalizationCode()) .value("hl", localization.getLocalizationCode())
.value("gl", contentCountry.getCountryCode()) .value("gl", contentCountry.getCountryCode())
.value("utcOffsetMinutes", 0)
.end() .end()
.object("thirdParty") .object("thirdParty")
.value("embedUrl", "https://www.youtube.com/watch?v=" + videoId) .value("embedUrl", "https://www.youtube.com/watch?v=" + videoId)

View File

@ -90,6 +90,7 @@ public class YoutubeMusicSearchExtractor extends SearchExtractor {
.value("hl", "en-GB") .value("hl", "en-GB")
.value("gl", getExtractorContentCountry().getCountryCode()) .value("gl", getExtractorContentCountry().getCountryCode())
.value("platform", "DESKTOP") .value("platform", "DESKTOP")
.value("utcOffsetMinutes", 0)
.end() .end()
.object("request") .object("request")
.array("internalExperimentFlags") .array("internalExperimentFlags")