node-csfd-api 3.0.0-next.23 → 3.0.0-next.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { parse } from 'node-html-parser';
11
11
  import { fetchPage } from '../fetchers';
12
- import { getColorRating, getDate, getId, getTitle, getType, getUrl, getUserRating, getYear, sleep } from '../helpers/user-ratings.helper';
12
+ import { getUserRating, getUserRatingColorRating, getUserRatingDate, getUserRatingId, getUserRatingTitle, getUserRatingType, getUserRatingUrl, getUserRatingYear, sleep } from '../helpers/user-ratings.helper';
13
13
  import { userRatingsUrl } from '../vars';
14
14
  export class UserRatingsScraper {
15
15
  constructor() {
@@ -56,7 +56,7 @@ export class UserRatingsScraper {
56
56
  }
57
57
  }
58
58
  for (const el of movies) {
59
- const type = getType(el);
59
+ const type = getUserRatingType(el);
60
60
  // Filtering includesOnly
61
61
  if ((_c = config === null || config === void 0 ? void 0 : config.includesOnly) === null || _c === void 0 ? void 0 : _c.length) {
62
62
  if (config.includesOnly.some((include) => type === include)) {
@@ -78,13 +78,13 @@ export class UserRatingsScraper {
78
78
  }
79
79
  buildUserRatings(el) {
80
80
  this.films.push({
81
- id: getId(el),
82
- title: getTitle(el),
83
- year: getYear(el),
84
- type: getType(el),
85
- url: getUrl(el),
86
- colorRating: getColorRating(el),
87
- userDate: getDate(el),
81
+ id: getUserRatingId(el),
82
+ title: getUserRatingTitle(el),
83
+ year: getUserRatingYear(el),
84
+ type: getUserRatingType(el),
85
+ url: getUserRatingUrl(el),
86
+ colorRating: getUserRatingColorRating(el),
87
+ userDate: getUserRatingDate(el),
88
88
  userRating: getUserRating(el)
89
89
  });
90
90
  }
package/index.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ export * from "./types/vars";
2
+ export * from "./types/fetchers/fetch.polyfill";
3
+ export * from "./types/helpers/cinema.helper";
4
+ export * from "./types/helpers/creator.helper";
5
+ export * from "./types/helpers/global.helper";
6
+ export * from "./types/helpers/movie.helper";
7
+ export * from "./types/helpers/search-user.helper";
8
+ export * from "./types/helpers/search.helper";
9
+ export * from "./types/helpers/user-ratings.helper";
10
+ export * from "./types/interfaces/cinema.interface";
11
+ export * from "./types/interfaces/creator.interface";
12
+ export * from "./types/interfaces/global";
13
+ export * from "./types/interfaces/movie.interface";
14
+ export * from "./types/interfaces/search.interface";
15
+ export * from "./types/interfaces/user-ratings.interface";
16
+ export * from "./types/services/cinema.service";
17
+ export * from "./types/services/creator.service";
18
+ export * from "./types/services/movie.service";
19
+ export * from "./types/services/search.service";
20
+ export * from "./types/services/user-ratings.service";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-csfd-api",
3
- "version": "3.0.0-next.23",
3
+ "version": "3.0.0-next.25",
4
4
  "description": "ČSFD API in JavaScript. Amazing NPM library for scrapping csfd.cz :)",
5
5
  "main": "./cjs/index.js",
6
6
  "author": "BART! <bart@bartweb.cz>",
@@ -15,7 +15,7 @@
15
15
  "lint": "eslint ./src/**/**/* --fix",
16
16
  "test": "vitest",
17
17
  "test:coverage": "yarn test run --coverage",
18
- "fix-paths": "yarn json -I -f ./dist/package.json -e \"this.module='./esm/index.js';this.main='./cjs/index.js';this.types='./cjs/index.d.ts'\"",
18
+ "fix-paths": "yarn json -I -f ./dist/package.json -e \"this.module='./esm/index.js';this.main='./cjs/index.js';this.types='./types/barrel.d.ts'\"",
19
19
  "publish:next": "yarn && yarn build && yarn test:coverage && cd dist && npm publish --tag next",
20
20
  "postversion": "git push && git push --follow-tags",
21
21
  "release:beta": "npm version preminor --preid=beta -m \"chore(update): prelease %s β\"",
@@ -61,5 +61,5 @@
61
61
  "*.ts": "eslint --cache --fix"
62
62
  },
63
63
  "module": "./esm/index.js",
64
- "types": "./cjs/index.d.ts"
64
+ "types": "./types/barrel.d.ts"
65
65
  }
@@ -1,10 +1,10 @@
1
- import { CSFDCinemaGroupedFilmsByDate, CSFDCinemaMeta, CSFDCinemaMovie } from 'interfaces/cinema.interface';
2
1
  import { HTMLElement } from 'node-html-parser';
3
2
  import { CSFDColorRating } from '../interfaces/global';
4
- export declare const getColorRating: (el: HTMLElement) => CSFDColorRating;
3
+ import { CSFDCinemaGroupedFilmsByDate, CSFDCinemaMeta, CSFDCinemaMovie } from './../interfaces/cinema.interface';
4
+ export declare const getCinemaColorRating: (el: HTMLElement) => CSFDColorRating;
5
5
  export declare const getCinemaId: (el: HTMLElement | null) => number;
6
- export declare const getId: (url: string) => number | null;
7
- export declare const getCoords: (el: HTMLElement | null) => {
6
+ export declare const getCinemaUrlId: (url: string) => number | null;
7
+ export declare const getCinemaCoords: (el: HTMLElement | null) => {
8
8
  lat: number;
9
9
  lng: number;
10
10
  } | null;
@@ -14,5 +14,5 @@ export declare const parseCinema: (el: HTMLElement | null) => {
14
14
  name: string;
15
15
  };
16
16
  export declare const getGroupedFilmsByDate: (el: HTMLElement | null) => CSFDCinemaGroupedFilmsByDate[];
17
- export declare const getFilms: (date: string, el: HTMLElement | null) => CSFDCinemaMovie[];
17
+ export declare const getCinemaFilms: (date: string, el: HTMLElement | null) => CSFDCinemaMovie[];
18
18
  export declare const parseMeta: (meta: string[]) => CSFDCinemaMeta[];
@@ -1,17 +1,12 @@
1
1
  import { HTMLElement } from 'node-html-parser';
2
2
  import { CSFDCreatorScreening } from '../interfaces/creator.interface';
3
- import { CSFDColorRating } from '../interfaces/global';
4
- export declare const getColorRating: (el: HTMLElement) => CSFDColorRating;
5
- export declare const getId: (url: string) => number;
6
- export declare const getName: (el: HTMLElement | null) => string;
7
- export declare const getBirthdayInfo: (el: HTMLElement | null) => {
3
+ export declare const getCreatorId: (url: string) => number;
4
+ export declare const getCreatorName: (el: HTMLElement | null) => string;
5
+ export declare const getCreatorBirthdayInfo: (el: HTMLElement | null) => {
8
6
  birthday: string;
9
7
  age: number;
10
8
  birthPlace: string;
11
9
  };
12
- export declare const getBio: (el: HTMLElement | null) => string;
13
- export declare const getPhoto: (el: HTMLElement | null) => string;
14
- export declare const parseBirthday: (text: string) => any;
15
- export declare const parseAge: (text: string) => any;
16
- export declare const parseBirthPlace: (text: string) => any;
17
- export declare const getFilms: (el: HTMLElement | null) => CSFDCreatorScreening[];
10
+ export declare const getCreatorBio: (el: HTMLElement | null) => string;
11
+ export declare const getCreatorPhoto: (el: HTMLElement | null) => string;
12
+ export declare const getCreatorFilms: (el: HTMLElement | null) => CSFDCreatorScreening[];
@@ -1,25 +1,23 @@
1
1
  import { HTMLElement } from 'node-html-parser';
2
2
  import { CSFDColorRating } from '../interfaces/global';
3
- import { CSFDBoxContent, CSFDCreator, CSFDCreatorGroups, CSFDGenres, CSFDMovieListItem, CSFDPremiere, CSFDTitlesOther, CSFDVod } from '../interfaces/movie.interface';
4
- export declare const getId: (el: HTMLElement) => number;
5
- export declare const getTitle: (el: HTMLElement) => string;
6
- export declare const getGenres: (el: HTMLElement) => CSFDGenres[];
7
- export declare const getOrigins: (el: HTMLElement) => string[];
8
- export declare const getColorRating: (bodyClasses: string[]) => CSFDColorRating;
9
- export declare const getRating: (el: HTMLElement) => number;
10
- export declare const getRatingCount: (el: HTMLElement) => number;
11
- export declare const getYear: (el: string) => number;
12
- export declare const getDuration: (jsonLdRaw: string, el: HTMLElement) => number;
13
- export declare const getTitlesOther: (el: HTMLElement) => CSFDTitlesOther[];
14
- export declare const getPoster: (el: HTMLElement | null) => string;
15
- export declare const getRandomPhoto: (el: HTMLElement | null) => string;
16
- export declare const getTrivia: (el: HTMLElement | null) => string[];
17
- export declare const getDescriptions: (el: HTMLElement) => string[];
18
- export declare const parsePeople: (el: HTMLElement) => CSFDCreator[];
19
- export declare const getGroup: (el: HTMLElement, group: CSFDCreatorGroups) => CSFDCreator[];
20
- export declare const getType: (el: HTMLElement) => string;
21
- export declare const getVods: (el: HTMLElement | null) => CSFDVod[];
22
- export declare const getBoxContent: (el: HTMLElement, box: string) => HTMLElement;
23
- export declare const getBoxMovies: (el: HTMLElement, boxName: CSFDBoxContent) => CSFDMovieListItem[];
24
- export declare const getPremieres: (el: HTMLElement) => CSFDPremiere[];
25
- export declare const getTags: (el: HTMLElement) => string[];
3
+ import { CSFDBoxContent, CSFDCreatorGroups, CSFDGenres, CSFDMovieCreator, CSFDMovieListItem, CSFDPremiere, CSFDTitlesOther, CSFDVod } from '../interfaces/movie.interface';
4
+ export declare const getMovieId: (el: HTMLElement) => number;
5
+ export declare const getMovieTitle: (el: HTMLElement) => string;
6
+ export declare const getMovieGenres: (el: HTMLElement) => CSFDGenres[];
7
+ export declare const getMovieOrigins: (el: HTMLElement) => string[];
8
+ export declare const getMovieColorRating: (bodyClasses: string[]) => CSFDColorRating;
9
+ export declare const getMovieRating: (el: HTMLElement) => number;
10
+ export declare const getMovieRatingCount: (el: HTMLElement) => number;
11
+ export declare const getMovieYear: (el: string) => number;
12
+ export declare const getMovieDuration: (jsonLdRaw: string, el: HTMLElement) => number;
13
+ export declare const getMovieTitlesOther: (el: HTMLElement) => CSFDTitlesOther[];
14
+ export declare const getMoviePoster: (el: HTMLElement | null) => string;
15
+ export declare const getMovieRandomPhoto: (el: HTMLElement | null) => string;
16
+ export declare const getMovieTrivia: (el: HTMLElement | null) => string[];
17
+ export declare const getMovieDescriptions: (el: HTMLElement) => string[];
18
+ export declare const getMovieGroup: (el: HTMLElement, group: CSFDCreatorGroups) => CSFDMovieCreator[];
19
+ export declare const getMovieType: (el: HTMLElement) => string;
20
+ export declare const getMovieVods: (el: HTMLElement | null) => CSFDVod[];
21
+ export declare const getMovieBoxMovies: (el: HTMLElement, boxName: CSFDBoxContent) => CSFDMovieListItem[];
22
+ export declare const getMoviePremieres: (el: HTMLElement) => CSFDPremiere[];
23
+ export declare const getMovieTags: (el: HTMLElement) => string[];
@@ -1,11 +1,11 @@
1
1
  import { HTMLElement } from 'node-html-parser';
2
2
  import { CSFDColorRating, CSFDFilmTypes } from '../interfaces/global';
3
- import { CSFDCreator } from '../interfaces/movie.interface';
4
- export declare const getType: (el: HTMLElement) => CSFDFilmTypes;
5
- export declare const getTitle: (el: HTMLElement) => string;
6
- export declare const getYear: (el: HTMLElement) => number;
7
- export declare const getUrl: (el: HTMLElement) => string;
8
- export declare const getColorRating: (el: HTMLElement) => CSFDColorRating;
9
- export declare const getPoster: (el: HTMLElement) => string;
10
- export declare const getOrigins: (el: HTMLElement) => string[];
11
- export declare const parsePeople: (el: HTMLElement, type: "directors" | "actors") => CSFDCreator[];
3
+ import { CSFDMovieCreator } from '../interfaces/movie.interface';
4
+ export declare const getSearchType: (el: HTMLElement) => CSFDFilmTypes;
5
+ export declare const getSearchTitle: (el: HTMLElement) => string;
6
+ export declare const getSearchYear: (el: HTMLElement) => number;
7
+ export declare const getSearchUrl: (el: HTMLElement) => string;
8
+ export declare const getSearchColorRating: (el: HTMLElement) => CSFDColorRating;
9
+ export declare const getSearchPoster: (el: HTMLElement) => string;
10
+ export declare const getSearchOrigins: (el: HTMLElement) => string[];
11
+ export declare const parseSearchPeople: (el: HTMLElement, type: "directors" | "actors") => CSFDMovieCreator[];
@@ -1,13 +1,11 @@
1
1
  import { HTMLElement } from 'node-html-parser';
2
2
  import { CSFDColorRating, CSFDFilmTypes, CSFDStars } from '../interfaces/global';
3
- import { Colors } from '../interfaces/user-ratings.interface';
4
- export declare const getId: (el: HTMLElement) => number;
3
+ export declare const getUserRatingId: (el: HTMLElement) => number;
5
4
  export declare const getUserRating: (el: HTMLElement) => CSFDStars;
6
- export declare const getType: (el: HTMLElement) => CSFDFilmTypes;
7
- export declare const getTitle: (el: HTMLElement) => string;
8
- export declare const getYear: (el: HTMLElement) => number;
9
- export declare const getColorRating: (el: HTMLElement) => CSFDColorRating;
10
- export declare const getDate: (el: HTMLElement) => string;
11
- export declare const getUrl: (el: HTMLElement) => string;
12
- export declare const parseColor: (quality: Colors) => CSFDColorRating;
5
+ export declare const getUserRatingType: (el: HTMLElement) => CSFDFilmTypes;
6
+ export declare const getUserRatingTitle: (el: HTMLElement) => string;
7
+ export declare const getUserRatingYear: (el: HTMLElement) => number;
8
+ export declare const getUserRatingColorRating: (el: HTMLElement) => CSFDColorRating;
9
+ export declare const getUserRatingDate: (el: HTMLElement) => string;
10
+ export declare const getUserRatingUrl: (el: HTMLElement) => string;
13
11
  export declare const sleep: (ms: number) => Promise<unknown>;
@@ -23,22 +23,22 @@ export interface CSFDVod {
23
23
  url: string;
24
24
  }
25
25
  export interface CSFDCreators {
26
- directors: CSFDCreator[];
27
- writers: CSFDCreator[];
28
- cinematography: CSFDCreator[];
29
- music: CSFDCreator[];
30
- actors: CSFDCreator[];
31
- basedOn: CSFDCreator[];
32
- producers: CSFDCreator[];
33
- filmEditing: CSFDCreator[];
34
- costumeDesign: CSFDCreator[];
35
- productionDesign: CSFDCreator[];
26
+ directors: CSFDMovieCreator[];
27
+ writers: CSFDMovieCreator[];
28
+ cinematography: CSFDMovieCreator[];
29
+ music: CSFDMovieCreator[];
30
+ actors: CSFDMovieCreator[];
31
+ basedOn: CSFDMovieCreator[];
32
+ producers: CSFDMovieCreator[];
33
+ filmEditing: CSFDMovieCreator[];
34
+ costumeDesign: CSFDMovieCreator[];
35
+ productionDesign: CSFDMovieCreator[];
36
36
  }
37
37
  export interface CSFDTitlesOther {
38
38
  country: string;
39
39
  title: string;
40
40
  }
41
- export interface CSFDCreator {
41
+ export interface CSFDMovieCreator {
42
42
  /**
43
43
  * CSFD person ID.
44
44
  *
@@ -1,5 +1,5 @@
1
1
  import { CSFDScreening } from './global';
2
- import { CSFDCreator } from './movie.interface';
2
+ import { CSFDMovieCreator } from './movie.interface';
3
3
  export interface CSFDSearch {
4
4
  movies: CSFDSearchMovie[];
5
5
  tvSeries: CSFDSearchMovie[];
@@ -18,10 +18,10 @@ export interface CSFDSearchUser {
18
18
  avatar: string;
19
19
  url: string;
20
20
  }
21
- export interface CSFDSearchCreator extends CSFDCreator {
21
+ export interface CSFDSearchCreator extends CSFDMovieCreator {
22
22
  image: string;
23
23
  }
24
24
  export interface CSFDSearchCreators {
25
- directors: CSFDCreator[];
26
- actors: CSFDCreator[];
25
+ directors: CSFDMovieCreator[];
26
+ actors: CSFDMovieCreator[];
27
27
  }
package/types/vars.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CSFDCinemaPeriod } from 'interfaces/cinema.interface';
1
+ import { CSFDCinemaPeriod } from './interfaces/cinema.interface';
2
2
  export declare const userRatingsUrl: (user: string | number, page?: number) => string;
3
3
  export declare const movieUrl: (movie: number) => string;
4
4
  export declare const creatorUrl: (creator: number | string) => string;
@@ -1 +0,0 @@
1
- export declare const fetchPage: (url: string) => Promise<string>;
package/types/index.d.ts DELETED
@@ -1,24 +0,0 @@
1
- import { CSFDCinema, CSFDCinemaPeriod } from 'interfaces/cinema.interface';
2
- import { CSFDCreator } from './interfaces/creator.interface';
3
- import { CSFDMovie } from './interfaces/movie.interface';
4
- import { CSFDSearch } from './interfaces/search.interface';
5
- import { CSFDUserRatingConfig, CSFDUserRatings } from './interfaces/user-ratings.interface';
6
- import { CinemaScraper } from './services/cinema.service';
7
- import { CreatorScraper } from './services/creator.service';
8
- import { MovieScraper } from './services/movie.service';
9
- import { SearchScraper } from './services/search.service';
10
- import { UserRatingsScraper } from './services/user-ratings.service';
11
- export declare class Csfd {
12
- private userRatingsService;
13
- private movieService;
14
- private creatorService;
15
- private searchService;
16
- private cinemaService;
17
- constructor(userRatingsService: UserRatingsScraper, movieService: MovieScraper, creatorService: CreatorScraper, searchService: SearchScraper, cinemaService: CinemaScraper);
18
- userRatings(user: string | number, config?: CSFDUserRatingConfig): Promise<CSFDUserRatings[]>;
19
- movie(movie: number): Promise<CSFDMovie>;
20
- creator(creator: number): Promise<CSFDCreator>;
21
- search(text: string): Promise<CSFDSearch>;
22
- cinema(district: number | string, period: CSFDCinemaPeriod): Promise<CSFDCinema[]>;
23
- }
24
- export declare const csfd: Csfd;
package/types/index.ts DELETED
@@ -1,26 +0,0 @@
1
- /**
2
- * @file Automatically generated by barrelsby.
3
- */
4
-
5
- export * from "./index";
6
- export * from "./vars";
7
- export * from "./fetchers/fetch.polyfill";
8
- export * from "./fetchers/index";
9
- export * from "./helpers/cinema.helper";
10
- export * from "./helpers/creator.helper";
11
- export * from "./helpers/global.helper";
12
- export * from "./helpers/movie.helper";
13
- export * from "./helpers/search-user.helper";
14
- export * from "./helpers/search.helper";
15
- export * from "./helpers/user-ratings.helper";
16
- export * from "./interfaces/cinema.interface";
17
- export * from "./interfaces/creator.interface";
18
- export * from "./interfaces/global";
19
- export * from "./interfaces/movie.interface";
20
- export * from "./interfaces/search.interface";
21
- export * from "./interfaces/user-ratings.interface";
22
- export * from "./services/cinema.service";
23
- export * from "./services/creator.service";
24
- export * from "./services/movie.service";
25
- export * from "./services/search.service";
26
- export * from "./services/user-ratings.service";