node-csfd-api 3.0.0-next.22 → 3.0.0-next.24

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.
Files changed (90) hide show
  1. package/{fetchers → cjs/fetchers}/index.js +13 -4
  2. package/{helpers → cjs/helpers}/cinema.helper.js +12 -12
  3. package/{helpers → cjs/helpers}/creator.helper.js +19 -23
  4. package/{helpers → cjs/helpers}/movie.helper.js +44 -46
  5. package/{helpers → cjs/helpers}/search.helper.js +17 -17
  6. package/{helpers → cjs/helpers}/user-ratings.helper.js +16 -17
  7. package/cjs/index.js +58 -0
  8. package/cjs/services/cinema.service.js +45 -0
  9. package/cjs/services/creator.service.js +43 -0
  10. package/cjs/services/movie.service.js +69 -0
  11. package/cjs/services/search.service.js +91 -0
  12. package/cjs/services/user-ratings.service.js +95 -0
  13. package/esm/fetchers/index.js +13 -4
  14. package/esm/helpers/cinema.helper.js +7 -7
  15. package/esm/helpers/creator.helper.js +12 -12
  16. package/esm/helpers/movie.helper.js +23 -23
  17. package/esm/helpers/search.helper.js +8 -8
  18. package/esm/helpers/user-ratings.helper.js +8 -8
  19. package/esm/index.js +29 -10
  20. package/esm/services/cinema.service.js +20 -9
  21. package/esm/services/creator.service.js +27 -16
  22. package/esm/services/movie.service.js +51 -40
  23. package/esm/services/search.service.js +38 -27
  24. package/esm/services/user-ratings.service.js +45 -34
  25. package/package.json +11 -17
  26. package/{helpers → types/helpers}/cinema.helper.d.ts +5 -5
  27. package/types/helpers/creator.helper.d.ts +12 -0
  28. package/types/helpers/movie.helper.d.ts +23 -0
  29. package/types/helpers/search.helper.d.ts +11 -0
  30. package/types/helpers/user-ratings.helper.d.ts +11 -0
  31. package/{esm/types → types}/index.d.ts +1 -1
  32. package/types/index.ts +22 -0
  33. package/{interfaces → types/interfaces}/movie.interface.d.ts +11 -11
  34. package/{interfaces → types/interfaces}/search.interface.d.ts +4 -4
  35. package/{vars.d.ts → types/vars.d.ts} +1 -1
  36. package/esm/types/helpers/cinema.helper.d.ts +0 -18
  37. package/esm/types/helpers/creator.helper.d.ts +0 -17
  38. package/esm/types/helpers/movie.helper.d.ts +0 -25
  39. package/esm/types/helpers/search.helper.d.ts +0 -11
  40. package/esm/types/helpers/user-ratings.helper.d.ts +0 -13
  41. package/esm/types/interfaces/movie.interface.d.ts +0 -66
  42. package/esm/types/interfaces/search.interface.d.ts +0 -27
  43. package/esm/types/vars.d.ts +0 -6
  44. package/fetchers/fetch.polyfill.d.ts +0 -1
  45. package/fetchers/index.d.ts +0 -1
  46. package/helpers/creator.helper.d.ts +0 -17
  47. package/helpers/global.helper.d.ts +0 -17
  48. package/helpers/movie.helper.d.ts +0 -25
  49. package/helpers/search-user.helper.d.ts +0 -5
  50. package/helpers/search.helper.d.ts +0 -11
  51. package/helpers/user-ratings.helper.d.ts +0 -13
  52. package/index.d.ts +0 -24
  53. package/index.js +0 -39
  54. package/interfaces/cinema.interface.d.ts +0 -23
  55. package/interfaces/creator.interface.d.ts +0 -12
  56. package/interfaces/global.d.ts +0 -22
  57. package/interfaces/user-ratings.interface.d.ts +0 -18
  58. package/services/cinema.service.d.ts +0 -6
  59. package/services/cinema.service.js +0 -34
  60. package/services/creator.service.d.ts +0 -6
  61. package/services/creator.service.js +0 -32
  62. package/services/movie.service.d.ts +0 -6
  63. package/services/movie.service.js +0 -58
  64. package/services/search.service.d.ts +0 -5
  65. package/services/search.service.js +0 -80
  66. package/services/user-ratings.service.d.ts +0 -7
  67. package/services/user-ratings.service.js +0 -84
  68. /package/{fetchers → cjs/fetchers}/fetch.polyfill.js +0 -0
  69. /package/{helpers → cjs/helpers}/global.helper.js +0 -0
  70. /package/{helpers → cjs/helpers}/search-user.helper.js +0 -0
  71. /package/{interfaces → cjs/interfaces}/cinema.interface.js +0 -0
  72. /package/{interfaces → cjs/interfaces}/creator.interface.js +0 -0
  73. /package/{interfaces → cjs/interfaces}/global.js +0 -0
  74. /package/{interfaces → cjs/interfaces}/movie.interface.js +0 -0
  75. /package/{interfaces → cjs/interfaces}/search.interface.js +0 -0
  76. /package/{interfaces → cjs/interfaces}/user-ratings.interface.js +0 -0
  77. /package/{vars.js → cjs/vars.js} +0 -0
  78. /package/{esm/types → types}/fetchers/fetch.polyfill.d.ts +0 -0
  79. /package/{esm/types → types}/fetchers/index.d.ts +0 -0
  80. /package/{esm/types → types}/helpers/global.helper.d.ts +0 -0
  81. /package/{esm/types → types}/helpers/search-user.helper.d.ts +0 -0
  82. /package/{esm/types → types}/interfaces/cinema.interface.d.ts +0 -0
  83. /package/{esm/types → types}/interfaces/creator.interface.d.ts +0 -0
  84. /package/{esm/types → types}/interfaces/global.d.ts +0 -0
  85. /package/{esm/types → types}/interfaces/user-ratings.interface.d.ts +0 -0
  86. /package/{esm/types → types}/services/cinema.service.d.ts +0 -0
  87. /package/{esm/types → types}/services/creator.service.d.ts +0 -0
  88. /package/{esm/types → types}/services/movie.service.d.ts +0 -0
  89. /package/{esm/types → types}/services/search.service.d.ts +0 -0
  90. /package/{esm/types → types}/services/user-ratings.service.d.ts +0 -0
@@ -0,0 +1,12 @@
1
+ import { HTMLElement } from 'node-html-parser';
2
+ import { CSFDCreatorScreening } from '../interfaces/creator.interface';
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) => {
6
+ birthday: string;
7
+ age: number;
8
+ birthPlace: string;
9
+ };
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[];
@@ -0,0 +1,23 @@
1
+ import { HTMLElement } from 'node-html-parser';
2
+ import { CSFDColorRating } from '../interfaces/global';
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[];
@@ -0,0 +1,11 @@
1
+ import { HTMLElement } from 'node-html-parser';
2
+ import { CSFDColorRating, CSFDFilmTypes } from '../interfaces/global';
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[];
@@ -0,0 +1,11 @@
1
+ import { HTMLElement } from 'node-html-parser';
2
+ import { CSFDColorRating, CSFDFilmTypes, CSFDStars } from '../interfaces/global';
3
+ export declare const getUserRatingId: (el: HTMLElement) => number;
4
+ export declare const getUserRating: (el: HTMLElement) => CSFDStars;
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;
11
+ export declare const sleep: (ms: number) => Promise<unknown>;
@@ -1,4 +1,4 @@
1
- import { CSFDCinema, CSFDCinemaPeriod } from 'interfaces/cinema.interface';
1
+ import { CSFDCinema, CSFDCinemaPeriod } from './interfaces/cinema.interface';
2
2
  import { CSFDCreator } from './interfaces/creator.interface';
3
3
  import { CSFDMovie } from './interfaces/movie.interface';
4
4
  import { CSFDSearch } from './interfaces/search.interface';
package/types/index.ts ADDED
@@ -0,0 +1,22 @@
1
+ export * from "./index";
2
+ export * from "./vars";
3
+ export * from "./fetchers/fetch.polyfill";
4
+ export * from "./fetchers/index";
5
+ export * from "./helpers/cinema.helper";
6
+ export * from "./helpers/creator.helper";
7
+ export * from "./helpers/global.helper";
8
+ export * from "./helpers/movie.helper";
9
+ export * from "./helpers/search-user.helper";
10
+ export * from "./helpers/search.helper";
11
+ export * from "./helpers/user-ratings.helper";
12
+ export * from "./interfaces/cinema.interface";
13
+ export * from "./interfaces/creator.interface";
14
+ export * from "./interfaces/global";
15
+ export * from "./interfaces/movie.interface";
16
+ export * from "./interfaces/search.interface";
17
+ export * from "./interfaces/user-ratings.interface";
18
+ export * from "./services/cinema.service";
19
+ export * from "./services/creator.service";
20
+ export * from "./services/movie.service";
21
+ export * from "./services/search.service";
22
+ export * from "./services/user-ratings.service";
@@ -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
  }
@@ -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,18 +0,0 @@
1
- import { CSFDCinemaGroupedFilmsByDate, CSFDCinemaMeta, CSFDCinemaMovie } from 'interfaces/cinema.interface';
2
- import { HTMLElement } from 'node-html-parser';
3
- import { CSFDColorRating } from '../interfaces/global';
4
- export declare const getColorRating: (el: HTMLElement) => CSFDColorRating;
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) => {
8
- lat: number;
9
- lng: number;
10
- } | null;
11
- export declare const getCinemaUrl: (el: HTMLElement | null) => string;
12
- export declare const parseCinema: (el: HTMLElement | null) => {
13
- city: string;
14
- name: string;
15
- };
16
- export declare const getGroupedFilmsByDate: (el: HTMLElement | null) => CSFDCinemaGroupedFilmsByDate[];
17
- export declare const getFilms: (date: string, el: HTMLElement | null) => CSFDCinemaMovie[];
18
- export declare const parseMeta: (meta: string[]) => CSFDCinemaMeta[];
@@ -1,17 +0,0 @@
1
- import { HTMLElement } from 'node-html-parser';
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) => {
8
- birthday: string;
9
- age: number;
10
- birthPlace: string;
11
- };
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[];
@@ -1,25 +0,0 @@
1
- import { HTMLElement } from 'node-html-parser';
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[];
@@ -1,11 +0,0 @@
1
- import { HTMLElement } from 'node-html-parser';
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[];
@@ -1,13 +0,0 @@
1
- import { HTMLElement } from 'node-html-parser';
2
- import { CSFDColorRating, CSFDFilmTypes, CSFDStars } from '../interfaces/global';
3
- import { Colors } from '../interfaces/user-ratings.interface';
4
- export declare const getId: (el: HTMLElement) => number;
5
- 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;
13
- export declare const sleep: (ms: number) => Promise<unknown>;
@@ -1,66 +0,0 @@
1
- import { CSFDScreening } from './global';
2
- export interface CSFDMovie extends CSFDScreening {
3
- rating: number | null;
4
- poster: string;
5
- photo: string;
6
- ratingCount: number | null;
7
- duration: number | string;
8
- titlesOther: CSFDTitlesOther[];
9
- origins: string[];
10
- descriptions: string[];
11
- trivia: string[];
12
- genres: CSFDGenres[] | string[];
13
- creators: CSFDCreators;
14
- vod: CSFDVod[];
15
- tags: string[];
16
- premieres: CSFDPremiere[];
17
- related: CSFDMovieListItem[];
18
- similar: CSFDMovieListItem[];
19
- }
20
- export type CSFDVodService = 'Netflix' | 'hbogo' | 'Prime Video' | 'Apple TV+' | 'iTunes' | 'KVIFF.TV' | 'Edisonline' | 'o2tv' | 'SledovaniTV' | 'Starmax' | 'DAFilms' | 'FILMY ČESKY A ZADARMO' | 'Youtube Česká filmová klasika' | 'VAPET' | 'VOREL FILM' | 'ivysilani' | 'Google Play' | 'Voyo' | 'DVD';
21
- export interface CSFDVod {
22
- title: CSFDVodService;
23
- url: string;
24
- }
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[];
36
- }
37
- export interface CSFDTitlesOther {
38
- country: string;
39
- title: string;
40
- }
41
- export interface CSFDCreator {
42
- /**
43
- * CSFD person ID.
44
- *
45
- * You can always assemble url from ID like this:
46
- *
47
- * `https://www.csfd.cz/tvurce/${id}`
48
- */
49
- id: number;
50
- name: string;
51
- url: string;
52
- }
53
- export interface CSFDMovieListItem {
54
- id: number;
55
- title: string;
56
- url: string;
57
- }
58
- export type CSFDGenres = 'Akční' | 'Animovaný' | 'Dobrodružný' | 'Dokumentární' | 'Drama' | 'Experimentální' | 'Fantasy' | 'Film-Noir' | 'Historický' | 'Horor' | 'Hudební' | 'IMAX' | 'Katastrofický' | 'Komedie' | 'Krátkometrážní' | 'Krimi' | 'Loutkový' | 'Muzikál' | 'Mysteriózní' | 'Naučný' | 'Podobenství' | 'Poetický' | 'Pohádka' | 'Povídkový' | 'Psychologický' | 'Publicistický' | 'Reality-TV' | 'Road movie' | 'Rodinný' | 'Romantický' | 'Sci-Fi' | 'Soutěžní' | 'Sportovní' | 'Stand-up' | 'Talk-show' | 'Taneční' | 'Telenovela' | 'Thriller' | 'Válečný' | 'Western' | 'Zábavný' | 'Životopisný';
59
- export type CSFDCreatorGroups = 'Režie' | 'Scénář' | 'Kamera' | 'Hudba' | 'Hrají' | 'Produkce' | 'Střih' | 'Předloha' | 'Scénografie' | 'Kostýmy';
60
- export interface CSFDPremiere {
61
- country: string;
62
- format: string;
63
- date: string;
64
- company: string;
65
- }
66
- export type CSFDBoxContent = 'Související' | 'Podobné';
@@ -1,27 +0,0 @@
1
- import { CSFDScreening } from './global';
2
- import { CSFDCreator } from './movie.interface';
3
- export interface CSFDSearch {
4
- movies: CSFDSearchMovie[];
5
- tvSeries: CSFDSearchMovie[];
6
- creators: CSFDSearchCreator[];
7
- users: CSFDSearchUser[];
8
- }
9
- export interface CSFDSearchMovie extends CSFDScreening {
10
- poster: string;
11
- origins: string[];
12
- creators: CSFDSearchCreators;
13
- }
14
- export interface CSFDSearchUser {
15
- id: number;
16
- user: string;
17
- userRealName: string;
18
- avatar: string;
19
- url: string;
20
- }
21
- export interface CSFDSearchCreator extends CSFDCreator {
22
- image: string;
23
- }
24
- export interface CSFDSearchCreators {
25
- directors: CSFDCreator[];
26
- actors: CSFDCreator[];
27
- }
@@ -1,6 +0,0 @@
1
- import { CSFDCinemaPeriod } from 'interfaces/cinema.interface';
2
- export declare const userRatingsUrl: (user: string | number, page?: number) => string;
3
- export declare const movieUrl: (movie: number) => string;
4
- export declare const creatorUrl: (creator: number | string) => string;
5
- export declare const cinemasUrl: (district: number | string, period: CSFDCinemaPeriod) => string;
6
- export declare const searchUrl: (text: string) => string;
@@ -1 +0,0 @@
1
- export declare const fetchSafe: typeof fetch;
@@ -1 +0,0 @@
1
- export declare const fetchPage: (url: string) => Promise<string>;
@@ -1,17 +0,0 @@
1
- import { HTMLElement } from 'node-html-parser';
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) => {
8
- birthday: string;
9
- age: number;
10
- birthPlace: string;
11
- };
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[];
@@ -1,17 +0,0 @@
1
- import { CSFDColorRating } from '../interfaces/global';
2
- import { Colors } from '../interfaces/user-ratings.interface';
3
- export declare const parseIdFromUrl: (url: string) => number;
4
- export declare const getColor: (cls: string) => CSFDColorRating;
5
- export declare const parseColor: (quality: Colors) => CSFDColorRating;
6
- export declare const addProtocol: (url: string) => string;
7
- export declare const getDuration: (matches: any[]) => {
8
- sign: string;
9
- years: any;
10
- months: any;
11
- weeks: any;
12
- days: any;
13
- hours: any;
14
- minutes: any;
15
- seconds: any;
16
- };
17
- export declare const parseISO8601Duration: (iso: string) => number;
@@ -1,25 +0,0 @@
1
- import { HTMLElement } from 'node-html-parser';
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[];
@@ -1,5 +0,0 @@
1
- import { HTMLElement } from 'node-html-parser';
2
- export declare const getUser: (el: HTMLElement) => string;
3
- export declare const getUserRealName: (el: HTMLElement) => string;
4
- export declare const getAvatar: (el: HTMLElement) => string;
5
- export declare const getUserUrl: (el: HTMLElement) => string;
@@ -1,11 +0,0 @@
1
- import { HTMLElement } from 'node-html-parser';
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[];
@@ -1,13 +0,0 @@
1
- import { HTMLElement } from 'node-html-parser';
2
- import { CSFDColorRating, CSFDFilmTypes, CSFDStars } from '../interfaces/global';
3
- import { Colors } from '../interfaces/user-ratings.interface';
4
- export declare const getId: (el: HTMLElement) => number;
5
- 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;
13
- export declare const sleep: (ms: number) => Promise<unknown>;
package/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/index.js DELETED
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.csfd = exports.Csfd = void 0;
4
- const cinema_service_1 = require("./services/cinema.service");
5
- const creator_service_1 = require("./services/creator.service");
6
- const movie_service_1 = require("./services/movie.service");
7
- const search_service_1 = require("./services/search.service");
8
- const user_ratings_service_1 = require("./services/user-ratings.service");
9
- class Csfd {
10
- constructor(userRatingsService, movieService, creatorService, searchService, cinemaService) {
11
- this.userRatingsService = userRatingsService;
12
- this.movieService = movieService;
13
- this.creatorService = creatorService;
14
- this.searchService = searchService;
15
- this.cinemaService = cinemaService;
16
- }
17
- async userRatings(user, config) {
18
- return this.userRatingsService.userRatings(user, config);
19
- }
20
- async movie(movie) {
21
- return this.movieService.movie(+movie);
22
- }
23
- async creator(creator) {
24
- return this.creatorService.creator(+creator);
25
- }
26
- async search(text) {
27
- return this.searchService.search(text);
28
- }
29
- async cinema(district, period) {
30
- return this.cinemaService.cinemas(+district, period);
31
- }
32
- }
33
- exports.Csfd = Csfd;
34
- const movieScraper = new movie_service_1.MovieScraper();
35
- const userRatingsScraper = new user_ratings_service_1.UserRatingsScraper();
36
- const cinemaScraper = new cinema_service_1.CinemaScraper();
37
- const creatorScraper = new creator_service_1.CreatorScraper();
38
- const searchScraper = new search_service_1.SearchScraper();
39
- exports.csfd = new Csfd(userRatingsScraper, movieScraper, creatorScraper, searchScraper, cinemaScraper);
@@ -1,23 +0,0 @@
1
- import { CSFDMovieListItem } from './movie.interface';
2
- export interface CSFDCinema {
3
- id: number;
4
- name: string;
5
- city: string;
6
- url: string;
7
- coords: {
8
- lat: number;
9
- lng: number;
10
- };
11
- region?: string;
12
- screenings: CSFDCinemaGroupedFilmsByDate[];
13
- }
14
- export interface CSFDCinemaGroupedFilmsByDate {
15
- date: string;
16
- films: CSFDCinemaMovie[];
17
- }
18
- export interface CSFDCinemaMovie extends CSFDMovieListItem {
19
- meta: CSFDCinemaMeta[];
20
- showTimes: string[];
21
- }
22
- export type CSFDCinemaMeta = 'dubbing' | '3D' | 'subtitles' | string;
23
- export type CSFDCinemaPeriod = 'today' | 'weekend' | 'week' | 'tomorrow' | 'month';
@@ -1,12 +0,0 @@
1
- import { CSFDScreening } from './global';
2
- export interface CSFDCreator {
3
- id: number;
4
- name: string;
5
- birthday: string;
6
- birthplace: string;
7
- photo: string;
8
- age: number | string;
9
- bio: string;
10
- films: CSFDCreatorScreening[];
11
- }
12
- export type CSFDCreatorScreening = Omit<CSFDScreening, 'url' | 'type'>;
@@ -1,22 +0,0 @@
1
- export interface CSFDScreening {
2
- id: number;
3
- title: string;
4
- year: number;
5
- url: string;
6
- type: CSFDFilmTypes;
7
- /**
8
- * Overall aggregated rating. (On the web usually represented by colors).
9
- *
10
- * 'unknown': unknown (gray color)
11
- *
12
- * 'good': 70% – 100 % (red color)
13
- *
14
- * 'average': 30% - 69% (blue color)
15
- *
16
- * 'bad': 0% - 29% (black color)
17
- */
18
- colorRating: CSFDColorRating;
19
- }
20
- export type CSFDColorRating = 'bad' | 'average' | 'good' | 'unknown';
21
- export type CSFDStars = 0 | 1 | 2 | 3 | 4 | 5;
22
- export type CSFDFilmTypes = 'film' | 'TV film' | 'pořad' | 'seriál' | 'divadelní záznam' | 'koncert' | 'série' | 'studentský film' | 'amatérský film' | 'hudební videoklip' | 'epizoda';
@@ -1,18 +0,0 @@
1
- import { CSFDFilmTypes, CSFDScreening, CSFDStars } from './global';
2
- export interface CSFDUserRatings extends CSFDScreening {
3
- userRating: CSFDStars;
4
- userDate: string;
5
- }
6
- export interface CSFDUserRatingConfig {
7
- includesOnly?: CSFDFilmTypes[];
8
- excludes?: CSFDFilmTypes[];
9
- /**
10
- * Fetch all ratings. (Warning: Use it wisely. Can be detected and banned. Consider using it together with `allPagesDelay` attribute)
11
- */
12
- allPages?: boolean;
13
- /**
14
- * Delay on each page request. In milliseconds
15
- */
16
- allPagesDelay?: number;
17
- }
18
- export type Colors = 'lightgrey' | 'blue' | 'red' | 'grey';
@@ -1,6 +0,0 @@
1
- import { CSFDCinema, CSFDCinemaPeriod } from '../interfaces/cinema.interface';
2
- export declare class CinemaScraper {
3
- private cinema;
4
- cinemas(district?: number, period?: CSFDCinemaPeriod): Promise<CSFDCinema[]>;
5
- private buildCinemas;
6
- }