mirror of
https://github.com/Inside4ndroid/TMDB-Embed-API.git
synced 2026-10-22 09:35:11 +00:00
Add new providers for streaming services and utility functions
- Implement StreamFlix provider for fetching movie and episode streams. - Add VaPlayer provider to retrieve streaming URLs for movies and TV shows. - Introduce ZXCStreams provider for accessing various streaming links. - Create utility functions for fetching episode counts from Cinemeta. - Develop a title matching system for improved search results. - Implement TMDB title to IMDB ID resolution for better integration with TMDB API.
This commit is contained in:
+4
-3
@@ -1,5 +1,5 @@
|
||||
const fetch = (...args) => import('node-fetch').then(m => m.default(...args));
|
||||
const { config } = require('./config');
|
||||
const { getTmdbApiKey } = require('./tmdbKey');
|
||||
|
||||
const cache = {
|
||||
imdbByTmdb: new Map(),
|
||||
@@ -9,9 +9,10 @@ const TTL_MS = 6 * 60 * 60 * 1000;
|
||||
function isFresh(entry) { return entry && (Date.now() - entry.ts) < TTL_MS; }
|
||||
|
||||
async function tmdbFetchJson(url) {
|
||||
if (!config.tmdbApiKey) throw new Error('TMDB_API_KEY missing');
|
||||
const apiKey = getTmdbApiKey();
|
||||
if (!apiKey) throw new Error('TMDB_API_KEY missing');
|
||||
const sep = url.includes('?') ? '&' : '?';
|
||||
const full = `${url}${sep}api_key=${config.tmdbApiKey}`;
|
||||
const full = `${url}${sep}api_key=${apiKey}`;
|
||||
const res = await fetch(full, { timeout: 15000 });
|
||||
if (!res.ok) throw new Error(`TMDB request failed ${res.status}`);
|
||||
return res.json();
|
||||
|
||||
Reference in New Issue
Block a user