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.
- package/cjs/helpers/cinema.helper.js +12 -12
- package/cjs/helpers/creator.helper.js +19 -23
- package/cjs/helpers/movie.helper.js +44 -46
- package/cjs/helpers/search.helper.js +17 -17
- package/cjs/helpers/user-ratings.helper.js +16 -17
- package/cjs/services/cinema.service.js +1 -1
- package/cjs/services/creator.service.js +7 -7
- package/cjs/services/movie.service.js +29 -29
- package/cjs/services/search.service.js +18 -18
- package/cjs/services/user-ratings.service.js +8 -8
- package/esm/helpers/cinema.helper.js +7 -7
- package/esm/helpers/creator.helper.js +12 -12
- package/esm/helpers/movie.helper.js +23 -23
- package/esm/helpers/search.helper.js +8 -8
- package/esm/helpers/user-ratings.helper.js +8 -8
- package/esm/services/cinema.service.js +2 -2
- package/esm/services/creator.service.js +8 -8
- package/esm/services/movie.service.js +30 -30
- package/esm/services/search.service.js +19 -19
- package/esm/services/user-ratings.service.js +9 -9
- package/index.d.ts +20 -0
- package/package.json +3 -3
- package/types/helpers/cinema.helper.d.ts +5 -5
- package/types/helpers/creator.helper.d.ts +6 -11
- package/types/helpers/movie.helper.d.ts +21 -23
- package/types/helpers/search.helper.d.ts +9 -9
- package/types/helpers/user-ratings.helper.d.ts +7 -9
- package/types/interfaces/movie.interface.d.ts +11 -11
- package/types/interfaces/search.interface.d.ts +4 -4
- package/types/vars.d.ts +1 -1
- package/types/fetchers/index.d.ts +0 -1
- package/types/index.d.ts +0 -24
- package/types/index.ts +0 -26
|
@@ -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 {
|
|
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 =
|
|
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:
|
|
82
|
-
title:
|
|
83
|
-
year:
|
|
84
|
-
type:
|
|
85
|
-
url:
|
|
86
|
-
colorRating:
|
|
87
|
-
userDate:
|
|
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.
|
|
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='./
|
|
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": "./
|
|
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
|
-
|
|
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
|
|
7
|
-
export declare const
|
|
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
|
|
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
|
-
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
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
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
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,
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const
|
|
18
|
-
export declare const
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const
|
|
21
|
-
export declare const
|
|
22
|
-
export declare const
|
|
23
|
-
export declare const
|
|
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 {
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
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
|
-
|
|
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
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
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:
|
|
27
|
-
writers:
|
|
28
|
-
cinematography:
|
|
29
|
-
music:
|
|
30
|
-
actors:
|
|
31
|
-
basedOn:
|
|
32
|
-
producers:
|
|
33
|
-
filmEditing:
|
|
34
|
-
costumeDesign:
|
|
35
|
-
productionDesign:
|
|
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
|
|
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 {
|
|
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
|
|
21
|
+
export interface CSFDSearchCreator extends CSFDMovieCreator {
|
|
22
22
|
image: string;
|
|
23
23
|
}
|
|
24
24
|
export interface CSFDSearchCreators {
|
|
25
|
-
directors:
|
|
26
|
-
actors:
|
|
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";
|