mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-19 20:41:17 +00:00
chore: use timestamp in seconds for visitorData
YouTube also accepts timestamps in milliseconds, but since all clients generate visitorData with timestamps in seconds then the library should do the same.
This commit is contained in:
@@ -44,7 +44,7 @@ class SessionBuilder {
|
||||
const user_agent = new UserAgent({ deviceCategory: 'desktop' });
|
||||
|
||||
const id = Utils.generateRandomString(11);
|
||||
const timestamp = new Date().getTime();
|
||||
const timestamp = Math.floor(Date.now() / 1000);
|
||||
|
||||
const visitor_data = Proto.encodeVisitorData(id, timestamp);
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ class Proto {
|
||||
*/
|
||||
static encodeVisitorData(id, timestamp) {
|
||||
const buf = messages.VisitorData.encode({ id, timestamp });
|
||||
return encodeURIComponent(Buffer.from(buf).toString('base64'));
|
||||
return encodeURIComponent(Buffer.from(buf).toString('base64').replace(/\//g, '_'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user