From 77a0c36a5880ef23bc0e42caa82b3194cb9a5504 Mon Sep 17 00:00:00 2001 From: JORDAAR <69628820+Jordaar@users.noreply.github.com> Date: Thu, 25 May 2023 00:15:22 +0530 Subject: [PATCH 1/6] add sflix provider --- src/backend/providers/sflix.ts | 99 ++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 src/backend/providers/sflix.ts diff --git a/src/backend/providers/sflix.ts b/src/backend/providers/sflix.ts new file mode 100644 index 00000000..f33f6951 --- /dev/null +++ b/src/backend/providers/sflix.ts @@ -0,0 +1,99 @@ +import { proxiedFetch } from "../helpers/fetch"; +import { registerProvider } from "../helpers/register"; +import { MWStreamQuality, MWStreamType } from "../helpers/streams"; +import { MWMediaType } from "../metadata/types"; + +const sflixBase = "https://sflix.video"; + +registerProvider({ + id: "sflix", + displayName: "Sflix", + rank: 135, + type: [MWMediaType.MOVIE, MWMediaType.SERIES], + async scrape({ media, episode, progress }) { + let searchQuery = `${media.meta.title} `; + + if (media.meta.type === MWMediaType.MOVIE) + searchQuery += media.meta.year ?? ""; + + if (media.meta.type === MWMediaType.SERIES) + searchQuery += `S${String(media.meta.seasonData.number).padStart( + 2, + "0" + )}`; + + const search = await proxiedFetch( + `/?s=${encodeURIComponent(searchQuery)}`, + { + baseURL: sflixBase, + } + ); + const searchPage = new DOMParser().parseFromString(search, "text/html"); + + const moviePageUrl = searchPage + .querySelector(".movies-list .ml-item:first-child a") + ?.getAttribute("href"); + if (!moviePageUrl) throw new Error("Movie does not exist"); + + progress(25); + + const movie = await proxiedFetch(moviePageUrl); + const moviePage = new DOMParser().parseFromString(movie, "text/html"); + + progress(45); + + let outerEmbedSrc = null; + if (media.meta.type === MWMediaType.MOVIE) { + outerEmbedSrc = moviePage + .querySelector("iframe") + ?.getAttribute("data-lazy-src"); + } else if (media.meta.type === MWMediaType.SERIES) { + const series = Array.from(moviePage.querySelectorAll(".desc p a")).map( + (a) => ({ + title: a.getAttribute("title"), + link: a.getAttribute("href"), + }) + ); + + const episodeNumber = media.meta.seasonData.episodes.find( + (e) => e.id === episode + )?.number; + + const targetSeries = series.find((s) => + s.title?.endsWith(String(episodeNumber).padStart(2, "0")) + ); + if (!targetSeries) throw new Error("Episode does not exist"); + + outerEmbedSrc = targetSeries.link; + } + if (!outerEmbedSrc) throw new Error("Outer embed source not found"); + + progress(65); + + const outerEmbed = await proxiedFetch(outerEmbedSrc); + const outerEmbedPage = new DOMParser().parseFromString( + outerEmbed, + "text/html" + ); + + const embedSrc = outerEmbedPage + .querySelector("iframe") + ?.getAttribute("src"); + if (!embedSrc) throw new Error("Embed source not found"); + + const embed = await proxiedFetch(embedSrc); + + const streamUrl = embed.match(/file\s*:\s*"([^"]+\.mp4)"/)?.[1]; + if (!streamUrl) throw new Error("Unable to get stream"); + + return { + embeds: [], + stream: { + streamUrl, + quality: MWStreamQuality.Q1080P, + type: MWStreamType.MP4, + captions: [], + }, + }; + }, +}); From ffc772727acfc2cf65d93c363a8d797e6394fc1e Mon Sep 17 00:00:00 2001 From: JORDAAR <69628820+Jordaar@users.noreply.github.com> Date: Thu, 25 May 2023 00:16:00 +0530 Subject: [PATCH 2/6] register sflix provider --- src/backend/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/index.ts b/src/backend/index.ts index 812a0558..eb0ad897 100644 --- a/src/backend/index.ts +++ b/src/backend/index.ts @@ -8,6 +8,7 @@ import "./providers/netfilm"; import "./providers/m4ufree"; import "./providers/hdwatched"; import "./providers/2embed"; +import "./providers/sflix"; // embeds import "./embeds/streamm4u"; From d586899dbf9f941c351d32d39c3d6b16f9aeca70 Mon Sep 17 00:00:00 2001 From: Isra Date: Thu, 25 May 2023 22:38:58 -0500 Subject: [PATCH 3/6] Pirate speak! --- src/setup/i18n.ts | 4 + src/setup/iso6391.ts | 7 ++ src/setup/locales/pirate/translation.json | 124 ++++++++++++++++++++++ 3 files changed, 135 insertions(+) create mode 100644 src/setup/locales/pirate/translation.json diff --git a/src/setup/i18n.ts b/src/setup/i18n.ts index c5094776..6116434a 100644 --- a/src/setup/i18n.ts +++ b/src/setup/i18n.ts @@ -8,6 +8,7 @@ import de from "./locales/de/translation.json"; import en from "./locales/en/translation.json"; import fr from "./locales/fr/translation.json"; import nl from "./locales/nl/translation.json"; +import pirate from "./locales/pirate/translation.json"; import tr from "./locales/tr/translation.json"; import zh from "./locales/zh/translation.json"; @@ -33,6 +34,9 @@ const locales = { cs: { translation: cs, }, + pirate: { + translation: pirate, + }, }; i18n // pass the i18n instance to react-i18next. diff --git a/src/setup/iso6391.ts b/src/setup/iso6391.ts index 28d42806..3499155b 100644 --- a/src/setup/iso6391.ts +++ b/src/setup/iso6391.ts @@ -1,5 +1,6 @@ export type LangCode = | "none" + | "pirate" | "aa" | "ab" | "ae" @@ -219,6 +220,12 @@ export const captionLanguages: CaptionLanguageOption[] = [ name: "None", nativeName: "Lorem ipsum", }, + { + id: "pirate", + englishName: "Pirate", + name: "Pirate English", + nativeName: "Pirate English", + }, { id: "aa", englishName: "Afar", diff --git a/src/setup/locales/pirate/translation.json b/src/setup/locales/pirate/translation.json new file mode 100644 index 00000000..e87a7d2d --- /dev/null +++ b/src/setup/locales/pirate/translation.json @@ -0,0 +1,124 @@ +{ + "global": { + "name": "movie-web" + }, + "search": { + "loading_series": "Fetchin' yer favorite series...", + "loading_movie": "Fetchin' yer favorite movies...", + "loadin'": "Loadin'...", + "allResults": "That be all we 'ave, me hearty!", + "noResults": "We couldn't find anythin' that matches yer search!", + "allFailed": "Failed t' find media, walk the plank and try again!", + "headingTitle": "Search results", + "bookmarks": "Treasure Maps", + "continueWatchin'": "Continue Watchin'", + "title": "Wha' be ye wantin' to watch, me matey?", + "placeholder": "Wha' be ye searchin' for?" + }, + "media": { + "movie": "Movie", + "series": "Series", + "stopEditin'": "Stop editin'", + "errors": { + "genericTitle": "Shiver me timbers! It broke!", + "failedMeta": "Ye can't trust the compass, failed to load meta", + "mediaFailed": "We failed t' request the media ye asked fer, check yer internet connection, or Davy Jones's locker awaits ye!", + "videoFailed": "Blimey! We encountered an error while playin' the video ye requested. If this keeps happening please report the issue to the <0>Discord server or on <1>GitHub." + } + }, + "seasons": { + "seasonAndEpisode": "S{{season}} E{{episode}}" + }, + "notFound": { + "genericTitle": "Ahoy! I see nothin' on the horizon.", + "backArrow": "Back to the port", + "media": { + "title": "Avast ye! Couldn't find that media", + "description": "We couldn't find the media ye requested. Either it's been scuttled or ye tampered with the URL, ye scallywag!" + }, + "provider": { + "title": "Walk the plank! This provider has been disabled", + "description": "We had issues wit' the provider or 'twas too unstable t' use, so we had t' disable it. Try another one, arrr!" + }, + "page": { + "title": "Avast ye! Couldn't find that page.", + "description": "Arrr! We searched every inch o' the vessel: from the bilge to the crow's nest, from the keel to the topmast, but avast! We couldn't find the page ye be lookin' fer, me heartie." + } + }, + "searchBar": { + "movie": "Movie", + "series": "Series", + "Search": "Search" + }, + "videoPlayer": { + "findingBestVideo": "Finding the best video fer ye, hoist the colors!", + "noVideos": "Blistering barnacles, couldn't find any videos fer ye. Ye need a better map!", + "loading": "Loading...", + "backToHome": "Back to the port, mates!", + "backToHomeShort": "Back", + "seasonAndEpisode": "S{{season}} E{{episode}}", + "timeLeft": "{{timeLeft}} left", + "finishAt": "Finish at {{timeFinished}}", + "buttons": { + "episodes": "Episodes", + "source": "Source", + "captions": "Captions", + "download": "Download", + "settings": "Settings", + "pictureInPicture": "Spyglass view", + "playbackSpeed": "Set sail faster!" + }, + "popouts": { + "back": "Avast ye, go back!", + "sources": "Wha' provider do ye want to use?", + "seasons": "Choose which season you wants to watch!", + "captions": "Select a subtitle language, me hearty!", + "playbackSpeed": "Make the video faster than Blackbeard's ship!", + "customPlaybackSpeed": "Set a custom playback speed", + "captionPreferences": { + "title": "Customize yer captions", + "delay": "Delay", + "fontSize": "Size", + "opacity": "Opacity", + "color": "Color" + }, + "episode": "E{{index}} - {{title}}", + "noCaptions": "No captions, hoist the Jolly Roger!", + "linkedCaptions": "Linked captions, drop anchor!", + "customCaption": "Custom caption, arrr!", + "uploadCustomCaption": "Upload yer own caption!", + "noEmbeds": "No embeds we be found fer this source", + + "errors": { + "loadingWentWong": "Shiver me timbers! Somethin' went wrong loadin' the episodes fer {{seasonTitle}}", + "embedsError": "Blimey! Somethin' went wrong loadin' the embeds fer this thin' that ye like" + }, + "descriptions": { + "sources": "Wha' provider do ye wants to use?", + "embeds": "Choose which video to view", + "seasons": "Choose which season ye wants to watch", + "episode": "Pick an episode", + "captions": "Choose a subtitle language", + "captionPreferences": "Make subtitles look how ye wants it", + "playbackSpeed": "Change the playback speed" + } + }, + "errors": { + "fatalError": "Blow me down! The video player encounted a fatal error, please report it to the <0>Discord server or on <1>GitHub." + } + }, + "settings": { + "title": "Settings", + "language": "Language", + "captionLanguage": "Caption Language" + }, + "v3": { + "newSiteTitle": "New version now released!", + "newDomain": "https://movie-web.app", + "newDomainText": "movie-web will soon be movin' to a new domain: <0>https://movie-web.app. Make sure to update all yer bookmarks as <1>the ole website will stop workin' on {{date}}.", + "tireless": "We've worked tirelessly on this new update, we hope ye will enjoy wha' we've been cookin' up fer the past months.", + "leaveAnnouncement": "Take me thar!" + }, + "casting": { "casting": "Casting to device..." }, + "errors": { "offline": "Avast! Check yer internet connection" } +} From be03a8eb42072e7fc907743287788c9813c9e80b Mon Sep 17 00:00:00 2001 From: zisra <100528712+zisra@users.noreply.github.com> Date: Fri, 26 May 2023 08:01:55 -0500 Subject: [PATCH 4/6] Update src/setup/locales/pirate/translation.json Co-authored-by: Jip Frijlink --- src/setup/locales/pirate/translation.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/setup/locales/pirate/translation.json b/src/setup/locales/pirate/translation.json index e87a7d2d..c084ae34 100644 --- a/src/setup/locales/pirate/translation.json +++ b/src/setup/locales/pirate/translation.json @@ -66,7 +66,7 @@ "download": "Download", "settings": "Settings", "pictureInPicture": "Spyglass view", - "playbackSpeed": "Set sail faster!" + "playbackSpeed": "Set sail!" }, "popouts": { "back": "Avast ye, go back!", From 519e74480ecdd38ed787547edcea8b7a8b3e8d7a Mon Sep 17 00:00:00 2001 From: zisra <100528712+zisra@users.noreply.github.com> Date: Fri, 26 May 2023 10:45:45 -0500 Subject: [PATCH 5/6] Update translation.json --- src/setup/locales/pirate/translation.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/setup/locales/pirate/translation.json b/src/setup/locales/pirate/translation.json index c084ae34..a4a92117 100644 --- a/src/setup/locales/pirate/translation.json +++ b/src/setup/locales/pirate/translation.json @@ -73,7 +73,7 @@ "sources": "Wha' provider do ye want to use?", "seasons": "Choose which season you wants to watch!", "captions": "Select a subtitle language, me hearty!", - "playbackSpeed": "Make the video faster than Blackbeard's ship!", + "playbackSpeed": "Change the speed of Blackbeard's ship!", "customPlaybackSpeed": "Set a custom playback speed", "captionPreferences": { "title": "Customize yer captions", From 3c096c069cb11e27083eeebf37cac764e3bf5600 Mon Sep 17 00:00:00 2001 From: JORDAAR <69628820+Jordaar@users.noreply.github.com> Date: Sat, 27 May 2023 02:27:04 +0530 Subject: [PATCH 6/6] lower rank --- src/backend/providers/sflix.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/providers/sflix.ts b/src/backend/providers/sflix.ts index f33f6951..4121046b 100644 --- a/src/backend/providers/sflix.ts +++ b/src/backend/providers/sflix.ts @@ -8,7 +8,7 @@ const sflixBase = "https://sflix.video"; registerProvider({ id: "sflix", displayName: "Sflix", - rank: 135, + rank: 50, type: [MWMediaType.MOVIE, MWMediaType.SERIES], async scrape({ media, episode, progress }) { let searchQuery = `${media.meta.title} `;