feat(Session): Allow using a fixed user agent for InnerTube requests (#876)

Certain attestation challenges are bound to the user agent (e.g, WebPo), so we can't just use a random one for every request.
This commit is contained in:
Luan
2025-01-17 06:06:36 -03:00
committed by GitHub
parent 83de198351
commit 4d36655b2d
2 changed files with 20 additions and 5 deletions

View File

@@ -3,7 +3,6 @@ import * as Constants from './Constants.js';
import {
Platform,
generateSidAuth,
getRandomUserAgent,
InnertubeError,
getCookie
} from './Utils.js';
@@ -68,7 +67,7 @@ export default class HTTPClient {
}
if (Platform.shim.server) {
request_headers.set('User-Agent', getRandomUserAgent('desktop'));
request_headers.set('User-Agent', this.#session.user_agent || '');
request_headers.set('Origin', request_url.origin);
}