diff --git a/package-lock.json b/package-lock.json index 9ab171e..a960909 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@vyla-entertainment/sdk", - "version": "1.5.0", + "version": "1.6.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@vyla-entertainment/sdk", - "version": "1.5.0", + "version": "1.6.0", "license": "CC-BY-NC-4.0", "devDependencies": { "dotenv": "^17.4.2" diff --git a/package.json b/package.json index 474f578..14ed0be 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@vyla-entertainment/sdk", - "version": "1.5.0", + "version": "1.6.0", "scripts": { "test": "node test/index.js" }, @@ -29,4 +29,4 @@ "publishConfig": { "access": "public" } -} \ No newline at end of file +} diff --git a/src/sdk.d.ts b/src/sdk.d.ts index d547113..846d839 100644 --- a/src/sdk.d.ts +++ b/src/sdk.d.ts @@ -94,7 +94,7 @@ export default class VylaSDK { s?: number | null, e?: number | null, clientIP?: string | null - ): Promise<{allUrls: StreamResult[]}>; + ): Promise; /** * Get subtitles for a movie or TV episode. diff --git a/test/index.js b/test/index.js index 9f1b524..6dda76b 100644 --- a/test/index.js +++ b/test/index.js @@ -7,103 +7,6 @@ import VylaSDK from "../src/sdk.js"; import dotenv from "dotenv"; dotenv.config(); -const CONFIG = { - DEBUG: true, // Set to true to print outgoing requests, headers, formats, and responses - - MOVIE_ID: "550", // Movie TMDB ID to test - TV_ID: "37854", // TV TMDB ID to test, for anime I recommend using a random ID like 37854 - TV_SEASON: "1", // TV Season to test - TV_EPISODE: "1", // TV Episode to test - STREAM_SOURCE: "", // Source key to test - - TEST_SUBTITLE: false, // Toggle subtitle testing - TEST_DOWNLOAD: false, // Toggle download testing - TEST_MOVIE: false, // Toggle movie testing - TEST_TV: true // Toggle TV testing -}; - -// debug -if (CONFIG.DEBUG) { - const originalFetch = globalThis.fetch; - - const debugFile = path.resolve("test/debug-output.json"); - fs.mkdirSync(path.dirname(debugFile), { recursive: true }); - - const logs = []; - - const save = () => { - fs.writeFileSync(debugFile, JSON.stringify(logs, null, 2)); - }; - - globalThis.fetch = async (input, init) => { - const url = typeof input === "string" ? input : input?.url || String(input); - - const request = { - timestamp: new Date().toISOString(), - request: { - url, - method: init?.method || "GET", - headers: init?.headers || {}, - body: init?.body || null - } - }; - - console.log("\nRequest:"); - console.log(`URL: ${url}`); - console.log(`Method: ${request.request.method}`); - if (init?.headers) console.log("Headers:", JSON.stringify(init.headers, null, 2)); - if (init?.body) console.log("Body:", init.body); - - try { - const response = await originalFetch(input, init); - - request.response = { - status: response.status, - statusText: response.statusText - }; - - console.log("\nResponse:"); - console.log(`URL: ${url}`); - console.log(`Status: ${response.status} ${response.statusText}`); - - try { - const clone = response.clone(); - const text = await clone.text(); - - try { - request.response.format = "json"; - request.response.body = JSON.parse(text); - - console.log("Format: JSON"); - console.log(JSON.stringify(request.response.body, null, 2)); - } catch { - request.response.format = "text"; - request.response.body = text; - - console.log("Format: Text/HTML"); - console.log(text.substring(0, 800) + (text.length > 800 ? "..." : "")); - } - } catch (err) { - request.response.body = ``; - } - - logs.push(request); - save(); - - return response; - } catch (err) { - request.error = err.message; - logs.push(request); - save(); - - console.log(`URL: ${url}`); - console.log(`Error: ${err.message}`); - - throw err; - } - }; -} - const sdk = new VylaSDK({ tmdbApiKey: process.env.TMDB_API_KEY }); @@ -182,4 +85,4 @@ if (CONFIG.TEST_TV) { } } else { console.log("\nSkipped Stream Test"); -} \ No newline at end of file +}