/** * HuraWatch / MoviesTV All-in-One Movie & Series Scraper Engine * Author: Vamz Spectre (VamxAPI) * Target: freeonlinek.top/hurawatch / moviestv.my * * Full Feature Suite: * 1. Search Multi (Movies, Series, Anime) * 2. Complete Metadata (Overview, Rating, HD Poster, Original Backdrop, Genres, IMDB ID, Runtime) * 3. Cast & Directors (Actors with character names & profile pictures, directors) * 4. Official Trailers & Teasers (YouTube Key, direct URL, & embed iframe) * 5. Smart Recommendations & Similar Movies * 6. TV Series Season & Episode Navigator (Episode breakdown, thumbnail stills, overview) * 7. Trending & Top Rated (Weekly / Daily) * 8. Discover by Genre, Year, & Sorting * 9. 21 Multi-Server HD Video Stream Resolvers (Videasy, VidFast, EmbedMaster, Vidsrc Me, MoviesAPI, dll) * 10. 100% Anti-Bot Clean: Tanpa Cloudflare Challenge & Tanpa Captcha */ const axios = require("axios"); const BASE_API = "https://moviestv.my/api/tmdb.php?endpoint="; const IMAGE_W500 = "https://image.tmdb.org/t/p/w500"; const IMAGE_ORIGINAL = "https://image.tmdb.org/t/p/original"; const HEADERS = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", "Referer": "https://moviestv.my/", "Accept": "application/json, text/plain, */*" }; const STREAM_PROVIDERS = [ { name: "Videasy Flux", movie: "https://player.videasy.to/movie/{id}", tv: "https://player.videasy.to/tv/{id}/{s}/{e}" }, { name: "VidFast VIP", movie: "https://vidfast.vc/movie/{id}", tv: "https://vidfast.vc/tv/{id}/{s}/{e}" }, { name: "Embed Master", movie: "https://embedmaster.link/movie/{id}", tv: "https://embedmaster.link/tv/{id}/{s}/{e}" }, { name: "Vidsrc Me", movie: "https://vidsrcme.ru/embed/movie/{id}", tv: "https://vidsrcme.ru/embed/tv/{id}/{s}/{e}" }, { name: "Vidcore Pro", movie: "https://vidcore.org/embed/movie/{id}", tv: "https://vidcore.org/embed/tv/{id}/{s}/{e}" }, { name: "MoviesAPI Speedy", movie: "https://moviesapi.to/movie/{id}", tv: "https://moviesapi.to/tv/{id}-{s}-{e}" }, { name: "111Movies Alpha", movie: "https://111movies.net/movie/{id}", tv: "https://111movies.net/tv/{id}/{s}/{e}" }, { name: "Vidzee Titan", movie: "https://player.vidzee.wtf/embed/movie/{id}", tv: "https://player.vidzee.wtf/embed/tv/{id}/{s}/{e}" }, { name: "Vidstorm Super", movie: "https://vidstorm.ru/movie/{id}", tv: "https://vidstorm.ru/tv/{id}/{s}/{e}" }, { name: "2Embed Elite", movie: "https://www.2embed.cc/embed/{id}", tv: "https://www.2embed.cc/embedtv/{id}&s={s}&e={e}" }, { name: "Mapple Cinematic", movie: "https://mapple.uk/watch/movie/{id}", tv: "https://mapple.uk/watch/tv/{id}-{s}-{e}" }, { name: "PrimeSrc", movie: "https://primesrc.me/embed/movie?tmdb={id}", tv: "https://primesrc.me/embed/tv?tmdb={id}&season={s}&episode={e}" }, { name: "Velocity HD", movie: "https://vidrock.ru/movie/{id}", tv: "https://vidrock.ru/tv/{id}/{s}/{e}" }, { name: "High Stream", movie: "https://cinesrc.st/embed/movie/{id}", tv: "https://cinesrc.st/embed/tv/{id}/{s}/{e}" }, { name: "Global Node", movie: "https://www.nontongo.win/embed/movie/{id}", tv: "https://www.nontongo.win/embed/tv/{id}/{s}/{e}" }, { name: "Dynamic VIP", movie: "https://multiembed.mov/?video_id={id}&tmdb=1", tv: "https://multiembed.mov/?video_id={id}&tmdb=1&s={s}&e={e}" }, { name: "Direct Play", movie: "https://cdn.mov2day.xyz/embed/movie/{id}", tv: "https://cdn.mov2day.xyz/embed/tv/{id}/{s}/{e}" }, { name: "France VF/Vost", movie: "https://frembed.cyou/embed/movie/{id}", tv: "https://frembed.cyou/embed/serie/{id}?sa={s}&epi={e}" }, { name: "Pro Player", movie: "https://rivestream.org/embed?type=movie&id={id}", tv: "https://rivestream.org/embed?type=tv&id={id}&season={s}&episode={e}" }, { name: "Hyper Stream", movie: "https://vidup.to/movie/{id}", tv: "https://vidup.to/tv/{id}/{s}/{e}" }, { name: "Ultra HD Fast", movie: "https://vsembed.ru/embed/movie?tmdb={id}", tv: "https://vsembed.ru/embed/tv?tmdb={id}&season={s}&episode={e}&autonext=1" } ]; function resolveStreamServers(id, type = "movie", season = 1, episode = 1) { return STREAM_PROVIDERS.map((provider) => { let url = (type === "tv") ? provider.tv.replace(/{id}/g, String(id)).replace(/{s}/g, String(season)).replace(/{e}/g, String(episode)) : provider.movie.replace(/{id}/g, String(id)); return { name: provider.name, url }; }); } async function api(endpoint) { const res = await axios.get(BASE_API + encodeURIComponent(endpoint), { headers: HEADERS, timeout: 15000 }); return res.data; } function formatItem(it, fallbackType = "movie") { return { id: it.id, title: it.title || it.name || "Untitled", originalTitle: it.original_title || it.original_name, type: it.media_type || fallbackType, overview: it.overview || "", posterUrl: it.poster_path ? `${IMAGE_W500}${it.poster_path}` : null, backdropUrl: it.backdrop_path ? `${IMAGE_ORIGINAL}${it.backdrop_path}` : null, releaseDate: it.release_date || it.first_air_date || null, voteAverage: Number((it.vote_average || 0).toFixed(1)), voteCount: it.vote_count || 0, popularity: Number((it.popularity || 0).toFixed(1)) }; } // 1. Search Multi (Movie & TV) async function search(query, page = 1) { if (!query) throw new Error("Query tidak boleh kosong."); const data = await api(`/search/multi?query=${encodeURIComponent(query)}&page=${page}&include_adult=false`); const results = (data.results || []) .filter(i => i.media_type === "movie" || i.media_type === "tv") .map(i => formatItem(i)); return { status: true, page: data.page || page, totalPages: data.total_pages, results }; } // 2. Detail Lengkap (Credits, Trailers, Rekomendasi, 21 Server Player) async function getDetail(id, type = "movie", season = 1, episode = 1) { const [data, credits, videos, recs] = await Promise.all([ api(`/${type}/${id}`), api(`/${type}/${id}/credits`).catch(() => ({ cast: [], crew: [] })), api(`/${type}/${id}/videos`).catch(() => ({ results: [] })), api(`/${type}/${id}/recommendations`).catch(() => ({ results: [] })) ]); const cast = (credits.cast || []).slice(0, 10).map(c => ({ id: c.id, name: c.name, character: c.character, profileUrl: c.profile_path ? `${IMAGE_W500}${c.profile_path}` : null })); const directors = (credits.crew || []) .filter(c => c.job === "Director" || c.job === "Executive Producer") .slice(0, 4) .map(c => c.name); const trailers = (videos.results || []) .filter(v => v.site === "YouTube") .slice(0, 5) .map(v => ({ name: v.name, type: v.type, youtubeUrl: `https://www.youtube.com/watch?v=${v.key}`, embedUrl: `https://www.youtube.com/embed/${v.key}` })); return { status: true, result: { ...formatItem(data, type), tagline: data.tagline, status: data.status, genres: (data.genres || []).map(g => g.name), runtime: data.runtime || (data.episode_run_time ? data.episode_run_time[0] : null), imdbId: data.imdb_id, homepage: data.homepage, seasonsCount: data.number_of_seasons, episodesCount: data.number_of_episodes, cast, directors, trailers, recommendations: (recs.results || []).slice(0, 8).map(r => formatItem(r, type)), streamingServers: resolveStreamServers(id, type, season, episode) } }; } // 3. Episode List per Season (TV Series) async function getSeason(id, seasonNumber = 1) { const data = await api(`/tv/${id}/season/${seasonNumber}`); return { status: true, result: { seasonNumber: data.season_number, name: data.name, overview: data.overview, posterUrl: data.poster_path ? `${IMAGE_W500}${data.poster_path}` : null, episodes: (data.episodes || []).map(ep => ({ episodeNumber: ep.episode_number, name: ep.name, overview: ep.overview, airDate: ep.air_date, stillUrl: ep.still_path ? `${IMAGE_W500}${ep.still_path}` : null, voteAverage: Number((ep.vote_average || 0).toFixed(1)), streamingServers: resolveStreamServers(id, "tv", ep.season_number, ep.episode_number) })) } }; } // 4. Trending & Discover (by Genre / Year) async function getTrending(type = "movie", timeWindow = "week", page = 1) { const data = await api(`/trending/${type}/${timeWindow}?page=${page}`); return { status: true, page: data.page || page, totalPages: data.total_pages, results: (data.results || []).map(i => formatItem(i, type)) }; } async function discover(options = {}) { const type = options.type || "movie"; const page = options.page || 1; const sort = options.sortBy || "popularity.desc"; let q = `/discover/${type}?page=${page}&sort_by=${sort}&include_adult=false`; if (options.genreId) q += `&with_genres=${options.genreId}`; if (options.year) q += type === "movie" ? `&primary_release_year=${options.year}` : `&first_air_date_year=${options.year}`; const data = await api(q); return { status: true, page: data.page || page, totalPages: data.total_pages, results: (data.results || []).map(i => formatItem(i, type)) }; } if (typeof module !== "undefined" && module.exports) { module.exports = { search, getDetail, getSeason, getTrending, discover, STREAM_PROVIDERS }; }