const fs = require('fs'); const path = 'C:/Users/user/Documents/מעקף פרוקסי 2.0/worker.js'; let w = fs.readFileSync(path, 'utf8'); const cookieLine = fs .readFileSync('C:/Users/user/Documents/מעקף פרוקסי 2.0/builtin_yt_cookies.inc.js', 'utf8') .trim() .replace(/;?\s*$/, ';'); w = w.replace(/const SW_VERSION = \d+;/, 'const SW_VERSION = 93;'); w = w.replace(/sw\.js\?v=\d+/g, 'sw.js?v=93'); if (!/const BUILTIN_YOUTUBE_COOKIE/.test(w)) throw new Error('no cookie const'); w = w.replace(/const BUILTIN_YOUTUBE_COOKIE\s*=\s*[\s\S]*?;\r?\n/, cookieLine + '\n'); fs.writeFileSync(path, w); console.log({ sw: /SW_VERSION = (\d+)/.exec(w)[1], hasNew: /UL6Vh_S22fpeIdM8/.test(w), hasOld: /AiSh3wKRES9SAOlNvmw816Z1SJLccGwM/.test(w), swjs: (w.match(/sw\.js\?v=\d+/g) || []).slice(0, 5), });