diff --git a/providers/protonMovies/meta.ts b/providers/protonMovies/meta.ts index ec18fbc..c9d1d05 100644 --- a/providers/protonMovies/meta.ts +++ b/providers/protonMovies/meta.ts @@ -9,8 +9,10 @@ export const getMeta = async function ({ }): Promise { try { const { axios, cheerio, getBaseUrl } = providerContext; + const baseUrl = await getBaseUrl("protonMovies"); + console.log("all", link); - const res = await axios.get(link); + const res = await axios.get(`${baseUrl}${link}`); const data = res.data; function decodeHtml(encodedArray: string[]): string { @@ -62,7 +64,6 @@ export const getMeta = async function ({ .slice(0, 3) .get(); - const baseUrl = await getBaseUrl("protonMovies"); const links: Link[] = []; if (type === "movie") { diff --git a/providers/protonMovies/posts.ts b/providers/protonMovies/posts.ts index 1afc23b..00c0916 100644 --- a/providers/protonMovies/posts.ts +++ b/providers/protonMovies/posts.ts @@ -49,29 +49,29 @@ async function posts({ axios: ProviderContext["axios"]; cheerio: ProviderContext["cheerio"]; }): Promise { - function decodeHtml(encodedArray: string[]): string { - // Join array elements into a single string - const joined = encodedArray.join(""); - - // Replace escaped quotes - const unescaped = joined.replace(/\\"/g, '"').replace(/\\'/g, "'"); - - // Remove remaining escape characters - const cleaned = unescaped - .replace(/\\n/g, "\n") - .replace(/\\t/g, "\t") - .replace(/\\r/g, "\r"); - - // Convert literal string representations back to characters - const decoded = cleaned - .replace(/"/g, '"') - .replace(/</g, "<") - .replace(/>/g, ">") - .replace(/&/g, "&"); - - return decoded; - } try { + function decodeHtml(encodedArray: string[]): string { + // Join array elements into a single string + const joined = encodedArray.join(""); + + // Replace escaped quotes + const unescaped = joined.replace(/\\"/g, '"').replace(/\\'/g, "'"); + + // Remove remaining escape characters + const cleaned = unescaped + .replace(/\\n/g, "\n") + .replace(/\\t/g, "\t") + .replace(/\\r/g, "\r"); + + // Convert literal string representations back to characters + const decoded = cleaned + .replace(/"/g, '"') + .replace(/</g, "<") + .replace(/>/g, ">") + .replace(/&/g, "&"); + + return decoded; + } const res = await axios.get(url, { headers: { referer: baseUrl,