Skip to content

Commit 3b4aa72

Browse files
committed
fix: enhance player request handling with dynamic signature timestamp
1 parent 3da9059 commit 3b4aa72

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

src/sources/youtube/clients/WebParentTools.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,28 @@ export default class WebParentTools extends BaseClient {
8484
)
8585
}
8686

87+
requirePlayerScript() {
88+
return true
89+
}
90+
8791
async _makePlayerRequest(videoId, context, headers, cipherManager) {
8892
const requestBody = {
8993
context: this.getClient(context),
9094
videoId: videoId,
9195
contentCheckOk: true,
92-
racyCheckOk: true,
93-
playbackContext: {
94-
contentPlaybackContext: {
95-
signatureTimestamp: 19700
96+
racyCheckOk: true
97+
}
98+
99+
if (this.requirePlayerScript() && cipherManager) {
100+
const playerScript = await cipherManager.getCachedPlayerScript()
101+
if (playerScript?.url) {
102+
const signatureTimestamp = await cipherManager.getTimestamp(
103+
playerScript.url
104+
)
105+
requestBody.playbackContext = {
106+
contentPlaybackContext: {
107+
signatureTimestamp
108+
}
96109
}
97110
}
98111
}

0 commit comments

Comments
 (0)