mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-29 17:46:05 +00:00
gomostream initial work
This commit is contained in:
parent
764cd3d477
commit
8d91170ff5
45
src/lib/gomostream.js
Normal file
45
src/lib/gomostream.js
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
const CORS_URL = 'https://hidden-inlet-27205.herokuapp.com/';
|
||||||
|
const BASE_URL = `${CORS_URL}https://gomo.to`;
|
||||||
|
const MOVIE_URL = `${BASE_URL}/movie`
|
||||||
|
const DECODING_URL = `${BASE_URL}/decoding_v3.php`
|
||||||
|
|
||||||
|
async function findContent(searchTerm, type) {
|
||||||
|
try {
|
||||||
|
if (type !== 'movie') return;
|
||||||
|
|
||||||
|
const term = searchTerm.toLowerCase()
|
||||||
|
const imdbRes = await fetch(`${CORS_URL}https://v2.sg.media-imdb.com/suggestion/${term.slice(0, 1)}/${term}.json`).then(d => d.json())
|
||||||
|
const movieId = imdbRes.d[0]?.id
|
||||||
|
if(!movieId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log(imdbRes, movieId)
|
||||||
|
|
||||||
|
// Get stream to go with IMDB ID
|
||||||
|
const site1 = await fetch(`${MOVIE_URL}/${movieId}`).then((d) => d.text());
|
||||||
|
|
||||||
|
const tc = site1.match(/var tc = '(.+)';/)?.[1]
|
||||||
|
const _token = site1.match(/"_token": "(.+)",/)?.[1]
|
||||||
|
|
||||||
|
const fd = new FormData()
|
||||||
|
fd.append('tokenCode', tc)
|
||||||
|
fd.append('_token', _token)
|
||||||
|
|
||||||
|
const src = await fetch(DECODING_URL, {
|
||||||
|
method: "POST",
|
||||||
|
body: fd,
|
||||||
|
headers: {
|
||||||
|
'x-token': tc.slice(5, 13).split("").reverse().join("") + "13574199"
|
||||||
|
}
|
||||||
|
}).then((d) => d.json());
|
||||||
|
|
||||||
|
console.log(src);
|
||||||
|
const embedUrl = src.find(url => url.includes('gomo.to'));
|
||||||
|
const site2 = await fetch(`${CORS_URL}${embedUrl}`).then((d) => d.text());
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
throw new Error(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export { findContent }
|
|
@ -66,7 +66,18 @@ async function getEpisodes(slug) {
|
||||||
"}"
|
"}"
|
||||||
);
|
);
|
||||||
|
|
||||||
return data.seasons
|
let seasons, episodes = [];
|
||||||
|
|
||||||
|
data.forEach((e) => {
|
||||||
|
if (!seasons.includes(e.season))
|
||||||
|
seasons.push(e.season);
|
||||||
|
|
||||||
|
if (!episodes[e.season])
|
||||||
|
episodes[e.season] = []
|
||||||
|
episodes[e.season].push(e.episode)
|
||||||
|
})
|
||||||
|
|
||||||
|
return { seasons, episodes }
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getStreamUrl(slug, type, season, episode) {
|
async function getStreamUrl(slug, type, season, episode) {
|
||||||
|
|
|
@ -40,16 +40,9 @@ export function SearchView() {
|
||||||
let seasons = [];
|
let seasons = [];
|
||||||
let episodes = [];
|
let episodes = [];
|
||||||
if (type === "show") {
|
if (type === "show") {
|
||||||
const episodeData = await getEpisodes(slug);
|
const data = await getEpisodes(slug);
|
||||||
episodeData.forEach((e) => {
|
seasons = data.seasons;
|
||||||
if (!seasons.includes(e.season))
|
episodes = data.episodes;
|
||||||
seasons.push(e.season);
|
|
||||||
|
|
||||||
if (!episodes[e.season])
|
|
||||||
episodes[e.season] = []
|
|
||||||
episodes[e.season].push(e.episode)
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let realUrl = '';
|
let realUrl = '';
|
||||||
|
|
Loading…
Reference in a new issue