Skip to content

Commit 4b77d70

Browse files
author
laestrygonian
committed
Update solver v7
1 parent 817e0ad commit 4b77d70

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

solver.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
// =============================================================================
2-
// YouTube N-Parameter Solver — Remote Module v4 -> v6
2+
// YouTube N-Parameter Solver — Remote Module v4 -> v7
33
// Hosted at: https://github.com/solarizeddev/firedown-solver
44
// The background.js shell fetches, caches, and executes this module.
55
//
66
// v6 additions: preprocessCipher() for signature cipher detection on base.js
77
// The cipher function is obfuscated with the same string table + XOR pattern
88
// as the n-param function, but lives in the 'main' player variant (base.js)
99
// rather than the TV variant.
10+
//
11+
// v7 additions: preprocessPlayer() now supports base.js (main player variant)
12+
// The TV player no longer contains the n-param challenge function as of
13+
// player version ace4b2f8 (March 2026). findStringTable search window
14+
// increased to 5000 chars and 'use strict' fallback added to preprocessPlayer
15+
// to handle base.js copyright header offset.
1016
// =============================================================================
11-
var SOLVER_VERSION = 6;
17+
var SOLVER_VERSION = 7;
1218

1319
var SETUP_CODE = [
1420
'if(typeof globalThis.XMLHttpRequest==="undefined"){globalThis.XMLHttpRequest={prototype:{}};}',
@@ -38,7 +44,7 @@ var SETUP_CODE = [
3844
* Handles: "...".split(";"), '...'.split("}"), ["...","..."]
3945
*/
4046
function findStringTable(data) {
41-
var chunk = data.substring(0, 2000);
47+
var chunk = data.substring(0, 5000);
4248
var splitCalls = chunk.matchAll(/\.split\((['"])(.)(\1)\)/g);
4349
for (var sc of splitCalls) {
4450
var delimiter = sc[2], splitPos = sc.index;
@@ -73,7 +79,7 @@ function findStringTable(data) {
7379
* Returns array of { funcName, bases: number[] }
7480
*/
7581
function findCandidates(data, tableVar, splitIdx) {
76-
var earlyChunk = data.substring(0, Math.min(data.length, 30000));
82+
var earlyChunk = data.substring(0, Math.min(data.length, 60000));
7783
var funcDefs = earlyChunk.matchAll(/(?:^|[^a-zA-Z0-9_$])(?:var\s+)?(\w+)=function\((\w+(?:,\w+){2,})\)\{/g);
7884
var candidates = [];
7985
for (var fd of funcDefs) {
@@ -201,6 +207,14 @@ function preprocessPlayer(data, solvedCache) {
201207
probeBody = buildCachedProbe(solvedCache.funcName, solvedCache.r, solvedCache.p);
202208
} else {
203209
var table = findStringTable(data);
210+
// base.js has its string table after copyright comments (~3KB in),
211+
// so try findStringTable on the source starting from 'use strict'
212+
if (!table) {
213+
var usIdx = data.indexOf("'use strict';");
214+
if (usIdx > 0 && usIdx < 10000) {
215+
table = findStringTable(data.substring(usIdx));
216+
}
217+
}
204218
if (table) {
205219
candidates = findCandidates(data, table.tableVar, table.splitIdx);
206220
if (candidates.length > 0) {

0 commit comments

Comments
 (0)