time(), 'data' => $data ]; return $data; } // Obter categorias de filmes $apiUrl = $get_dns . "/player_api.php?username=" . $username . "&password=" . $password . "&action=get_vod_categories"; $movie_categories = getApiDataWithCache($apiUrl, 'movie_categories_cache'); // Buscar links de categorias function getCategoryLink($categories, $keywords) { foreach ($categories as $category) { $category_name = strtolower($category["category_name"]); foreach ($keywords as $keyword) { if (strpos($category_name, $keyword) !== false) { return "movies.php?id=" . $category["category_id"]; } } } return "#"; } $links = [ 'max' => getCategoryLink($movie_categories, ['hbo', 'max']), 'disney' => getCategoryLink($movie_categories, ['disney']), 'netflix' => getCategoryLink($movie_categories, ['netflix']), 'amazon' => getCategoryLink($movie_categories, ['amazon', 'prime']), 'marvel' => getCategoryLink($movie_categories, ['marvel']), 'xmas' => getCategoryLink($movie_categories, ['navidad', 'xmas']), 'halloween' => getCategoryLink($movie_categories, ['terror', 'horror']) ]; // Obter filmes $apiUrl = $get_dns . "/player_api.php?username=" . $username . "&password=" . $password . "&action=get_vod_streams"; $channel_api = getApiDataWithCache($apiUrl, 'vod_streams_cache'); shuffle($channel_api); // Filmes em destaque (agora inclui poster/capa) $random_movies_info = []; $max_movies = 5; $movie_count = 0; foreach ($channel_api as $movie) { if ($movie_count >= $max_movies) break; $id = $movie["stream_id"]; $infoApiUrl = $get_dns . "/player_api.php?username=" . $username . "&password=" . $password . "&action=get_vod_info&vod_id=" . $id; $channel_api_info = getApiDataWithCache($infoApiUrl, 'vod_info_cache_' . $id, 3600); $channel_api_info2 = $channel_api_info["info"]; if (isset($channel_api_info2["backdrop_path"][0]) && !empty($channel_api_info2["backdrop_path"][0])) { $random_movies_info[] = [ 'title' => $channel_api_info2["name"], 'description' => $channel_api_info2["plot"], 'rating' => $channel_api_info2["rating"], 'background_image' => $channel_api_info2["backdrop_path"][0], 'poster' => $channel_api_info2["cover"] ?? $movie["stream_icon"] ?? "img/offvs.png", 'play_link' => "Movie_description?id=" . $id ]; $movie_count++; } } // Obter séries $seriesApiUrl = $get_dns . "/player_api.php?username=" . $username . "&password=" . $password . "&action=get_series"; $channel_api1 = getApiDataWithCache($seriesApiUrl, 'series_cache'); shuffle($channel_api1); // Obter canais $channelsApiUrl = $get_dns . "/player_api.php?username=" . $username . "&password=" . $password . "&action=get_live_streams"; $channel_api2 = getApiDataWithCache($channelsApiUrl, 'live_streams_cache'); shuffle($channel_api2); ?>