Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ZemerTeam/zemer-cipher/llms.txt

Use this file to discover all available pages before exploring further.

FunctionNameExtractor locates the signature and n-transform functions within a downloaded YouTube player_ias.vflset JS file. It checks PlayerConfigStore first — using validated, CDN-proven configs — and falls back to heuristic regex patterns only when no config entry is found for the player hash. Package: com.zemer.cipher
Hardcoded configs always take precedence over regex extraction. A false positive from a legacy heuristic pattern cannot shadow a validated config entry. This also means a failed regex match on a known player hash is never a problem — the config path handles it.

Data Classes

SigFunctionInfo

Carries everything the cipher WebView needs to call the signature deobfuscation function.
data class SigFunctionInfo(
    val name: String,
    val constantArg: Int?,
    val constantArgs: List<Int>? = null,
    val preprocessFunc: String? = null,
    val preprocessArgs: List<Int>? = null,
    val isHardcoded: Boolean = false,
    val jsExpression: String? = null
)
name
String
The extracted or sentinel function name. When jsExpression is non-null this is a sentinel value ("_expr_sig") and is not used for JS calls — jsExpression is used instead.
constantArg
Int?
A single integer constant argument passed as the first parameter to the sig function. Populated by legacy regex extraction. null for expression-based configs and when not applicable.
constantArgs
List<Int>?
Multiple integer constant arguments passed to the sig function. Used for patterns that require more than one constant.
preprocessFunc
String?
Name of a preprocessing function to call on the signature before passing it to the main sig function. null when not required.
preprocessArgs
List<Int>?
Integer constant arguments for preprocessFunc. null when preprocessFunc is null.
isHardcoded
Boolean
true when this info came from a PlayerConfigStore entry rather than from regex extraction. CipherWebView uses this flag to choose the correct export injection strategy.
jsExpression
String?
Full JS expression for VM-dispatch players where no named function can be extracted. The placeholder INPUT is replaced with the obfuscated signature at export time. When non-null, this is used instead of name / constantArg.

NFunctionInfo

Carries everything the cipher WebView needs to call the n-transform function.
data class NFunctionInfo(
    val name: String,
    val arrayIndex: Int?,
    val constantArgs: List<Int>? = null,
    val isHardcoded: Boolean = false,
    val jsExpression: String? = null
)
name
String
The extracted or sentinel function name. When jsExpression is non-null this is a sentinel value ("_expr_n") and is not used for JS calls.
arrayIndex
Int?
Array index used when the n-transform function is stored in an array rather than as a top-level binding. null when the function is accessed directly by name.
constantArgs
List<Int>?
Integer constant arguments prepended when calling the n-transform function. Populated when the function requires additional parameters beyond the n-value itself.
isHardcoded
Boolean
true when this info came from a PlayerConfigStore entry rather than from regex extraction.
jsExpression
String?
Full JS expression for the n-transform. INPUT is replaced with the n-value at export time. When non-null, this is used instead of name / arrayIndex.

HardcodedPlayerConfig

The in-memory representation of a single validated player config entry. Instances are created by PlayerConfigParser and stored in PlayerConfigStore.
data class HardcodedPlayerConfig(
    val sigFuncName: String,
    val sigConstantArg: Int?,
    val sigConstantArgs: List<Int>? = null,
    val sigPreprocessFunc: String? = null,
    val sigPreprocessArgs: List<Int>? = null,
    val sigJsExpression: String?,
    val nFuncName: String,
    val nArrayIndex: Int?,
    val nConstantArgs: List<Int>?,
    val nJsExpression: String?,
    val signatureTimestamp: Int
)
sigFuncName
String
Sentinel sig function name. Set to "_expr_sig" for all config-file-sourced entries.
sigConstantArg
Int?
Single integer constant argument for the sig function. null for expression-based configs.
sigConstantArgs
List<Int>?
Multiple integer constant arguments for the sig function. null for expression-based configs.
sigPreprocessFunc
String?
Name of a preprocessing function applied to the signature before the main sig call. null for config-file-sourced entries.
sigPreprocessArgs
List<Int>?
Arguments for sigPreprocessFunc. null when sigPreprocessFunc is null.
sigJsExpression
String?
The sig call expression from the config file (e.g. "mP(4,155,INPUT)"). INPUT is replaced with the obfuscated signature at export time.
nFuncName
String
Sentinel n-function name. Set to "_expr_n" for all config-file-sourced entries.
nArrayIndex
Int?
Array index for the n-transform function. null for config-file-sourced entries (the IIFE handles indexing internally).
nConstantArgs
List<Int>?
Integer constant arguments for the n-transform function. null for config-file-sourced entries.
nJsExpression
String?
The n-transform IIFE built by PlayerConfigParser.buildNJsExpression. INPUT is replaced with the n-value at export time.
signatureTimestamp
Int
The signatureTimestamp (sts) value for this player. Sent in InnerTube /player API requests.

Functions

hasQArrayObfuscation

fun hasQArrayObfuscation(playerJs: String): Boolean
Checks whether the player JS uses the Q-array obfuscation pattern — a var Q = "...".split("}") construct. analyzePlayerJs records this as the hasQArrayObfuscation field in the returned PlayerAnalysis.
playerJs
String
required
The full text of the YouTube player_ias.vflset JavaScript file.
Returns: true if the Q-array pattern is detected, false otherwise.

extractSigFunctionInfo

fun extractSigFunctionInfo(playerJs: String, knownHash: String? = null): SigFunctionInfo?
Extracts signature function information from player JS. Config lookup is tried first; if no config is found for the resolved hash, legacy unanchored regex patterns are tried in order. Returns null if both paths fail.
playerJs
String
required
The full text of the YouTube player_ias.vflset JavaScript file.
knownHash
String?
An already-known 8-hex player hash (e.g. from PlayerJsFetcher). When provided, the hash extraction step is skipped. When null, extractPlayerHash is called first.

extractNFunctionInfo

fun extractNFunctionInfo(playerJs: String, knownHash: String? = null): NFunctionInfo?
Extracts n-transform function information from player JS. Same config-first precedence as extractSigFunctionInfo. Returns null if both paths fail.
playerJs
String
required
The full text of the YouTube player_ias.vflset JavaScript file.
knownHash
String?
An already-known 8-hex player hash. When null, extractPlayerHash is called first.

extractSignatureTimestamp

fun extractSignatureTimestamp(playerJs: String, knownHash: String? = null): Int?
Extracts the signatureTimestamp (sts) value. Three sources are tried in priority order:
  1. Anchored signatureTimestamp literal in the JS (e.g. signatureTimestamp:20613) — the player’s own embedded field, immune to config typos or stale remote pushes.
  2. Config sts value — used when the JS literal is absent, for players that don’t embed the field directly.
  3. Loose sts pattern — a last-resort unanchored search that can false-match anywhere in ~2 MB of JS; only used when the other two paths both fail.
Returns null if all three sources fail.
playerJs
String
required
The full text of the YouTube player_ias.vflset JavaScript file.
knownHash
String?
An already-known 8-hex player hash used to look up the config sts. When null, extractPlayerHash is called if needed.

analyzePlayerJs

fun analyzePlayerJs(playerJs: String, knownHash: String? = null): PlayerAnalysis
Runs a full analysis of the player JS in a single call, returning a PlayerAnalysis that bundles all extracted values. Internally calls extractPlayerHash, hasQArrayObfuscation, extractSigFunctionInfo, extractNFunctionInfo, and extractSignatureTimestamp.
playerJs
String
required
The full text of the YouTube player_ias.vflset JavaScript file.
knownHash
String?
An already-known 8-hex player hash. When provided, hash extraction is skipped and this value is used for all config lookups.
Returns: PlayerAnalysis(playerHash, hasQArrayObfuscation, sigInfo, nFuncInfo, signatureTimestamp)

extractPlayerHash

fun extractPlayerHash(playerJs: String): String?
Extracts the 8-hex player hash from the JS content using a list of URL patterns (looking for /player/<hash>/ in jsUrl, player_ias.vflset, and /s/player/ patterns). If all URL patterns fail, falls back to computing the MD5 of the first 10 000 characters of the JS and returning the first 4 bytes as an 8-hex string. This MD5-based hash is registered as an alias in config entries.
playerJs
String
required
The full text of the YouTube player_ias.vflset JavaScript file.

getHardcodedConfig

fun getHardcodedConfig(playerHash: String): HardcodedPlayerConfig?
Looks up the player hash in PlayerConfigStore. Returns the HardcodedPlayerConfig if found, or null if the hash (and none of its aliases) is in the current table.
playerHash
String
required
The 8-hex player hash to look up. Both primary hashes and alias hashes are accepted.

Build docs developers (and LLMs) love