Skip to content

Commit

Permalink
keep reference to initialData
Browse files Browse the repository at this point in the history
  • Loading branch information
kvnp committed Aug 9, 2021
1 parent 74fb21d commit 5c7e50f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions react/modules/remote/Extractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,18 @@ export function extractConfiguration(html) {

let setMessage = msgs => ytData.MESSAGES = msgs;
let initialData = [];
this.initialData = initialData;

while (html.includes("<script")) {
html = html.slice(html.indexOf("<script"));

let part = html.slice(html.indexOf(">"), html.indexOf("</"));

while (part.includes("initialData.push(")) {
let dataOne = part.indexOf("initialData.push(") + 17;
let dataTwo = part.indexOf(");");
initialData.push(part.slice(dataOne, dataTwo));
part = part.slice(dataTwo + 2);
let dataOne = part.indexOf("initialData.push(");
let dataTwo = part.indexOf(");") + 2;
let slice = part.slice(dataOne, dataTwo);
eval(slice);
part = part.slice(dataTwo);
}

if (part.includes("ytcfg.set(")) {
Expand Down

0 comments on commit 5c7e50f

Please sign in to comment.