UNPKG

node-csfd-api

Version:

ČSFD API in JavaScript. Amazing NPM library for scrapping csfd.cz :)

22 lines (21 loc) 1.34 kB
//#region src/vars.ts const LANGUAGE_DOMAIN_MAP = { cs: "https://www.csfd.cz", en: "https://www.csfd.cz/en", sk: "https://www.csfd.cz/sk" }; let BASE_URL = LANGUAGE_DOMAIN_MAP.cs; const getUrlByLanguage = (language) => { if (language && language in LANGUAGE_DOMAIN_MAP) return LANGUAGE_DOMAIN_MAP[language]; return BASE_URL; }; const userUrl = (user, options) => `${getUrlByLanguage(options?.language)}/uzivatel/${encodeURIComponent(user)}`; const userRatingsUrl = (user, page, options = {}) => `${userUrl(user, options)}/hodnoceni/${page ? "?page=" + page : ""}`; const userReviewsUrl = (user, page, options = {}) => `${userUrl(user, options)}/recenze/${page ? "?page=" + page : ""}`; const movieUrl = (movie, options) => `${getUrlByLanguage(options?.language)}/film/${encodeURIComponent(movie)}/prehled/`; const creatorUrl = (creator, options) => `${getUrlByLanguage(options?.language)}/tvurce/${encodeURIComponent(creator)}`; const cinemasUrl = (district, period, options) => `${getUrlByLanguage(options?.language)}/kino/?period=${period}&district=${district}`; const searchUrl = (text, options) => `${getUrlByLanguage(options?.language)}/hledat/?q=${encodeURIComponent(text)}`; //#endregion export { cinemasUrl, creatorUrl, getUrlByLanguage, movieUrl, searchUrl, userRatingsUrl, userReviewsUrl }; //# sourceMappingURL=vars.mjs.map