Comparing version 0.0.32 to 0.0.33
@@ -200,7 +200,7 @@ "use strict"; | ||
const html = playPage.data; | ||
const varFind = html.indexOf("var ytInitialPlayerResponse ="); | ||
const varFind = html.indexOf("var ytInitialPlayerResponse = {"); | ||
const scriptStart = helpers_1.default.getIndexAfter(">", helpers_1.default.getIndexBefore("<script", varFind, html), html) + 1; | ||
const scriptEnd = helpers_1.default.getIndexAfter("</script>", varFind, html); | ||
const scriptBetween = html.substring(scriptStart, scriptEnd); | ||
const script = scriptBetween.substring(0, scriptBetween.lastIndexOf("};var") + 2); | ||
const script = scriptBetween.substring(0, scriptBetween.lastIndexOf("};") + 2); | ||
const scriptFunc = new Function(script + " return ytInitialPlayerResponse;"); | ||
@@ -207,0 +207,0 @@ const playerJSON = scriptFunc(); |
{ | ||
"name": "iyoutube", | ||
"version": "0.0.32", | ||
"version": "0.0.33", | ||
"description": "The ultimate unofficial YouTube API Client for Javascript", | ||
@@ -5,0 +5,0 @@ "main": "output/main.js", |
@@ -259,7 +259,7 @@ import { DEFAULT_CLIENT_VERSION, DEFAULT_USER_AGENT, ENDPOINT_COMMENT_CREATE, ENDPOINT_DISLIKE, ENDPOINT_LIKE, ENDPOINT_NEXT, ENDPOINT_PLAYER, ENDPOINT_RATING, ENDPOINT_REMOVELIKE, ENDPOINT_WATCHPAGE } from "../constants"; | ||
const varFind = html.indexOf("var ytInitialPlayerResponse ="); //Locate the Var Definition | ||
const varFind = html.indexOf("var ytInitialPlayerResponse = {"); //Locate the Var Definition | ||
const scriptStart = helpers.getIndexAfter(">", helpers.getIndexBefore("<script", varFind, html), html) + 1; //Get Script Tag Before | ||
const scriptEnd = helpers.getIndexAfter("</script>", varFind, html); //Get Script Tag After | ||
const scriptBetween = html.substring(scriptStart, scriptEnd); //Get Script (between both Tags) | ||
const script = scriptBetween.substring(0, scriptBetween.lastIndexOf("};var") + 2); | ||
const script = scriptBetween.substring(0, scriptBetween.lastIndexOf("};") + 2); | ||
@@ -266,0 +266,0 @@ const scriptFunc = new Function(script + " return ytInitialPlayerResponse;"); //Parse the Functions Inside |
240585