UNPKG

node-csfd-api

Version:

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

64 lines (62 loc) 2.44 kB
import { CinemaScraper } from "./services/cinema.service.mjs"; import { CreatorScraper } from "./services/creator.service.mjs"; import { MovieScraper } from "./services/movie.service.mjs"; import { SearchScraper } from "./services/search.service.mjs"; import { UserRatingsScraper } from "./services/user-ratings.service.mjs"; import { UserReviewsScraper } from "./services/user-reviews.service.mjs"; //#region src/index.ts var Csfd = class { constructor(userRatingsService, userReviewsService, movieService, creatorService, searchService, cinemaService, defaultOptions) { this.userRatingsService = userRatingsService; this.userReviewsService = userReviewsService; this.movieService = movieService; this.creatorService = creatorService; this.searchService = searchService; this.cinemaService = cinemaService; this.defaultOptions = defaultOptions; } setOptions({ request, language }) { if (request !== void 0) this.defaultOptions = { ...this.defaultOptions, request }; if (language !== void 0) this.defaultOptions = { ...this.defaultOptions, language }; } async userRatings(user, config, options) { const opts = options ?? this.defaultOptions; return this.userRatingsService.userRatings(user, config, opts); } async userReviews(user, config, options) { const opts = options ?? this.defaultOptions; return this.userReviewsService.userReviews(user, config, opts); } async movie(movie, options) { const opts = options ?? this.defaultOptions; return this.movieService.movie(+movie, opts); } async creator(creator, options) { const opts = options ?? this.defaultOptions; return this.creatorService.creator(+creator, opts); } async search(text, options) { const opts = options ?? this.defaultOptions; return this.searchService.search(text, opts); } async cinema(district, period, options) { const opts = options ?? this.defaultOptions; return this.cinemaService.cinemas(+district, period, opts); } }; const movieScraper = new MovieScraper(); const userRatingsScraper = new UserRatingsScraper(); const userReviewsScraper = new UserReviewsScraper(); const cinemaScraper = new CinemaScraper(); const creatorScraper = new CreatorScraper(); const searchScraper = new SearchScraper(); const csfd = new Csfd(userRatingsScraper, userReviewsScraper, movieScraper, creatorScraper, searchScraper, cinemaScraper); //#endregion export { Csfd, csfd }; //# sourceMappingURL=index.mjs.map