feat: Streaming-Tab mit Top 10 pro Anbieter (Netflix, Disney+, Prime, Apple TV+, WOW, RTL+)
This commit is contained in:
@@ -485,6 +485,64 @@ router.get('/xrel-cached', authenticate, (req, res) => {
|
||||
res.json(result);
|
||||
});
|
||||
|
||||
// ── Streaming Top 10 pro Anbieter ──────────────────────────────────────────────
|
||||
// TMDb Watch-Provider-IDs für Deutschland (watch_region=DE)
|
||||
const STREAMING_PROVIDERS = [
|
||||
{ id: 'netflix', label: 'Netflix', tmdbId: 8 },
|
||||
{ id: 'disney', label: 'Disney+', tmdbId: 337 },
|
||||
{ id: 'prime', label: 'Amazon Prime Video', tmdbId: 119 },
|
||||
{ id: 'appletv', label: 'Apple TV+', tmdbId: 350 },
|
||||
{ id: 'wow', label: 'WOW (Sky)', tmdbId: 30 },
|
||||
{ id: 'rtlplus', label: 'RTL+', tmdbId: 421 },
|
||||
];
|
||||
|
||||
router.get('/streaming/providers', authenticate, (req, res) => {
|
||||
res.json(STREAMING_PROVIDERS.map(p => ({ id: p.id, label: p.label })));
|
||||
});
|
||||
|
||||
// GET /streaming/:providerId – Top 10 Filme + Serien für einen Anbieter (DE)
|
||||
router.get('/streaming/:providerId', authenticate, async (req, res) => {
|
||||
try {
|
||||
const provider = STREAMING_PROVIDERS.find(p => p.id === req.params.providerId);
|
||||
if (!provider) return res.status(404).json({ error: 'Unbekannter Anbieter' });
|
||||
|
||||
const discoverParams = {
|
||||
watch_region: 'DE',
|
||||
with_watch_providers: provider.tmdbId,
|
||||
with_watch_monetization_types: 'flatrate',
|
||||
sort_by: 'popularity.desc',
|
||||
'vote_count.gte': 10,
|
||||
};
|
||||
|
||||
const [movieResults, tvResults, genreMap] = await Promise.all([
|
||||
tmdb('/discover/movie', discoverParams),
|
||||
tmdb('/discover/tv', { ...discoverParams, first_air_date_year: undefined }),
|
||||
getGenreMap(),
|
||||
]);
|
||||
|
||||
const movies = (movieResults.results || [])
|
||||
.filter(m => !BLOCKED_LANGS.has(m.original_language))
|
||||
.slice(0, 10)
|
||||
.map((m, i) => ({ ...enrichMovie(m, genreMap, null, i + 1), media_type: 'movie' }));
|
||||
|
||||
const tvShows = (tvResults.results || [])
|
||||
.filter(m => !BLOCKED_LANGS.has(m.original_language))
|
||||
.slice(0, 10)
|
||||
.map((m, i) => ({
|
||||
id: m.id, media_type: 'tv', rank: i + 1,
|
||||
title: m.name || m.original_name,
|
||||
original_title: m.original_name,
|
||||
release_date: m.first_air_date || '',
|
||||
poster_path: m.poster_path || '',
|
||||
genres: (m.genre_ids||[]).map(gid => genreMap[gid]).filter(Boolean),
|
||||
vote_average: m.vote_average,
|
||||
original_language: m.original_language,
|
||||
}));
|
||||
|
||||
res.json({ provider: { id: provider.id, label: provider.label }, movies, tvShows });
|
||||
} catch(e) { res.status(500).json({ error: e.message }); }
|
||||
});
|
||||
|
||||
// ── Favorites Routen (feste VOR :param) ──────────────────────────────────────
|
||||
|
||||
// GET /favorites – eigene Favoriten
|
||||
|
||||
Reference in New Issue
Block a user