@mkterswingman/5mghost-yonder 0.0.31 → 0.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -251,8 +251,17 @@ export async function readImportedBrowserCookies(candidate, chromium, deps) {
251
251
  "--headless=new",
252
252
  "--no-first-run",
253
253
  "--no-default-browser-check",
254
- // Why: about:blank avoids network requests that trigger Google token rotation,
255
- // which would invalidate the user's real Chrome YouTube session.
254
+ // Why: these flags prevent Chrome's background services from contacting Google
255
+ // servers, which would trigger Account Reconcilor / token rotation and invalidate
256
+ // the user's real Chrome YouTube session.
257
+ "--disable-sync",
258
+ "--disable-background-networking",
259
+ "--disable-features=AccountReconcilor,IdentityManager",
260
+ "--disable-client-side-phishing-detection",
261
+ "--disable-component-update",
262
+ "--disable-extensions",
263
+ "--disable-breakpad",
264
+ "--metrics-recording-only",
256
265
  "about:blank",
257
266
  ], {
258
267
  detached: true,
@@ -1,4 +1,19 @@
1
1
  import { existsSync, readFileSync } from "node:fs";
2
+ /**
3
+ * Domains relevant to YouTube authentication.
4
+ * Only cookies matching these patterns are written to cookies.txt.
5
+ */
6
+ const YOUTUBE_COOKIE_DOMAINS = [
7
+ "youtube.com",
8
+ "google.com",
9
+ "googleapis.com",
10
+ "googlevideo.com",
11
+ "ytimg.com",
12
+ ];
13
+ function isYouTubeDomain(domain) {
14
+ const normalized = domain.startsWith(".") ? domain.slice(1) : domain;
15
+ return YOUTUBE_COOKIE_DOMAINS.some((yt) => normalized === yt || normalized.endsWith(`.${yt}`));
16
+ }
2
17
  export function cookiesToNetscape(cookies) {
3
18
  const lines = [
4
19
  "# Netscape HTTP Cookie File",
@@ -7,10 +22,16 @@ export function cookiesToNetscape(cookies) {
7
22
  "",
8
23
  ];
9
24
  for (const c of cookies) {
25
+ // Why: CDP returns all domains; yt-dlp only needs YouTube/Google cookies.
26
+ // Non-YouTube cookies cause warning spam and bloat the file.
27
+ if (!isYouTubeDomain(c.domain))
28
+ continue;
10
29
  const domain = c.domain.startsWith(".") ? c.domain : c.domain;
11
30
  const includeSubdomains = c.domain.startsWith(".") ? "TRUE" : "FALSE";
12
31
  const secure = c.secure ? "TRUE" : "FALSE";
13
- const expiry = Math.floor(c.expires);
32
+ // Why: CDP uses -1 for session cookies, but Netscape format uses 0.
33
+ // yt-dlp skips entries with negative expires as "invalid".
34
+ const expiry = c.expires < 0 ? 0 : Math.floor(c.expires);
14
35
  lines.push(`${domain}\t${includeSubdomains}\t${c.path}\t${secure}\t${expiry}\t${c.name}\t${c.value}`);
15
36
  }
16
37
  return lines.join("\n") + "\n";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mkterswingman/5mghost-yonder",
3
- "version": "0.0.31",
3
+ "version": "0.0.33",
4
4
  "description": "Internal MCP client with local data tools and remote API proxy",
5
5
  "type": "module",
6
6
  "bin": {