feat(youtube): add cookiePath config support#203
feat(youtube): add cookiePath config support#203doyimmiuink wants to merge 1 commit intoPerformanC:devfrom
Conversation
|
I want the terms and conditions, like the step-by-step process and which clients this bypassed, and also what types of cookies are valid for this, are they incognito cookies? Those without rotation? Even if you're already logged into the account without being in incognito mode, how long does it last? Do they expire? Is there a way to fix it if it expires? And for debugging, add detailed debug logs if possible. |
|
Regarding cookiePath: |
|
That's very interesting. One thing you mentioned was that you have to restart to update cookies if something specific expires. Would it be possible to add a parameter to an existing endpoint, where we can basically send the refreshToken via patch, and perhaps add a parameter to send the new cookies? |
|
The problem is that the patch I made didn't upload either. Could I use |
|
Very interesting to me, but, on the common.ts file, can you add support for itags 774 and 141 ? but Thats just my opinion ^^, everything else looks interesting :) |
|
Sure |
3db12c9 to
3e6a2a8
Compare
|
done |
|
Look at the files in the new --force |
b3a218d to
4148522
Compare
|
These changes don't match the title. |
1Lucas1apk
left a comment
There was a problem hiding this comment.
These changes don't match the title.
…/141
feat(youtube): cookiePath config support
src/typings/sources/youtube.types.ts: add cookiePath? with JSDoc
config.default.js: add cookiePath to youtube block
src/sources/youtube/YouTube.ts:
- import readFileSync from node:fs
- add private cookieHeader field
- constructor: init cookieHeader = null
- initialize: parse Netscape or inline cookie format
- _fetchVisitorData: use this.cookieHeader ?? hardcoded fallback
feat(server): global httpProxy config
config.default.js: add httpProxy to server block
src/typings/config/config.types.ts: add httpProxy? to ServerConfig
src/typings/utils.types.ts: add options?.server?.httpProxy
src/utils.ts: makeRequest falls back to server.httpProxy
src/index.ts: import makeRequest + _testProxyConnectivity
feat(youtube): HQ audio format tags 774 and 141
src/sources/youtube/common.ts: add 774/141 to high/medium priority
4148522 to
7b83ef0
Compare
|
The title was updated to reflect all three changes included in this push: cookiePath, global httpProxy, and HQ audio tags 774/141. All three are present in the latest commit (7b83ef0) — you can check the Files changed tab to confirm. |
| httpProxy: { | ||
| enabled: false, // route all outbound HTTP requests through a proxy | ||
| url: '', // e.g. 'http://user:pass@host:3128' or 'socks5://host:1080' | ||
| username: '', | ||
| password: '' | ||
| } |
There was a problem hiding this comment.
I will not accept a global proxy; there are already separate systems for that.
|
|
||
| // global-http-proxy: log proxy and test connectivity at startup | ||
| const proxyCfg = options?.server?.httpProxy | ||
| if (proxyCfg?.enabled && proxyCfg.url) { | ||
| logger('info', 'Proxy', `HTTP proxy enabled: ${proxyCfg.url}`) | ||
| this._testProxyConnectivity(proxyCfg.url) | ||
| } | ||
| } | ||
|
|
||
| /** @internal */ | ||
| private _testProxyConnectivity(proxyUrl: string): void { | ||
| makeRequest('http://connectivitycheck.gstatic.com/generate_204', { | ||
| proxy: { url: proxyUrl } | ||
| }) | ||
| .then(() => { | ||
| logger('info', 'Proxy', `Connected successfully via ${proxyUrl}`) | ||
| }) | ||
| .catch((err: Error) => { | ||
| logger('warn', 'Proxy', `Proxy connectivity check failed (${proxyUrl}): ${err.message}`) | ||
| }) |
| /** Global HTTP proxy server options. */ | ||
| options?: { | ||
| server?: { | ||
| httpProxy?: { | ||
| enabled: boolean | ||
| url: string | ||
| username?: string | ||
| password?: string | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
I will not accept a global proxy; there are already separate systems for that.
|
|
||
| /** | ||
| * Global HTTP proxy for all outbound NodeLink requests. | ||
| * Supports http, https, and socks5 URLs. | ||
| */ | ||
| httpProxy?: { | ||
| enabled: boolean | ||
| url: string | ||
| username?: string | ||
| password?: string | ||
| } |
There was a problem hiding this comment.
I will not accept a global proxy; there are already separate systems for that.
| high: [774, 141, 251, 250, 140], | ||
| medium: [141, 251, 250, 140], |
There was a problem hiding this comment.
A question was raised about ITAgs; it doesn't mean they should be added as a standard feature, it's something that only appears on YouTube Premium accounts to complete the setup, and NodeLink already has a system for selecting the best ITAgs, so this is redundant.
|
It's all nonsensical, to be honest, it seems like it was done without any research whatsoever. |
|
The 774/141 tags were added based on a direct suggestion from @ToddyTheNoobDud in this same PR thread. The httpProxy mirrors Lavalink's existing httpConfig proxy behaviour, which is well documented. Both changes were made in response to feedback, not without research. |
|
But do you only want the cookiepath? |
|
Yes, it's a lack of study. If you had analyzed it, you would have realized that NodeLink already has a way to add this itag indirectly. Even though Toddy mentioned it, it was just feedback that could possibly be added, not directly to the code—that would be redundant. And HTTP proxy wasn't requested and won't be accepted, and we're not here to exactly follow LavaLink! This is NodeLink; client compatibility is one thing. |
|
And the pull request title simply says "supports cookie path," that's all. |
|
Cansei de falar inglês, serei brevemente no português!! Por que mais que a língua seja minha abordagem, atualmente eu estou pegando ideias e totalmente trazida do lavalink e mudando algumas coisa para o nodeLink, isso é fato!! Porém eu não sabia que já tinha itag no código, e sobre o HttpProxy eu apenas usei como inspiração, mas ok. Só quer o CookiePath no código então? Psoso fazer um último pull resquest adicionando só ele? Ou ele já foi aceito? |
|
This idea will still need to be tested in the long term; I will analyze it myself when I have time. Just correct what was requested. |



Summary
Adds support for a
cookiePath(Netscape cookies.txt) to NodeLink's YouTube source, allowing operators to provide real account cookies for authenticated YouTube requests.Motivation
Changes
config.default.jssrc/typings/sources/youtube.types.tsYouTubeSourceConfig: addedcookiePath?field with JSDoc.src/sources/youtube/YouTube.tscookiePathat startup (supports both Netscape tab-separated format and inlinekey=value; key=valueformat)._fetchVisitorData()instead of the hardcoded scraping cookie.cookiePathis not set or fails to parse.Flow
Checkmarks