node-csfd-api 2.14.4 → 3.0.0-alpha.1
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/LICENSE +21 -0
- package/_virtual/rolldown_runtime.js +25 -0
- package/dto/cinema.d.mts +28 -0
- package/dto/cinema.d.ts +28 -0
- package/dto/creator.d.mts +17 -0
- package/dto/creator.d.ts +17 -0
- package/dto/global.d.mts +26 -0
- package/dto/global.d.ts +26 -0
- package/dto/movie.d.mts +71 -0
- package/dto/movie.d.ts +71 -0
- package/dto/search.d.mts +32 -0
- package/dto/search.d.ts +32 -0
- package/dto/user-ratings.d.mts +23 -0
- package/dto/user-ratings.d.ts +23 -0
- package/fetchers/fetch.polyfill.js +10 -9
- package/fetchers/fetch.polyfill.js.map +1 -0
- package/fetchers/fetch.polyfill.mjs +8 -0
- package/fetchers/fetch.polyfill.mjs.map +1 -0
- package/fetchers/fetchers.js +24 -0
- package/fetchers/fetchers.js.map +1 -0
- package/fetchers/fetchers.mjs +24 -0
- package/fetchers/fetchers.mjs.map +1 -0
- package/helpers/cinema.helper.js +70 -91
- package/helpers/cinema.helper.js.map +1 -0
- package/helpers/cinema.helper.mjs +80 -0
- package/helpers/cinema.helper.mjs.map +1 -0
- package/helpers/creator.helper.js +64 -78
- package/helpers/creator.helper.js.map +1 -0
- package/helpers/creator.helper.mjs +69 -0
- package/helpers/creator.helper.mjs.map +1 -0
- package/helpers/global.helper.js +37 -55
- package/helpers/global.helper.js.map +1 -0
- package/helpers/global.helper.mjs +45 -0
- package/helpers/global.helper.mjs.map +1 -0
- package/helpers/movie.helper.js +161 -252
- package/helpers/movie.helper.js.map +1 -0
- package/helpers/movie.helper.mjs +144 -0
- package/helpers/movie.helper.mjs.map +1 -0
- package/helpers/search-user.helper.js +20 -18
- package/helpers/search-user.helper.js.map +1 -0
- package/helpers/search-user.helper.mjs +24 -0
- package/helpers/search-user.helper.mjs.map +1 -0
- package/helpers/search.helper.js +52 -62
- package/helpers/search.helper.js.map +1 -0
- package/helpers/search.helper.mjs +45 -0
- package/helpers/search.helper.mjs.map +1 -0
- package/helpers/user-ratings.helper.js +47 -56
- package/helpers/user-ratings.helper.js.map +1 -0
- package/helpers/user-ratings.helper.mjs +44 -0
- package/helpers/user-ratings.helper.mjs.map +1 -0
- package/index.d.mts +30 -0
- package/index.d.ts +29 -23
- package/index.js +41 -38
- package/index.js.map +1 -0
- package/index.mjs +41 -0
- package/index.mjs.map +1 -0
- package/package.json +11 -25
- package/services/cinema.service.d.mts +11 -0
- package/services/cinema.service.d.ts +10 -5
- package/services/cinema.service.js +34 -33
- package/services/cinema.service.js.map +1 -0
- package/services/cinema.service.mjs +33 -0
- package/services/cinema.service.mjs.map +1 -0
- package/services/creator.service.d.mts +11 -0
- package/services/creator.service.d.ts +10 -5
- package/services/creator.service.js +34 -35
- package/services/creator.service.js.map +1 -0
- package/services/creator.service.mjs +33 -0
- package/services/creator.service.mjs.map +1 -0
- package/services/movie.service.d.mts +11 -0
- package/services/movie.service.d.ts +10 -5
- package/services/movie.service.js +61 -61
- package/services/movie.service.js.map +1 -0
- package/services/movie.service.mjs +60 -0
- package/services/movie.service.mjs.map +1 -0
- package/services/search.service.d.mts +10 -0
- package/services/search.service.d.ts +9 -4
- package/services/search.service.js +80 -79
- package/services/search.service.js.map +1 -0
- package/services/search.service.mjs +79 -0
- package/services/search.service.mjs.map +1 -0
- package/services/user-ratings.service.d.mts +12 -0
- package/services/user-ratings.service.d.ts +11 -6
- package/services/user-ratings.service.js +63 -81
- package/services/user-ratings.service.js.map +1 -0
- package/services/user-ratings.service.mjs +64 -0
- package/services/user-ratings.service.mjs.map +1 -0
- package/vars.js +11 -9
- package/vars.js.map +1 -0
- package/vars.mjs +12 -0
- package/vars.mjs.map +1 -0
- package/fetchers/fetch.polyfill.d.ts +0 -1
- package/fetchers/index.d.ts +0 -1
- package/fetchers/index.js +0 -27
- package/helpers/cinema.helper.d.ts +0 -18
- package/helpers/creator.helper.d.ts +0 -17
- package/helpers/global.helper.d.ts +0 -17
- package/helpers/movie.helper.d.ts +0 -25
- package/helpers/search-user.helper.d.ts +0 -5
- package/helpers/search.helper.d.ts +0 -11
- package/helpers/user-ratings.helper.d.ts +0 -13
- package/interfaces/cinema.interface.d.ts +0 -23
- package/interfaces/cinema.interface.js +0 -2
- package/interfaces/creator.interface.d.ts +0 -12
- package/interfaces/creator.interface.js +0 -2
- package/interfaces/global.d.ts +0 -22
- package/interfaces/global.js +0 -2
- package/interfaces/movie.interface.d.ts +0 -66
- package/interfaces/movie.interface.js +0 -2
- package/interfaces/search.interface.d.ts +0 -27
- package/interfaces/search.interface.js +0 -2
- package/interfaces/user-ratings.interface.d.ts +0 -18
- package/interfaces/user-ratings.interface.js +0 -2
- package/vars.d.ts +0 -6
|
@@ -1,84 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return allMovies;
|
|
38
|
-
}
|
|
39
|
-
return allMovies;
|
|
40
|
-
}
|
|
41
|
-
getPage(config, movies) {
|
|
42
|
-
var _a, _b, _c, _d;
|
|
43
|
-
if (config) {
|
|
44
|
-
if (((_a = config.includesOnly) === null || _a === void 0 ? void 0 : _a.length) && ((_b = config.excludes) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
45
|
-
console.warn(`node-csfd-api:
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_fetchers = require('../fetchers/fetchers.js');
|
|
3
|
+
const require_vars = require('../vars.js');
|
|
4
|
+
const require_user_ratings_helper = require('../helpers/user-ratings.helper.js');
|
|
5
|
+
let node_html_parser = require("node-html-parser");
|
|
6
|
+
node_html_parser = require_rolldown_runtime.__toESM(node_html_parser);
|
|
7
|
+
|
|
8
|
+
//#region src/services/user-ratings.service.ts
|
|
9
|
+
var UserRatingsScraper = class {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.films = [];
|
|
12
|
+
}
|
|
13
|
+
async userRatings(user, config) {
|
|
14
|
+
let allMovies = [];
|
|
15
|
+
const url = require_vars.userRatingsUrl(user);
|
|
16
|
+
const items = (0, node_html_parser.parse)(await require_fetchers.fetchPage(url));
|
|
17
|
+
const movies = items.querySelectorAll(".box-user-rating .table-container tbody tr");
|
|
18
|
+
const pagesNode = items.querySelector(".pagination");
|
|
19
|
+
const pages = +pagesNode?.childNodes[pagesNode.childNodes.length - 4].rawText || 1;
|
|
20
|
+
allMovies = this.getPage(config, movies);
|
|
21
|
+
if (config?.allPages) {
|
|
22
|
+
console.log("User", user, url);
|
|
23
|
+
console.log("Fetching all pages", pages);
|
|
24
|
+
for (let i = 2; i <= pages; i++) {
|
|
25
|
+
console.log("Fetching page", i, "out of", pages, "...");
|
|
26
|
+
const movies$1 = (0, node_html_parser.parse)(await require_fetchers.fetchPage(require_vars.userRatingsUrl(user, i))).querySelectorAll(".box-user-rating .table-container tbody tr");
|
|
27
|
+
allMovies = [...this.getPage(config, movies$1)];
|
|
28
|
+
if (config.allPagesDelay) await require_user_ratings_helper.sleep(config.allPagesDelay);
|
|
29
|
+
}
|
|
30
|
+
return allMovies;
|
|
31
|
+
}
|
|
32
|
+
return allMovies;
|
|
33
|
+
}
|
|
34
|
+
getPage(config, movies) {
|
|
35
|
+
if (config) {
|
|
36
|
+
if (config.includesOnly?.length && config.excludes?.length) console.warn(`node-csfd-api:
|
|
46
37
|
You can not use both parameters 'includesOnly' and 'excludes'.
|
|
47
38
|
Parameter 'includesOnly' will be used now:`, config.includesOnly);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
title: (0, user_ratings_helper_1.getTitle)(el),
|
|
75
|
-
year: (0, user_ratings_helper_1.getYear)(el),
|
|
76
|
-
type: (0, user_ratings_helper_1.getType)(el),
|
|
77
|
-
url: (0, user_ratings_helper_1.getUrl)(el),
|
|
78
|
-
colorRating: (0, user_ratings_helper_1.getColorRating)(el),
|
|
79
|
-
userDate: (0, user_ratings_helper_1.getDate)(el),
|
|
80
|
-
userRating: (0, user_ratings_helper_1.getUserRating)(el)
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
39
|
+
}
|
|
40
|
+
for (const el of movies) {
|
|
41
|
+
const type = require_user_ratings_helper.getUserRatingType(el);
|
|
42
|
+
if (config?.includesOnly?.length) {
|
|
43
|
+
if (config.includesOnly.some((include) => type === include)) this.buildUserRatings(el);
|
|
44
|
+
} else if (config?.excludes?.length) {
|
|
45
|
+
if (!config.excludes.some((exclude) => type === exclude)) this.buildUserRatings(el);
|
|
46
|
+
} else this.buildUserRatings(el);
|
|
47
|
+
}
|
|
48
|
+
return this.films;
|
|
49
|
+
}
|
|
50
|
+
buildUserRatings(el) {
|
|
51
|
+
this.films.push({
|
|
52
|
+
id: require_user_ratings_helper.getUserRatingId(el),
|
|
53
|
+
title: require_user_ratings_helper.getUserRatingTitle(el),
|
|
54
|
+
year: require_user_ratings_helper.getUserRatingYear(el),
|
|
55
|
+
type: require_user_ratings_helper.getUserRatingType(el),
|
|
56
|
+
url: require_user_ratings_helper.getUserRatingUrl(el),
|
|
57
|
+
colorRating: require_user_ratings_helper.getUserRatingColorRating(el),
|
|
58
|
+
userDate: require_user_ratings_helper.getUserRatingDate(el),
|
|
59
|
+
userRating: require_user_ratings_helper.getUserRating(el)
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
84
65
|
exports.UserRatingsScraper = UserRatingsScraper;
|
|
66
|
+
//# sourceMappingURL=user-ratings.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-ratings.service.js","names":["allMovies: CSFDUserRatings[]","userRatingsUrl","fetchPage","movies","sleep","getUserRatingType","getUserRatingId","getUserRatingTitle","getUserRatingYear","getUserRatingUrl","getUserRatingColorRating","getUserRatingDate","getUserRating"],"sources":["../../src/services/user-ratings.service.ts"],"sourcesContent":["import { HTMLElement, parse } from 'node-html-parser';\nimport { CSFDColorRating, CSFDStars } from '../dto/global';\nimport { CSFDUserRatingConfig, CSFDUserRatings } from '../dto/user-ratings';\nimport { fetchPage } from '../fetchers/fetchers.js';\nimport {\n getUserRating,\n getUserRatingColorRating,\n getUserRatingDate,\n getUserRatingId,\n getUserRatingTitle,\n getUserRatingType,\n getUserRatingUrl,\n getUserRatingYear,\n sleep\n} from '../helpers/user-ratings.helper.js';\nimport { userRatingsUrl } from '../vars.js';\n\nexport class UserRatingsScraper {\n private films: CSFDUserRatings[] = [];\n\n public async userRatings(\n user: string | number,\n config?: CSFDUserRatingConfig\n ): Promise<CSFDUserRatings[]> {\n let allMovies: CSFDUserRatings[] = [];\n const url = userRatingsUrl(user);\n const response = await fetchPage(url);\n\n const items = parse(response);\n const movies = items.querySelectorAll('.box-user-rating .table-container tbody tr');\n\n // Get number of pages\n const pagesNode = items.querySelector('.pagination');\n const pages = +pagesNode?.childNodes[pagesNode.childNodes.length - 4].rawText || 1;\n\n allMovies = this.getPage(config, movies);\n\n if (config?.allPages) {\n console.log('User', user, url);\n console.log('Fetching all pages', pages);\n for (let i = 2; i <= pages; i++) {\n console.log('Fetching page', i, 'out of', pages, '...');\n const url = userRatingsUrl(user, i);\n const response = await fetchPage(url);\n\n const items = parse(response);\n const movies = items.querySelectorAll('.box-user-rating .table-container tbody tr');\n allMovies = [...this.getPage(config, movies)];\n\n // Sleep\n if (config.allPagesDelay) {\n await sleep(config.allPagesDelay);\n }\n }\n return allMovies;\n }\n\n return allMovies;\n }\n\n private getPage(config: CSFDUserRatingConfig, movies: HTMLElement[]) {\n if (config) {\n if (config.includesOnly?.length && config.excludes?.length) {\n console.warn(\n `node-csfd-api:\n You can not use both parameters 'includesOnly' and 'excludes'.\n Parameter 'includesOnly' will be used now:`,\n config.includesOnly\n );\n }\n }\n\n for (const el of movies) {\n const type = getUserRatingType(el);\n\n // Filtering includesOnly\n if (config?.includesOnly?.length) {\n if (config.includesOnly.some((include) => type === include)) {\n this.buildUserRatings(el);\n }\n // Filter exludes\n } else if (config?.excludes?.length) {\n if (!config.excludes.some((exclude) => type === exclude)) {\n this.buildUserRatings(el);\n }\n } else {\n // Without filtering\n this.buildUserRatings(el);\n }\n }\n return this.films;\n }\n\n private buildUserRatings(el: HTMLElement) {\n this.films.push({\n id: getUserRatingId(el),\n title: getUserRatingTitle(el),\n year: getUserRatingYear(el),\n type: getUserRatingType(el),\n url: getUserRatingUrl(el),\n colorRating: getUserRatingColorRating(el) as CSFDColorRating,\n userDate: getUserRatingDate(el),\n userRating: getUserRating(el) as CSFDStars\n });\n }\n}\n"],"mappings":";;;;;;;;AAiBA,IAAa,qBAAb,MAAgC;;eACK,EAAE;;CAErC,MAAa,YACX,MACA,QAC4B;EAC5B,IAAIA,YAA+B,EAAE;EACrC,MAAM,MAAMC,4BAAe,KAAK;EAGhC,MAAM,oCAFW,MAAMC,2BAAU,IAAI,CAER;EAC7B,MAAM,SAAS,MAAM,iBAAiB,6CAA6C;EAGnF,MAAM,YAAY,MAAM,cAAc,cAAc;EACpD,MAAM,QAAQ,CAAC,WAAW,WAAW,UAAU,WAAW,SAAS,GAAG,WAAW;AAEjF,cAAY,KAAK,QAAQ,QAAQ,OAAO;AAExC,MAAI,QAAQ,UAAU;AACpB,WAAQ,IAAI,QAAQ,MAAM,IAAI;AAC9B,WAAQ,IAAI,sBAAsB,MAAM;AACxC,QAAK,IAAI,IAAI,GAAG,KAAK,OAAO,KAAK;AAC/B,YAAQ,IAAI,iBAAiB,GAAG,UAAU,OAAO,MAAM;IAKvD,MAAMC,uCAHW,MAAMD,2BADXD,4BAAe,MAAM,EAAE,CACE,CAER,CACR,iBAAiB,6CAA6C;AACnF,gBAAY,CAAC,GAAG,KAAK,QAAQ,QAAQE,SAAO,CAAC;AAG7C,QAAI,OAAO,cACT,OAAMC,kCAAM,OAAO,cAAc;;AAGrC,UAAO;;AAGT,SAAO;;CAGT,AAAQ,QAAQ,QAA8B,QAAuB;AACnE,MAAI,QACF;OAAI,OAAO,cAAc,UAAU,OAAO,UAAU,OAClD,SAAQ,KACN;;qDAGA,OAAO,aACR;;AAIL,OAAK,MAAM,MAAM,QAAQ;GACvB,MAAM,OAAOC,8CAAkB,GAAG;AAGlC,OAAI,QAAQ,cAAc,QACxB;QAAI,OAAO,aAAa,MAAM,YAAY,SAAS,QAAQ,CACzD,MAAK,iBAAiB,GAAG;cAGlB,QAAQ,UAAU,QAC3B;QAAI,CAAC,OAAO,SAAS,MAAM,YAAY,SAAS,QAAQ,CACtD,MAAK,iBAAiB,GAAG;SAI3B,MAAK,iBAAiB,GAAG;;AAG7B,SAAO,KAAK;;CAGd,AAAQ,iBAAiB,IAAiB;AACxC,OAAK,MAAM,KAAK;GACd,IAAIC,4CAAgB,GAAG;GACvB,OAAOC,+CAAmB,GAAG;GAC7B,MAAMC,8CAAkB,GAAG;GAC3B,MAAMH,8CAAkB,GAAG;GAC3B,KAAKI,6CAAiB,GAAG;GACzB,aAAaC,qDAAyB,GAAG;GACzC,UAAUC,8CAAkB,GAAG;GAC/B,YAAYC,0CAAc,GAAG;GAC9B,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { fetchPage } from "../fetchers/fetchers.mjs";
|
|
2
|
+
import { userRatingsUrl } from "../vars.mjs";
|
|
3
|
+
import { getUserRating, getUserRatingColorRating, getUserRatingDate, getUserRatingId, getUserRatingTitle, getUserRatingType, getUserRatingUrl, getUserRatingYear, sleep } from "../helpers/user-ratings.helper.mjs";
|
|
4
|
+
import { parse } from "node-html-parser";
|
|
5
|
+
|
|
6
|
+
//#region src/services/user-ratings.service.ts
|
|
7
|
+
var UserRatingsScraper = class {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.films = [];
|
|
10
|
+
}
|
|
11
|
+
async userRatings(user, config) {
|
|
12
|
+
let allMovies = [];
|
|
13
|
+
const url = userRatingsUrl(user);
|
|
14
|
+
const items = parse(await fetchPage(url));
|
|
15
|
+
const movies = items.querySelectorAll(".box-user-rating .table-container tbody tr");
|
|
16
|
+
const pagesNode = items.querySelector(".pagination");
|
|
17
|
+
const pages = +pagesNode?.childNodes[pagesNode.childNodes.length - 4].rawText || 1;
|
|
18
|
+
allMovies = this.getPage(config, movies);
|
|
19
|
+
if (config?.allPages) {
|
|
20
|
+
console.log("User", user, url);
|
|
21
|
+
console.log("Fetching all pages", pages);
|
|
22
|
+
for (let i = 2; i <= pages; i++) {
|
|
23
|
+
console.log("Fetching page", i, "out of", pages, "...");
|
|
24
|
+
const movies$1 = parse(await fetchPage(userRatingsUrl(user, i))).querySelectorAll(".box-user-rating .table-container tbody tr");
|
|
25
|
+
allMovies = [...this.getPage(config, movies$1)];
|
|
26
|
+
if (config.allPagesDelay) await sleep(config.allPagesDelay);
|
|
27
|
+
}
|
|
28
|
+
return allMovies;
|
|
29
|
+
}
|
|
30
|
+
return allMovies;
|
|
31
|
+
}
|
|
32
|
+
getPage(config, movies) {
|
|
33
|
+
if (config) {
|
|
34
|
+
if (config.includesOnly?.length && config.excludes?.length) console.warn(`node-csfd-api:
|
|
35
|
+
You can not use both parameters 'includesOnly' and 'excludes'.
|
|
36
|
+
Parameter 'includesOnly' will be used now:`, config.includesOnly);
|
|
37
|
+
}
|
|
38
|
+
for (const el of movies) {
|
|
39
|
+
const type = getUserRatingType(el);
|
|
40
|
+
if (config?.includesOnly?.length) {
|
|
41
|
+
if (config.includesOnly.some((include) => type === include)) this.buildUserRatings(el);
|
|
42
|
+
} else if (config?.excludes?.length) {
|
|
43
|
+
if (!config.excludes.some((exclude) => type === exclude)) this.buildUserRatings(el);
|
|
44
|
+
} else this.buildUserRatings(el);
|
|
45
|
+
}
|
|
46
|
+
return this.films;
|
|
47
|
+
}
|
|
48
|
+
buildUserRatings(el) {
|
|
49
|
+
this.films.push({
|
|
50
|
+
id: getUserRatingId(el),
|
|
51
|
+
title: getUserRatingTitle(el),
|
|
52
|
+
year: getUserRatingYear(el),
|
|
53
|
+
type: getUserRatingType(el),
|
|
54
|
+
url: getUserRatingUrl(el),
|
|
55
|
+
colorRating: getUserRatingColorRating(el),
|
|
56
|
+
userDate: getUserRatingDate(el),
|
|
57
|
+
userRating: getUserRating(el)
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
export { UserRatingsScraper };
|
|
64
|
+
//# sourceMappingURL=user-ratings.service.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-ratings.service.mjs","names":["allMovies: CSFDUserRatings[]","movies"],"sources":["../../src/services/user-ratings.service.ts"],"sourcesContent":["import { HTMLElement, parse } from 'node-html-parser';\nimport { CSFDColorRating, CSFDStars } from '../dto/global';\nimport { CSFDUserRatingConfig, CSFDUserRatings } from '../dto/user-ratings';\nimport { fetchPage } from '../fetchers/fetchers.js';\nimport {\n getUserRating,\n getUserRatingColorRating,\n getUserRatingDate,\n getUserRatingId,\n getUserRatingTitle,\n getUserRatingType,\n getUserRatingUrl,\n getUserRatingYear,\n sleep\n} from '../helpers/user-ratings.helper.js';\nimport { userRatingsUrl } from '../vars.js';\n\nexport class UserRatingsScraper {\n private films: CSFDUserRatings[] = [];\n\n public async userRatings(\n user: string | number,\n config?: CSFDUserRatingConfig\n ): Promise<CSFDUserRatings[]> {\n let allMovies: CSFDUserRatings[] = [];\n const url = userRatingsUrl(user);\n const response = await fetchPage(url);\n\n const items = parse(response);\n const movies = items.querySelectorAll('.box-user-rating .table-container tbody tr');\n\n // Get number of pages\n const pagesNode = items.querySelector('.pagination');\n const pages = +pagesNode?.childNodes[pagesNode.childNodes.length - 4].rawText || 1;\n\n allMovies = this.getPage(config, movies);\n\n if (config?.allPages) {\n console.log('User', user, url);\n console.log('Fetching all pages', pages);\n for (let i = 2; i <= pages; i++) {\n console.log('Fetching page', i, 'out of', pages, '...');\n const url = userRatingsUrl(user, i);\n const response = await fetchPage(url);\n\n const items = parse(response);\n const movies = items.querySelectorAll('.box-user-rating .table-container tbody tr');\n allMovies = [...this.getPage(config, movies)];\n\n // Sleep\n if (config.allPagesDelay) {\n await sleep(config.allPagesDelay);\n }\n }\n return allMovies;\n }\n\n return allMovies;\n }\n\n private getPage(config: CSFDUserRatingConfig, movies: HTMLElement[]) {\n if (config) {\n if (config.includesOnly?.length && config.excludes?.length) {\n console.warn(\n `node-csfd-api:\n You can not use both parameters 'includesOnly' and 'excludes'.\n Parameter 'includesOnly' will be used now:`,\n config.includesOnly\n );\n }\n }\n\n for (const el of movies) {\n const type = getUserRatingType(el);\n\n // Filtering includesOnly\n if (config?.includesOnly?.length) {\n if (config.includesOnly.some((include) => type === include)) {\n this.buildUserRatings(el);\n }\n // Filter exludes\n } else if (config?.excludes?.length) {\n if (!config.excludes.some((exclude) => type === exclude)) {\n this.buildUserRatings(el);\n }\n } else {\n // Without filtering\n this.buildUserRatings(el);\n }\n }\n return this.films;\n }\n\n private buildUserRatings(el: HTMLElement) {\n this.films.push({\n id: getUserRatingId(el),\n title: getUserRatingTitle(el),\n year: getUserRatingYear(el),\n type: getUserRatingType(el),\n url: getUserRatingUrl(el),\n colorRating: getUserRatingColorRating(el) as CSFDColorRating,\n userDate: getUserRatingDate(el),\n userRating: getUserRating(el) as CSFDStars\n });\n }\n}\n"],"mappings":";;;;;;AAiBA,IAAa,qBAAb,MAAgC;;eACK,EAAE;;CAErC,MAAa,YACX,MACA,QAC4B;EAC5B,IAAIA,YAA+B,EAAE;EACrC,MAAM,MAAM,eAAe,KAAK;EAGhC,MAAM,QAAQ,MAFG,MAAM,UAAU,IAAI,CAER;EAC7B,MAAM,SAAS,MAAM,iBAAiB,6CAA6C;EAGnF,MAAM,YAAY,MAAM,cAAc,cAAc;EACpD,MAAM,QAAQ,CAAC,WAAW,WAAW,UAAU,WAAW,SAAS,GAAG,WAAW;AAEjF,cAAY,KAAK,QAAQ,QAAQ,OAAO;AAExC,MAAI,QAAQ,UAAU;AACpB,WAAQ,IAAI,QAAQ,MAAM,IAAI;AAC9B,WAAQ,IAAI,sBAAsB,MAAM;AACxC,QAAK,IAAI,IAAI,GAAG,KAAK,OAAO,KAAK;AAC/B,YAAQ,IAAI,iBAAiB,GAAG,UAAU,OAAO,MAAM;IAKvD,MAAMC,WADQ,MAFG,MAAM,UADX,eAAe,MAAM,EAAE,CACE,CAER,CACR,iBAAiB,6CAA6C;AACnF,gBAAY,CAAC,GAAG,KAAK,QAAQ,QAAQA,SAAO,CAAC;AAG7C,QAAI,OAAO,cACT,OAAM,MAAM,OAAO,cAAc;;AAGrC,UAAO;;AAGT,SAAO;;CAGT,AAAQ,QAAQ,QAA8B,QAAuB;AACnE,MAAI,QACF;OAAI,OAAO,cAAc,UAAU,OAAO,UAAU,OAClD,SAAQ,KACN;;qDAGA,OAAO,aACR;;AAIL,OAAK,MAAM,MAAM,QAAQ;GACvB,MAAM,OAAO,kBAAkB,GAAG;AAGlC,OAAI,QAAQ,cAAc,QACxB;QAAI,OAAO,aAAa,MAAM,YAAY,SAAS,QAAQ,CACzD,MAAK,iBAAiB,GAAG;cAGlB,QAAQ,UAAU,QAC3B;QAAI,CAAC,OAAO,SAAS,MAAM,YAAY,SAAS,QAAQ,CACtD,MAAK,iBAAiB,GAAG;SAI3B,MAAK,iBAAiB,GAAG;;AAG7B,SAAO,KAAK;;CAGd,AAAQ,iBAAiB,IAAiB;AACxC,OAAK,MAAM,KAAK;GACd,IAAI,gBAAgB,GAAG;GACvB,OAAO,mBAAmB,GAAG;GAC7B,MAAM,kBAAkB,GAAG;GAC3B,MAAM,kBAAkB,GAAG;GAC3B,KAAK,iBAAiB,GAAG;GACzB,aAAa,yBAAyB,GAAG;GACzC,UAAU,kBAAkB,GAAG;GAC/B,YAAY,cAAc,GAAG;GAC9B,CAAC"}
|
package/vars.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const userRatingsUrl = (user, page) => `https://www.csfd.cz/uzivatel/${encodeURIComponent(user)}/hodnoceni/${page ? '?page=' + page : ''}`;
|
|
5
|
-
exports.userRatingsUrl = userRatingsUrl;
|
|
1
|
+
|
|
2
|
+
//#region src/vars.ts
|
|
3
|
+
const userRatingsUrl = (user, page) => `https://www.csfd.cz/uzivatel/${encodeURIComponent(user)}/hodnoceni/${page ? "?page=" + page : ""}`;
|
|
6
4
|
const movieUrl = (movie) => `https://www.csfd.cz/film/${encodeURIComponent(movie)}/prehled/`;
|
|
7
|
-
exports.movieUrl = movieUrl;
|
|
8
5
|
const creatorUrl = (creator) => `https://www.csfd.cz/tvurce/${encodeURIComponent(creator)}`;
|
|
9
|
-
exports.creatorUrl = creatorUrl;
|
|
10
6
|
const cinemasUrl = (district, period) => {
|
|
11
|
-
|
|
7
|
+
return `https://www.csfd.cz/kino/?period=${period}&district=${district}`;
|
|
12
8
|
};
|
|
13
|
-
exports.cinemasUrl = cinemasUrl;
|
|
14
9
|
const searchUrl = (text) => `https://www.csfd.cz/hledat/?q=${encodeURIComponent(text)}`;
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
exports.cinemasUrl = cinemasUrl;
|
|
13
|
+
exports.creatorUrl = creatorUrl;
|
|
14
|
+
exports.movieUrl = movieUrl;
|
|
15
15
|
exports.searchUrl = searchUrl;
|
|
16
|
+
exports.userRatingsUrl = userRatingsUrl;
|
|
17
|
+
//# sourceMappingURL=vars.js.map
|
package/vars.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vars.js","names":[],"sources":["../src/vars.ts"],"sourcesContent":["import { CSFDCinemaPeriod } from './dto/cinema';\n\nexport const userRatingsUrl = (user: string | number, page?: number): string =>\n `https://www.csfd.cz/uzivatel/${encodeURIComponent(user)}/hodnoceni/${page ? '?page=' + page : ''\n }`;\n\nexport const movieUrl = (movie: number): string =>\n `https://www.csfd.cz/film/${encodeURIComponent(movie)}/prehled/`;\n\nexport const creatorUrl = (creator: number | string): string =>\n `https://www.csfd.cz/tvurce/${encodeURIComponent(creator)}`;\n\nexport const cinemasUrl = (district: number | string, period: CSFDCinemaPeriod): string => {\n return `https://www.csfd.cz/kino/?period=${period}&district=${district}`;\n};\n\nexport const searchUrl = (text: string): string =>\n `https://www.csfd.cz/hledat/?q=${encodeURIComponent(text)}`;\n"],"mappings":";;AAEA,MAAa,kBAAkB,MAAuB,SACpD,gCAAgC,mBAAmB,KAAK,CAAC,aAAa,OAAO,WAAW,OAAO;AAGjG,MAAa,YAAY,UACvB,4BAA4B,mBAAmB,MAAM,CAAC;AAExD,MAAa,cAAc,YACzB,8BAA8B,mBAAmB,QAAQ;AAE3D,MAAa,cAAc,UAA2B,WAAqC;AACzF,QAAO,oCAAoC,OAAO,YAAY;;AAGhE,MAAa,aAAa,SACxB,iCAAiC,mBAAmB,KAAK"}
|
package/vars.mjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/vars.ts
|
|
2
|
+
const userRatingsUrl = (user, page) => `https://www.csfd.cz/uzivatel/${encodeURIComponent(user)}/hodnoceni/${page ? "?page=" + page : ""}`;
|
|
3
|
+
const movieUrl = (movie) => `https://www.csfd.cz/film/${encodeURIComponent(movie)}/prehled/`;
|
|
4
|
+
const creatorUrl = (creator) => `https://www.csfd.cz/tvurce/${encodeURIComponent(creator)}`;
|
|
5
|
+
const cinemasUrl = (district, period) => {
|
|
6
|
+
return `https://www.csfd.cz/kino/?period=${period}&district=${district}`;
|
|
7
|
+
};
|
|
8
|
+
const searchUrl = (text) => `https://www.csfd.cz/hledat/?q=${encodeURIComponent(text)}`;
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { cinemasUrl, creatorUrl, movieUrl, searchUrl, userRatingsUrl };
|
|
12
|
+
//# sourceMappingURL=vars.mjs.map
|
package/vars.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vars.mjs","names":[],"sources":["../src/vars.ts"],"sourcesContent":["import { CSFDCinemaPeriod } from './dto/cinema';\n\nexport const userRatingsUrl = (user: string | number, page?: number): string =>\n `https://www.csfd.cz/uzivatel/${encodeURIComponent(user)}/hodnoceni/${page ? '?page=' + page : ''\n }`;\n\nexport const movieUrl = (movie: number): string =>\n `https://www.csfd.cz/film/${encodeURIComponent(movie)}/prehled/`;\n\nexport const creatorUrl = (creator: number | string): string =>\n `https://www.csfd.cz/tvurce/${encodeURIComponent(creator)}`;\n\nexport const cinemasUrl = (district: number | string, period: CSFDCinemaPeriod): string => {\n return `https://www.csfd.cz/kino/?period=${period}&district=${district}`;\n};\n\nexport const searchUrl = (text: string): string =>\n `https://www.csfd.cz/hledat/?q=${encodeURIComponent(text)}`;\n"],"mappings":";AAEA,MAAa,kBAAkB,MAAuB,SACpD,gCAAgC,mBAAmB,KAAK,CAAC,aAAa,OAAO,WAAW,OAAO;AAGjG,MAAa,YAAY,UACvB,4BAA4B,mBAAmB,MAAM,CAAC;AAExD,MAAa,cAAc,YACzB,8BAA8B,mBAAmB,QAAQ;AAE3D,MAAa,cAAc,UAA2B,WAAqC;AACzF,QAAO,oCAAoC,OAAO,YAAY;;AAGhE,MAAa,aAAa,SACxB,iCAAiC,mBAAmB,KAAK"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const fetchSafe: typeof fetch;
|
package/fetchers/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const fetchPage: (url: string) => Promise<string>;
|
package/fetchers/index.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchPage = void 0;
|
|
4
|
-
const fetch_polyfill_1 = require("./fetch.polyfill");
|
|
5
|
-
const USER_AGENTS = [
|
|
6
|
-
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36',
|
|
7
|
-
'Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/87.0.4280.77 Mobile/15E148 Safari/604.1',
|
|
8
|
-
'Mozilla/5.0 (Linux; Android 10; SM-A205U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.101 Mobile Safari/537.36',
|
|
9
|
-
'Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.101 Mobile Safari/537.36'
|
|
10
|
-
];
|
|
11
|
-
const headers = {
|
|
12
|
-
'User-Agent': USER_AGENTS[Math.floor(Math.random() * USER_AGENTS.length)]
|
|
13
|
-
};
|
|
14
|
-
const fetchPage = async (url) => {
|
|
15
|
-
try {
|
|
16
|
-
const response = await (0, fetch_polyfill_1.fetchSafe)(url, { headers });
|
|
17
|
-
if (response.status >= 400 && response.status < 600) {
|
|
18
|
-
throw new Error(`node-csfd-api: Bad response ${response.status} for url: ${url}`);
|
|
19
|
-
}
|
|
20
|
-
return await response.text();
|
|
21
|
-
}
|
|
22
|
-
catch (e) {
|
|
23
|
-
console.error(e);
|
|
24
|
-
return 'Error';
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
exports.fetchPage = fetchPage;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { HTMLElement } from 'node-html-parser';
|
|
2
|
-
import { CSFDColorRating } from '../interfaces/global';
|
|
3
|
-
import { CSFDCinemaGroupedFilmsByDate, CSFDCinemaMeta, CSFDCinemaMovie } from './../interfaces/cinema.interface';
|
|
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,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>;
|
|
@@ -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'>;
|
package/interfaces/global.d.ts
DELETED
|
@@ -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';
|
package/interfaces/global.js
DELETED
|
@@ -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' | 'YouTube Movies' | 'prima+' | 'Lepší.TV' | 'Blu-ray' | '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
|
-
}
|