\s*| ([^<]+)<\/a><\/td>\s* | [^<]+<\/td>\s*<\/tr>/g;
let match;
- let index = 0;
+ let index = 1;
while ((match = regex.exec(html)) !== null) {
results.push([
diff --git a/mangafreak/mangafreak.json b/mangafreak/mangafreak.json
index 9d8a857..d788271 100644
--- a/mangafreak/mangafreak.json
+++ b/mangafreak/mangafreak.json
@@ -1,7 +1,7 @@
{
"sourceName": "MangaFreak",
"iconURL": "https://files.catbox.moe/903u7e.png",
- "version": "1.0",
+ "version": "1.0.1",
"language": "English",
"scriptURL": "https://git.luna-app.eu/50n50/sources/raw/branch/main/mangafreak/mangafreak.js",
"author": {
diff --git a/streamingunity/streamingunity.js b/streamingunity/streamingunity.js
index a18d302..901dfee 100644
--- a/streamingunity/streamingunity.js
+++ b/streamingunity/streamingunity.js
@@ -1,230 +1,241 @@
+async function getLandingWebsiteHref() {
+ var response = await soraFetch("https://previtera.vercel.app/");
+ var href = await response.text();
+ return href;
+}
+
async function searchResults(keyword) {
- const response = await soraFetch(
- `https://streamingcommunityz.kitchen/it/archive?search=${keyword}`
- );
- const html = await response.text();
+ const landingUrl = await getLandingWebsiteHref()
- const regex = /]*id="app"[^>]*data-page="([^"]*)"/;
- const match = regex.exec(html);
-
- if (!match || !match[1]) {
- return JSON.stringify([]);
- }
-
- const dataPage = match[1].replaceAll(`"`, `"`);
- const pageData = JSON.parse(dataPage);
- const titles = pageData.props?.titles || [];
-
- const results =
- titles
- .map((item) => {
- const posterImage = item.images?.find((img) => img.type === "poster");
- return {
- title:
- item.name?.replaceAll("amp;", "").replaceAll("'", "'") || "",
- image: posterImage?.filename
- ? `https://cdn.streamingcommunityz.kitchen/images/${posterImage.filename}`
- : "",
- href: `https://streamingcommunityz.kitchen/it/titles/${item.id}-${item.slug}`,
- };
- })
- .filter((item) => item.image) || [];
-
- return JSON.stringify(results);
-}
-
-async function extractDetails(url) {
- const response = await soraFetch(`${url}/season-1`);
- const html = await response.text();
-
- const regex = / ]*id="app"[^>]*data-page="([^"]*)"/;
- const match = regex.exec(html);
-
- if (!match || !match[1]) {
- return JSON.stringify([]);
- }
-
- const dataPage = match[1].replaceAll(`"`, `"`);
- const pageData = JSON.parse(dataPage);
- const titleData = pageData.props?.title;
-
- if (!titleData) {
- return JSON.stringify([]);
- }
-
- return JSON.stringify([
- {
- description:
- titleData.plot?.replaceAll("amp;", "").replaceAll("'", "'") ||
- "N/A",
- aliases:
- titleData.original_name
- ?.replaceAll("amp;", "")
- .replaceAll("'", "'") || "N/A",
- airdate: titleData.release_date || "N/A",
- },
- ]);
-}
-
-async function extractEpisodes(url) {
- try {
- const episodes = [];
- const baseUrl = url.replace(/\/season-\d+$/, "");
-
- const response = await soraFetch(`${baseUrl}/season-1`);
+ const response = await soraFetch(
+ `https://${landingUrl}/it/archive?search=${keyword}`
+ );
const html = await response.text();
+
const regex = / ]*id="app"[^>]*data-page="([^"]*)"/;
const match = regex.exec(html);
- if (!match?.[1]) return JSON.stringify([]);
+ if (!match || !match[1]) {
+ return JSON.stringify([]);
+ }
- const pageData = JSON.parse(match[1].replaceAll(`"`, `"`));
+ const dataPage = match[1].replaceAll(`"`, `"`);
+ const pageData = JSON.parse(dataPage);
+ const titles = pageData.props?.titles || [];
+
+ const results =
+ titles
+ .map((item) => {
+ const posterImage = item.images?.find((img) => img.type === "poster");
+ return {
+ title: item.name?.replaceAll("amp;", "").replaceAll("'", "'") || "",
+ image: posterImage?.filename ?
+ `https://cdn.${landingUrl}/images/${posterImage.filename}` :
+ "",
+ href: `https://${landingUrl}/it/titles/${item.id}-${item.slug}`,
+ };
+ })
+ .filter((item) => item.image) || [];
+
+ return JSON.stringify(results);
+}
+
+async function extractDetails(url) {
+ const baseUrl = await getLandingWebsiteHref()
+
+ const response = await soraFetch(`${url}/season-1`);
+ const html = await response.text();
+
+ const regex = / ]*id="app"[^>]*data-page="([^"]*)"/;
+ const match = regex.exec(html);
+
+ if (!match || !match[1]) {
+ return JSON.stringify([]);
+ }
+
+ const dataPage = match[1].replaceAll(`"`, `"`);
+ const pageData = JSON.parse(dataPage);
const titleData = pageData.props?.title;
- if (!titleData) return JSON.stringify([]);
- const titleId = titleData.id;
- const totalSeasons = titleData.seasons_count || 1;
+ if (!titleData) {
+ return JSON.stringify([]);
+ }
- let hasEpisodes = false;
+ return JSON.stringify([{
+ description: titleData.plot?.replaceAll("amp;", "").replaceAll("'", "'") ||
+ "N/A",
+ aliases: titleData.original_name
+ ?.replaceAll("amp;", "")
+ .replaceAll("'", "'") || "N/A",
+ airdate: titleData.release_date || "N/A",
+ }, ]);
+}
- for (let season = 1; season <= totalSeasons; season++) {
- try {
- const seasonResponse = await soraFetch(`${baseUrl}/season-${season}`);
- const seasonHtml = await seasonResponse.text();
- const seasonMatch = regex.exec(seasonHtml);
+async function extractEpisodes(url) {
+ try {
+ const landingUrl = await getLandingWebsiteHref()
- if (seasonMatch?.[1]) {
- const seasonData = JSON.parse(
- seasonMatch[1].replaceAll(`"`, `"`)
- );
- const seasonEpisodes = seasonData.props?.loadedSeason?.episodes || [];
+ const episodes = [];
+ const baseUrl = url.replace(/\/season-\d+$/, "");
- if (seasonEpisodes.length > 0) {
- hasEpisodes = true;
- seasonEpisodes.forEach((episode) => {
- episodes.push({
- href: `https://streamingcommunityz.kitchen/it/iframe/${titleId}?episode_id=${episode.id}`,
- number: episode.number || episodes.length + 1,
- });
- });
- }
+ const response = await soraFetch(`${baseUrl}/season-1`);
+ const html = await response.text();
+ const regex = / ]*id="app"[^>]*data-page="([^"]*)"/;
+ const match = regex.exec(html);
+
+ if (!match?.[1]) return JSON.stringify([]);
+
+ const pageData = JSON.parse(match[1].replaceAll(`"`, `"`));
+ const titleData = pageData.props?.title;
+ if (!titleData) return JSON.stringify([]);
+
+ const titleId = titleData.id;
+ const totalSeasons = titleData.seasons_count || 1;
+
+ let hasEpisodes = false;
+
+ for (let season = 1; season <= totalSeasons; season++) {
+ try {
+ const seasonResponse = await soraFetch(`${baseUrl}/season-${season}`);
+ const seasonHtml = await seasonResponse.text();
+ const seasonMatch = regex.exec(seasonHtml);
+
+ if (seasonMatch?.[1]) {
+ const seasonData = JSON.parse(
+ seasonMatch[1].replaceAll(`"`, `"`)
+ );
+ const seasonEpisodes = seasonData.props?.loadedSeason?.episodes || [];
+
+ if (seasonEpisodes.length > 0) {
+ hasEpisodes = true;
+ seasonEpisodes.forEach((episode) => {
+ episodes.push({
+ href: `https://${landingUrl}/it/iframe/${titleId}?episode_id=${episode.id}`,
+ number: episode.number || episodes.length + 1,
+ });
+ });
+ }
+ }
+ } catch (error) {
+ console.log(`Error fetching season ${season}:`, error);
+ }
}
- } catch (error) {
- console.log(`Error fetching season ${season}:`, error);
- }
- }
- if (!hasEpisodes) {
- episodes.push({
- href: `https://streamingcommunityz.kitchen/it/iframe/${titleId}`,
- number: 1,
- });
- }
+ if (!hasEpisodes) {
+ episodes.push({
+ href: `https://${landingUrl}/it/iframe/${titleId}`,
+ number: 1,
+ });
+ }
- return JSON.stringify(episodes);
- } catch (error) {
- console.log("Error extracting episodes:", error);
- return JSON.stringify([]);
- }
+ return JSON.stringify(episodes);
+ } catch (error) {
+ console.log("Error extracting episodes:", error);
+ return JSON.stringify([]);
+ }
}
async function extractStreamUrl(url) {
- try {
- let modifiedUrl = url;
- if (!url.includes("/it/iframe") && !url.includes("/en/iframe")) {
- modifiedUrl = url.replace("/iframe", "/it/iframe");
- }
- const response1 = await soraFetch(modifiedUrl);
- const html1 = await response1.text();
+ try {
+ let modifiedUrl = url;
+ if (!url.includes("/it/iframe") && !url.includes("/en/iframe")) {
+ modifiedUrl = url.replace("/iframe", "/it/iframe");
+ }
+ const response1 = await soraFetch(modifiedUrl);
+ const html1 = await response1.text();
- const iframeMatch = html1.match(/ |