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
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseMeta = exports.
|
|
3
|
+
exports.parseMeta = exports.getCinemaFilms = exports.getGroupedFilmsByDate = exports.parseCinema = exports.getCinemaUrl = exports.getCinemaCoords = exports.getCinemaUrlId = exports.getCinemaId = exports.getCinemaColorRating = void 0;
|
|
4
4
|
const global_helper_1 = require("./global.helper");
|
|
5
|
-
const
|
|
5
|
+
const getCinemaColorRating = (el) => {
|
|
6
6
|
return (0, global_helper_1.parseColor)(el === null || el === void 0 ? void 0 : el.classNames.split(' ').pop());
|
|
7
7
|
};
|
|
8
|
-
exports.
|
|
8
|
+
exports.getCinemaColorRating = getCinemaColorRating;
|
|
9
9
|
const getCinemaId = (el) => {
|
|
10
10
|
var _a;
|
|
11
11
|
const id = (_a = el === null || el === void 0 ? void 0 : el.id) === null || _a === void 0 ? void 0 : _a.split('-')[1];
|
|
12
12
|
return +id;
|
|
13
13
|
};
|
|
14
14
|
exports.getCinemaId = getCinemaId;
|
|
15
|
-
const
|
|
15
|
+
const getCinemaUrlId = (url) => {
|
|
16
16
|
if (url) {
|
|
17
17
|
return (0, global_helper_1.parseIdFromUrl)(url);
|
|
18
18
|
}
|
|
19
19
|
return null;
|
|
20
20
|
};
|
|
21
|
-
exports.
|
|
22
|
-
const
|
|
21
|
+
exports.getCinemaUrlId = getCinemaUrlId;
|
|
22
|
+
const getCinemaCoords = (el) => {
|
|
23
23
|
if (!el)
|
|
24
24
|
return null;
|
|
25
25
|
const linkMapsEl = el.querySelector('a[href*="q="]');
|
|
@@ -37,7 +37,7 @@ const getCoords = (el) => {
|
|
|
37
37
|
}
|
|
38
38
|
return null;
|
|
39
39
|
};
|
|
40
|
-
exports.
|
|
40
|
+
exports.getCinemaCoords = getCinemaCoords;
|
|
41
41
|
const getCinemaUrl = (el) => {
|
|
42
42
|
var _a, _b;
|
|
43
43
|
if (!el)
|
|
@@ -60,19 +60,19 @@ const getGroupedFilmsByDate = (el) => {
|
|
|
60
60
|
var _a, _b, _c;
|
|
61
61
|
const [date, films] = divs.slice(index, index + 2);
|
|
62
62
|
const dateText = (_c = (_b = (_a = date === null || date === void 0 ? void 0 : date.firstChild) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : null;
|
|
63
|
-
return { date: dateText, films: (0, exports.
|
|
63
|
+
return { date: dateText, films: (0, exports.getCinemaFilms)('', films) };
|
|
64
64
|
});
|
|
65
65
|
return getDatesAndFilms;
|
|
66
66
|
};
|
|
67
67
|
exports.getGroupedFilmsByDate = getGroupedFilmsByDate;
|
|
68
|
-
const
|
|
68
|
+
const getCinemaFilms = (date, el) => {
|
|
69
69
|
const filmNodes = el.querySelectorAll('.cinema-table tr');
|
|
70
70
|
const films = filmNodes.map((filmNode) => {
|
|
71
71
|
var _a, _b, _c, _d;
|
|
72
72
|
const url = (_a = filmNode.querySelector('td.name h3 a')) === null || _a === void 0 ? void 0 : _a.attributes.href;
|
|
73
|
-
const id = (0, exports.
|
|
73
|
+
const id = (0, exports.getCinemaUrlId)(url);
|
|
74
74
|
const title = (_b = filmNode.querySelector('.name h3')) === null || _b === void 0 ? void 0 : _b.text.trim();
|
|
75
|
-
const colorRating = (0, exports.
|
|
75
|
+
const colorRating = (0, exports.getCinemaColorRating)(filmNode.querySelector('.name .icon'));
|
|
76
76
|
const showTimes = (_c = filmNode.querySelectorAll('.td-time')) === null || _c === void 0 ? void 0 : _c.map((x) => x.textContent.trim());
|
|
77
77
|
const meta = (_d = filmNode.querySelectorAll('.td-title span')) === null || _d === void 0 ? void 0 : _d.map((x) => x.text.trim());
|
|
78
78
|
return {
|
|
@@ -86,7 +86,7 @@ const getFilms = (date, el) => {
|
|
|
86
86
|
});
|
|
87
87
|
return films;
|
|
88
88
|
};
|
|
89
|
-
exports.
|
|
89
|
+
exports.getCinemaFilms = getCinemaFilms;
|
|
90
90
|
const parseMeta = (meta) => {
|
|
91
91
|
const metaConvert = [];
|
|
92
92
|
for (const element of meta) {
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getCreatorFilms = exports.getCreatorPhoto = exports.getCreatorBio = exports.getCreatorBirthdayInfo = exports.getCreatorName = exports.getCreatorId = void 0;
|
|
4
4
|
const global_helper_1 = require("./global.helper");
|
|
5
|
-
const
|
|
5
|
+
const getCreatorColorRating = (el) => {
|
|
6
6
|
return (0, global_helper_1.parseColor)(el === null || el === void 0 ? void 0 : el.classNames.split(' ').pop());
|
|
7
7
|
};
|
|
8
|
-
|
|
9
|
-
const getId = (url) => {
|
|
8
|
+
const getCreatorId = (url) => {
|
|
10
9
|
if (url) {
|
|
11
10
|
return (0, global_helper_1.parseIdFromUrl)(url);
|
|
12
11
|
}
|
|
13
12
|
return null;
|
|
14
13
|
};
|
|
15
|
-
exports.
|
|
16
|
-
const
|
|
14
|
+
exports.getCreatorId = getCreatorId;
|
|
15
|
+
const getCreatorName = (el) => {
|
|
17
16
|
return el.querySelector('h1').innerText.trim();
|
|
18
17
|
};
|
|
19
|
-
exports.
|
|
20
|
-
const
|
|
18
|
+
exports.getCreatorName = getCreatorName;
|
|
19
|
+
const getCreatorBirthdayInfo = (el) => {
|
|
21
20
|
var _a, _b;
|
|
22
21
|
const infoBlock = el.querySelector('h1 + p');
|
|
23
22
|
const text = infoBlock === null || infoBlock === void 0 ? void 0 : infoBlock.innerHTML.trim();
|
|
@@ -27,45 +26,42 @@ const getBirthdayInfo = (el) => {
|
|
|
27
26
|
if (text) {
|
|
28
27
|
const parts = text.split('\n');
|
|
29
28
|
const birthdayRow = parts.find((x) => x.includes('nar.'));
|
|
30
|
-
birthday = birthdayRow ?
|
|
29
|
+
birthday = birthdayRow ? parseBirthday(birthdayRow) : '';
|
|
31
30
|
}
|
|
32
|
-
const age = ageRow ? +
|
|
33
|
-
const birthPlace = birthPlaceRow ?
|
|
31
|
+
const age = ageRow ? +parseAge(ageRow) : null;
|
|
32
|
+
const birthPlace = birthPlaceRow ? parseBirthPlace(birthPlaceRow) : '';
|
|
34
33
|
return { birthday, age, birthPlace };
|
|
35
34
|
};
|
|
36
|
-
exports.
|
|
37
|
-
const
|
|
35
|
+
exports.getCreatorBirthdayInfo = getCreatorBirthdayInfo;
|
|
36
|
+
const getCreatorBio = (el) => {
|
|
38
37
|
var _a;
|
|
39
38
|
return ((_a = el.querySelector('.article-content p')) === null || _a === void 0 ? void 0 : _a.text.trim().split('\n')[0].trim()) || null;
|
|
40
39
|
};
|
|
41
|
-
exports.
|
|
42
|
-
const
|
|
40
|
+
exports.getCreatorBio = getCreatorBio;
|
|
41
|
+
const getCreatorPhoto = (el) => {
|
|
43
42
|
const image = el.querySelector('img').attributes.src;
|
|
44
43
|
return (0, global_helper_1.addProtocol)(image);
|
|
45
44
|
};
|
|
46
|
-
exports.
|
|
45
|
+
exports.getCreatorPhoto = getCreatorPhoto;
|
|
47
46
|
const parseBirthday = (text) => {
|
|
48
47
|
return text.replace(/nar./g, '').trim();
|
|
49
48
|
};
|
|
50
|
-
exports.parseBirthday = parseBirthday;
|
|
51
49
|
const parseAge = (text) => {
|
|
52
50
|
return text.trim().replace(/\(/g, '').replace(/let\)/g, '').trim();
|
|
53
51
|
};
|
|
54
|
-
exports.parseAge = parseAge;
|
|
55
52
|
const parseBirthPlace = (text) => {
|
|
56
53
|
return text.trim().replace(/<br>/g, '').trim();
|
|
57
54
|
};
|
|
58
|
-
|
|
59
|
-
const getFilms = (el) => {
|
|
55
|
+
const getCreatorFilms = (el) => {
|
|
60
56
|
var _a;
|
|
61
57
|
const filmNodes = (_a = el.querySelectorAll('.box')[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll('table tr');
|
|
62
58
|
let yearCache;
|
|
63
59
|
const films = filmNodes.map((filmNode) => {
|
|
64
60
|
var _a, _b, _c;
|
|
65
|
-
const id = (0, exports.
|
|
61
|
+
const id = (0, exports.getCreatorId)((_a = filmNode.querySelector('td.name .film-title-name')) === null || _a === void 0 ? void 0 : _a.attributes.href);
|
|
66
62
|
const title = (_b = filmNode.querySelector('.name')) === null || _b === void 0 ? void 0 : _b.text.trim();
|
|
67
63
|
const year = +((_c = filmNode.querySelector('.year')) === null || _c === void 0 ? void 0 : _c.text.trim());
|
|
68
|
-
const colorRating = (
|
|
64
|
+
const colorRating = getCreatorColorRating(filmNode.querySelector('.name .icon'));
|
|
69
65
|
// Cache year from previous film because there is a gap between movies with same year
|
|
70
66
|
if (year) {
|
|
71
67
|
yearCache = +year;
|
|
@@ -84,4 +80,4 @@ const getFilms = (el) => {
|
|
|
84
80
|
const filmsUnique = films.filter((value) => Object.keys(value).length !== 0);
|
|
85
81
|
return filmsUnique;
|
|
86
82
|
};
|
|
87
|
-
exports.
|
|
83
|
+
exports.getCreatorFilms = getCreatorFilms;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getMovieTags = exports.getMoviePremieres = exports.getMovieBoxMovies = exports.getMovieVods = exports.getMovieType = exports.getMovieGroup = exports.getMovieDescriptions = exports.getMovieTrivia = exports.getMovieRandomPhoto = exports.getMoviePoster = exports.getMovieTitlesOther = exports.getMovieDuration = exports.getMovieYear = exports.getMovieRatingCount = exports.getMovieRating = exports.getMovieColorRating = exports.getMovieOrigins = exports.getMovieGenres = exports.getMovieTitle = exports.getMovieId = void 0;
|
|
4
4
|
const global_helper_1 = require("./global.helper");
|
|
5
|
-
const
|
|
5
|
+
const getMovieId = (el) => {
|
|
6
6
|
const url = el.querySelector('.tabs .tab-nav-list a').attributes.href;
|
|
7
7
|
return (0, global_helper_1.parseIdFromUrl)(url);
|
|
8
8
|
};
|
|
9
|
-
exports.
|
|
10
|
-
const
|
|
9
|
+
exports.getMovieId = getMovieId;
|
|
10
|
+
const getMovieTitle = (el) => {
|
|
11
11
|
return el.querySelector('h1').innerText.split(`(`)[0].trim();
|
|
12
12
|
};
|
|
13
|
-
exports.
|
|
14
|
-
const
|
|
13
|
+
exports.getMovieTitle = getMovieTitle;
|
|
14
|
+
const getMovieGenres = (el) => {
|
|
15
15
|
const genresRaw = el.querySelector('.genres').textContent;
|
|
16
16
|
return genresRaw.split(' / ');
|
|
17
17
|
};
|
|
18
|
-
exports.
|
|
19
|
-
const
|
|
18
|
+
exports.getMovieGenres = getMovieGenres;
|
|
19
|
+
const getMovieOrigins = (el) => {
|
|
20
20
|
const originsRaw = el.querySelector('.origin').textContent;
|
|
21
21
|
const origins = originsRaw.split(',')[0];
|
|
22
22
|
return origins.split(' / ');
|
|
23
23
|
};
|
|
24
|
-
exports.
|
|
25
|
-
const
|
|
24
|
+
exports.getMovieOrigins = getMovieOrigins;
|
|
25
|
+
const getMovieColorRating = (bodyClasses) => {
|
|
26
26
|
return (0, global_helper_1.getColor)(bodyClasses[1]);
|
|
27
27
|
};
|
|
28
|
-
exports.
|
|
29
|
-
const
|
|
28
|
+
exports.getMovieColorRating = getMovieColorRating;
|
|
29
|
+
const getMovieRating = (el) => {
|
|
30
30
|
const ratingRaw = el.querySelector('.film-rating-average').textContent;
|
|
31
31
|
const rating = ratingRaw === null || ratingRaw === void 0 ? void 0 : ratingRaw.replace(/%/g, '').trim();
|
|
32
32
|
const ratingInt = parseInt(rating);
|
|
@@ -37,8 +37,8 @@ const getRating = (el) => {
|
|
|
37
37
|
return null;
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
-
exports.
|
|
41
|
-
const
|
|
40
|
+
exports.getMovieRating = getMovieRating;
|
|
41
|
+
const getMovieRatingCount = (el) => {
|
|
42
42
|
var _a;
|
|
43
43
|
const ratingCountRaw = (_a = el.querySelector('.box-rating-container .counter')) === null || _a === void 0 ? void 0 : _a.textContent;
|
|
44
44
|
const ratingCount = +(ratingCountRaw === null || ratingCountRaw === void 0 ? void 0 : ratingCountRaw.replace(/[(\s)]/g, ''));
|
|
@@ -49,8 +49,8 @@ const getRatingCount = (el) => {
|
|
|
49
49
|
return null;
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
exports.
|
|
53
|
-
const
|
|
52
|
+
exports.getMovieRatingCount = getMovieRatingCount;
|
|
53
|
+
const getMovieYear = (el) => {
|
|
54
54
|
try {
|
|
55
55
|
const jsonLd = JSON.parse(el);
|
|
56
56
|
return +jsonLd.dateCreated;
|
|
@@ -60,8 +60,8 @@ const getYear = (el) => {
|
|
|
60
60
|
return null;
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
|
-
exports.
|
|
64
|
-
const
|
|
63
|
+
exports.getMovieYear = getMovieYear;
|
|
64
|
+
const getMovieDuration = (jsonLdRaw, el) => {
|
|
65
65
|
let duration = null;
|
|
66
66
|
try {
|
|
67
67
|
const jsonLd = JSON.parse(jsonLdRaw);
|
|
@@ -88,8 +88,8 @@ const getDuration = (jsonLdRaw, el) => {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
|
-
exports.
|
|
92
|
-
const
|
|
91
|
+
exports.getMovieDuration = getMovieDuration;
|
|
92
|
+
const getMovieTitlesOther = (el) => {
|
|
93
93
|
const namesNode = el.querySelectorAll('.film-names li');
|
|
94
94
|
if (!namesNode.length) {
|
|
95
95
|
return [];
|
|
@@ -109,8 +109,8 @@ const getTitlesOther = (el) => {
|
|
|
109
109
|
});
|
|
110
110
|
return titlesOther.filter((x) => x);
|
|
111
111
|
};
|
|
112
|
-
exports.
|
|
113
|
-
const
|
|
112
|
+
exports.getMovieTitlesOther = getMovieTitlesOther;
|
|
113
|
+
const getMoviePoster = (el) => {
|
|
114
114
|
var _a;
|
|
115
115
|
const poster = el.querySelector('.film-posters img');
|
|
116
116
|
// Resolve empty image
|
|
@@ -129,8 +129,8 @@ const getPoster = (el) => {
|
|
|
129
129
|
return null;
|
|
130
130
|
}
|
|
131
131
|
};
|
|
132
|
-
exports.
|
|
133
|
-
const
|
|
132
|
+
exports.getMoviePoster = getMoviePoster;
|
|
133
|
+
const getMovieRandomPhoto = (el) => {
|
|
134
134
|
var _a;
|
|
135
135
|
const imageNode = el.querySelector('.gallery-item picture img');
|
|
136
136
|
const image = (_a = imageNode === null || imageNode === void 0 ? void 0 : imageNode.attributes) === null || _a === void 0 ? void 0 : _a.src;
|
|
@@ -141,8 +141,8 @@ const getRandomPhoto = (el) => {
|
|
|
141
141
|
return null;
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
|
-
exports.
|
|
145
|
-
const
|
|
144
|
+
exports.getMovieRandomPhoto = getMovieRandomPhoto;
|
|
145
|
+
const getMovieTrivia = (el) => {
|
|
146
146
|
const triviaNodes = el.querySelectorAll('.article-trivia ul li');
|
|
147
147
|
if (triviaNodes === null || triviaNodes === void 0 ? void 0 : triviaNodes.length) {
|
|
148
148
|
return triviaNodes.map((node) => node.textContent.trim().replace(/(\r\n|\n|\r|\t)/gm, ''));
|
|
@@ -151,14 +151,14 @@ const getTrivia = (el) => {
|
|
|
151
151
|
return null;
|
|
152
152
|
}
|
|
153
153
|
};
|
|
154
|
-
exports.
|
|
155
|
-
const
|
|
154
|
+
exports.getMovieTrivia = getMovieTrivia;
|
|
155
|
+
const getMovieDescriptions = (el) => {
|
|
156
156
|
return el
|
|
157
157
|
.querySelectorAll('.body--plots .plot-full p, .body--plots .plots .plots-item p')
|
|
158
158
|
.map((movie) => { var _a; return (_a = movie.textContent) === null || _a === void 0 ? void 0 : _a.trim().replace(/(\r\n|\n|\r|\t)/gm, ''); });
|
|
159
159
|
};
|
|
160
|
-
exports.
|
|
161
|
-
const
|
|
160
|
+
exports.getMovieDescriptions = getMovieDescriptions;
|
|
161
|
+
const parseMoviePeople = (el) => {
|
|
162
162
|
const people = el.querySelectorAll('a');
|
|
163
163
|
return (people
|
|
164
164
|
// Filter out "more" links
|
|
@@ -171,25 +171,24 @@ const parsePeople = (el) => {
|
|
|
171
171
|
};
|
|
172
172
|
}));
|
|
173
173
|
};
|
|
174
|
-
|
|
175
|
-
const getGroup = (el, group) => {
|
|
174
|
+
const getMovieGroup = (el, group) => {
|
|
176
175
|
const creators = el.querySelectorAll('.creators h4');
|
|
177
176
|
const element = creators.filter((elem) => elem.textContent.trim().includes(group))[0];
|
|
178
177
|
if (element === null || element === void 0 ? void 0 : element.parentNode) {
|
|
179
|
-
return (
|
|
178
|
+
return parseMoviePeople(element.parentNode);
|
|
180
179
|
}
|
|
181
180
|
else {
|
|
182
181
|
return [];
|
|
183
182
|
}
|
|
184
183
|
};
|
|
185
|
-
exports.
|
|
186
|
-
const
|
|
184
|
+
exports.getMovieGroup = getMovieGroup;
|
|
185
|
+
const getMovieType = (el) => {
|
|
187
186
|
var _a;
|
|
188
187
|
const type = el.querySelector('.film-header-name .type');
|
|
189
188
|
return ((_a = type === null || type === void 0 ? void 0 : type.innerText) === null || _a === void 0 ? void 0 : _a.replace(/[{()}]/g, '')) || 'film';
|
|
190
189
|
};
|
|
191
|
-
exports.
|
|
192
|
-
const
|
|
190
|
+
exports.getMovieType = getMovieType;
|
|
191
|
+
const getMovieVods = (el) => {
|
|
193
192
|
let vods = [];
|
|
194
193
|
if (el) {
|
|
195
194
|
const buttons = el.querySelectorAll('.box-buttons .button');
|
|
@@ -203,17 +202,16 @@ const getVods = (el) => {
|
|
|
203
202
|
}
|
|
204
203
|
return vods.length ? vods : [];
|
|
205
204
|
};
|
|
206
|
-
exports.
|
|
205
|
+
exports.getMovieVods = getMovieVods;
|
|
207
206
|
// Get box content
|
|
208
207
|
const getBoxContent = (el, box) => {
|
|
209
208
|
var _a;
|
|
210
209
|
const headers = el.querySelectorAll('section.box .box-header');
|
|
211
210
|
return (_a = headers.find((header) => header.querySelector('h3').textContent.trim().includes(box))) === null || _a === void 0 ? void 0 : _a.parentNode;
|
|
212
211
|
};
|
|
213
|
-
|
|
214
|
-
const getBoxMovies = (el, boxName) => {
|
|
212
|
+
const getMovieBoxMovies = (el, boxName) => {
|
|
215
213
|
const movieListItem = [];
|
|
216
|
-
const box =
|
|
214
|
+
const box = getBoxContent(el, boxName);
|
|
217
215
|
const movieTitleNodes = box === null || box === void 0 ? void 0 : box.querySelectorAll('.article-header .film-title-name');
|
|
218
216
|
if (movieTitleNodes === null || movieTitleNodes === void 0 ? void 0 : movieTitleNodes.length) {
|
|
219
217
|
for (const item of movieTitleNodes) {
|
|
@@ -226,8 +224,8 @@ const getBoxMovies = (el, boxName) => {
|
|
|
226
224
|
}
|
|
227
225
|
return movieListItem;
|
|
228
226
|
};
|
|
229
|
-
exports.
|
|
230
|
-
const
|
|
227
|
+
exports.getMovieBoxMovies = getMovieBoxMovies;
|
|
228
|
+
const getMoviePremieres = (el) => {
|
|
231
229
|
var _a, _b;
|
|
232
230
|
const premiereNodes = el.querySelectorAll('.box-premieres li');
|
|
233
231
|
const premiere = [];
|
|
@@ -245,9 +243,9 @@ const getPremieres = (el) => {
|
|
|
245
243
|
}
|
|
246
244
|
return premiere;
|
|
247
245
|
};
|
|
248
|
-
exports.
|
|
249
|
-
const
|
|
246
|
+
exports.getMoviePremieres = getMoviePremieres;
|
|
247
|
+
const getMovieTags = (el) => {
|
|
250
248
|
const tagsRaw = el.querySelectorAll('.box-content a[href*="/podrobne-vyhledavani/?tag="]');
|
|
251
249
|
return tagsRaw.map((tag) => tag.textContent);
|
|
252
250
|
};
|
|
253
|
-
exports.
|
|
251
|
+
exports.getMovieTags = getMovieTags;
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.parseSearchPeople = exports.getSearchOrigins = exports.getSearchPoster = exports.getSearchColorRating = exports.getSearchUrl = exports.getSearchYear = exports.getSearchTitle = exports.getSearchType = void 0;
|
|
4
4
|
const global_helper_1 = require("./global.helper");
|
|
5
|
-
const
|
|
5
|
+
const getSearchType = (el) => {
|
|
6
6
|
const type = el.querySelectorAll('.film-title-info .info')[1];
|
|
7
7
|
return ((type === null || type === void 0 ? void 0 : type.innerText.replace(/[{()}]/g, '')) || 'film');
|
|
8
8
|
};
|
|
9
|
-
exports.
|
|
10
|
-
const
|
|
9
|
+
exports.getSearchType = getSearchType;
|
|
10
|
+
const getSearchTitle = (el) => {
|
|
11
11
|
return el.querySelector('.film-title-name').text;
|
|
12
12
|
};
|
|
13
|
-
exports.
|
|
14
|
-
const
|
|
13
|
+
exports.getSearchTitle = getSearchTitle;
|
|
14
|
+
const getSearchYear = (el) => {
|
|
15
15
|
var _a;
|
|
16
16
|
return +((_a = el.querySelectorAll('.film-title-info .info')[0]) === null || _a === void 0 ? void 0 : _a.innerText.replace(/[{()}]/g, ''));
|
|
17
17
|
};
|
|
18
|
-
exports.
|
|
19
|
-
const
|
|
18
|
+
exports.getSearchYear = getSearchYear;
|
|
19
|
+
const getSearchUrl = (el) => {
|
|
20
20
|
return el.querySelector('.film-title-name').attributes.href;
|
|
21
21
|
};
|
|
22
|
-
exports.
|
|
23
|
-
const
|
|
22
|
+
exports.getSearchUrl = getSearchUrl;
|
|
23
|
+
const getSearchColorRating = (el) => {
|
|
24
24
|
return (0, global_helper_1.parseColor)(el.querySelector('.article-header i.icon').classNames.split(' ').pop());
|
|
25
25
|
};
|
|
26
|
-
exports.
|
|
27
|
-
const
|
|
26
|
+
exports.getSearchColorRating = getSearchColorRating;
|
|
27
|
+
const getSearchPoster = (el) => {
|
|
28
28
|
const image = el.querySelector('img').attributes.src;
|
|
29
29
|
return (0, global_helper_1.addProtocol)(image);
|
|
30
30
|
};
|
|
31
|
-
exports.
|
|
32
|
-
const
|
|
31
|
+
exports.getSearchPoster = getSearchPoster;
|
|
32
|
+
const getSearchOrigins = (el) => {
|
|
33
33
|
var _a, _b;
|
|
34
34
|
const originsRaw = (_a = el.querySelector('.article-content p .info')) === null || _a === void 0 ? void 0 : _a.text;
|
|
35
35
|
if (!originsRaw)
|
|
@@ -37,8 +37,8 @@ const getOrigins = (el) => {
|
|
|
37
37
|
const originsAll = (_b = originsRaw === null || originsRaw === void 0 ? void 0 : originsRaw.split(', ')) === null || _b === void 0 ? void 0 : _b[0];
|
|
38
38
|
return originsAll === null || originsAll === void 0 ? void 0 : originsAll.split('/').map((country) => country.trim());
|
|
39
39
|
};
|
|
40
|
-
exports.
|
|
41
|
-
const
|
|
40
|
+
exports.getSearchOrigins = getSearchOrigins;
|
|
41
|
+
const parseSearchPeople = (el, type) => {
|
|
42
42
|
let who;
|
|
43
43
|
if (type === 'directors')
|
|
44
44
|
who = 'Režie:';
|
|
@@ -59,4 +59,4 @@ const parsePeople = (el, type) => {
|
|
|
59
59
|
return [];
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
|
-
exports.
|
|
62
|
+
exports.parseSearchPeople = parseSearchPeople;
|
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sleep = exports.
|
|
3
|
+
exports.sleep = exports.getUserRatingUrl = exports.getUserRatingDate = exports.getUserRatingColorRating = exports.getUserRatingYear = exports.getUserRatingTitle = exports.getUserRatingType = exports.getUserRating = exports.getUserRatingId = void 0;
|
|
4
4
|
const global_helper_1 = require("./global.helper");
|
|
5
|
-
const
|
|
5
|
+
const getUserRatingId = (el) => {
|
|
6
6
|
const url = el.querySelector('td.name .film-title-name').attributes.href;
|
|
7
7
|
return (0, global_helper_1.parseIdFromUrl)(url);
|
|
8
8
|
};
|
|
9
|
-
exports.
|
|
9
|
+
exports.getUserRatingId = getUserRatingId;
|
|
10
10
|
const getUserRating = (el) => {
|
|
11
11
|
const ratingText = el.querySelector('td.star-rating-only .stars').classNames.split(' ').pop();
|
|
12
12
|
const rating = ratingText.includes('stars-') ? +ratingText.split('-').pop() : 0;
|
|
13
13
|
return rating;
|
|
14
14
|
};
|
|
15
15
|
exports.getUserRating = getUserRating;
|
|
16
|
-
const
|
|
16
|
+
const getUserRatingType = (el) => {
|
|
17
17
|
const typeText = el.querySelectorAll('td.name .film-title-info .info');
|
|
18
18
|
return (typeText.length > 1 ? typeText[1].text.slice(1, -1) : 'film');
|
|
19
19
|
};
|
|
20
|
-
exports.
|
|
21
|
-
const
|
|
20
|
+
exports.getUserRatingType = getUserRatingType;
|
|
21
|
+
const getUserRatingTitle = (el) => {
|
|
22
22
|
return el.querySelector('td.name .film-title-name').text;
|
|
23
23
|
};
|
|
24
|
-
exports.
|
|
25
|
-
const
|
|
24
|
+
exports.getUserRatingTitle = getUserRatingTitle;
|
|
25
|
+
const getUserRatingYear = (el) => {
|
|
26
26
|
var _a;
|
|
27
27
|
return +((_a = el.querySelectorAll('td.name .film-title-info .info')[0]) === null || _a === void 0 ? void 0 : _a.text.slice(1, -1)) || null;
|
|
28
28
|
};
|
|
29
|
-
exports.
|
|
30
|
-
const
|
|
31
|
-
const color =
|
|
29
|
+
exports.getUserRatingYear = getUserRatingYear;
|
|
30
|
+
const getUserRatingColorRating = (el) => {
|
|
31
|
+
const color = parseColor(el.querySelector('td.name .icon').classNames.split(' ').pop());
|
|
32
32
|
return color;
|
|
33
33
|
};
|
|
34
|
-
exports.
|
|
35
|
-
const
|
|
34
|
+
exports.getUserRatingColorRating = getUserRatingColorRating;
|
|
35
|
+
const getUserRatingDate = (el) => {
|
|
36
36
|
return el.querySelector('td.date-only').text.trim();
|
|
37
37
|
};
|
|
38
|
-
exports.
|
|
39
|
-
const
|
|
38
|
+
exports.getUserRatingDate = getUserRatingDate;
|
|
39
|
+
const getUserRatingUrl = (el) => {
|
|
40
40
|
const url = el.querySelector('td.name .film-title-name').attributes.href;
|
|
41
41
|
return `https://www.csfd.cz${url}`;
|
|
42
42
|
};
|
|
43
|
-
exports.
|
|
43
|
+
exports.getUserRatingUrl = getUserRatingUrl;
|
|
44
44
|
const parseColor = (quality) => {
|
|
45
45
|
switch (quality) {
|
|
46
46
|
case 'lightgrey':
|
|
@@ -55,7 +55,6 @@ const parseColor = (quality) => {
|
|
|
55
55
|
return 'unknown';
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
exports.parseColor = parseColor;
|
|
59
58
|
// Sleep in loop
|
|
60
59
|
const sleep = (ms) => new Promise((res) => setTimeout(res, ms));
|
|
61
60
|
exports.sleep = sleep;
|
|
@@ -34,7 +34,7 @@ class CinemaScraper {
|
|
|
34
34
|
name: cinemaInfo === null || cinemaInfo === void 0 ? void 0 : cinemaInfo.name,
|
|
35
35
|
city: cinemaInfo === null || cinemaInfo === void 0 ? void 0 : cinemaInfo.city,
|
|
36
36
|
url: (0, cinema_helper_1.getCinemaUrl)(x),
|
|
37
|
-
coords: (0, cinema_helper_1.
|
|
37
|
+
coords: (0, cinema_helper_1.getCinemaCoords)(x),
|
|
38
38
|
screenings: (0, cinema_helper_1.getGroupedFilmsByDate)(x)
|
|
39
39
|
};
|
|
40
40
|
cinemas.push(cinema);
|
|
@@ -30,13 +30,13 @@ class CreatorScraper {
|
|
|
30
30
|
var _a, _b, _c;
|
|
31
31
|
this.person = {
|
|
32
32
|
id,
|
|
33
|
-
name: (0, creator_helper_1.
|
|
34
|
-
birthday: (_a = (0, creator_helper_1.
|
|
35
|
-
birthplace: (_b = (0, creator_helper_1.
|
|
36
|
-
photo: (0, creator_helper_1.
|
|
37
|
-
age: ((_c = (0, creator_helper_1.
|
|
38
|
-
bio: (0, creator_helper_1.
|
|
39
|
-
films: (0, creator_helper_1.
|
|
33
|
+
name: (0, creator_helper_1.getCreatorName)(asideEl),
|
|
34
|
+
birthday: (_a = (0, creator_helper_1.getCreatorBirthdayInfo)(asideEl)) === null || _a === void 0 ? void 0 : _a.birthday,
|
|
35
|
+
birthplace: (_b = (0, creator_helper_1.getCreatorBirthdayInfo)(asideEl)) === null || _b === void 0 ? void 0 : _b.birthPlace,
|
|
36
|
+
photo: (0, creator_helper_1.getCreatorPhoto)(asideEl),
|
|
37
|
+
age: ((_c = (0, creator_helper_1.getCreatorBirthdayInfo)(asideEl)) === null || _c === void 0 ? void 0 : _c.age) || null,
|
|
38
|
+
bio: (0, creator_helper_1.getCreatorBio)(asideEl),
|
|
39
|
+
films: (0, creator_helper_1.getCreatorFilms)(filmsNode)
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -31,38 +31,38 @@ class MovieScraper {
|
|
|
31
31
|
buildMovie(movieId, el, asideEl, pageClasses, jsonLd) {
|
|
32
32
|
this.film = {
|
|
33
33
|
id: movieId,
|
|
34
|
-
title: (0, movie_helper_1.
|
|
35
|
-
year: (0, movie_helper_1.
|
|
36
|
-
duration: (0, movie_helper_1.
|
|
37
|
-
descriptions: (0, movie_helper_1.
|
|
38
|
-
genres: (0, movie_helper_1.
|
|
39
|
-
type: (0, movie_helper_1.
|
|
34
|
+
title: (0, movie_helper_1.getMovieTitle)(el),
|
|
35
|
+
year: (0, movie_helper_1.getMovieYear)(jsonLd),
|
|
36
|
+
duration: (0, movie_helper_1.getMovieDuration)(jsonLd, el),
|
|
37
|
+
descriptions: (0, movie_helper_1.getMovieDescriptions)(el),
|
|
38
|
+
genres: (0, movie_helper_1.getMovieGenres)(el),
|
|
39
|
+
type: (0, movie_helper_1.getMovieType)(el),
|
|
40
40
|
url: (0, vars_1.movieUrl)(movieId),
|
|
41
|
-
origins: (0, movie_helper_1.
|
|
42
|
-
colorRating: (0, movie_helper_1.
|
|
43
|
-
rating: (0, movie_helper_1.
|
|
44
|
-
ratingCount: (0, movie_helper_1.
|
|
45
|
-
titlesOther: (0, movie_helper_1.
|
|
46
|
-
poster: (0, movie_helper_1.
|
|
47
|
-
photo: (0, movie_helper_1.
|
|
48
|
-
trivia: (0, movie_helper_1.
|
|
41
|
+
origins: (0, movie_helper_1.getMovieOrigins)(el),
|
|
42
|
+
colorRating: (0, movie_helper_1.getMovieColorRating)(pageClasses),
|
|
43
|
+
rating: (0, movie_helper_1.getMovieRating)(asideEl),
|
|
44
|
+
ratingCount: (0, movie_helper_1.getMovieRatingCount)(asideEl),
|
|
45
|
+
titlesOther: (0, movie_helper_1.getMovieTitlesOther)(el),
|
|
46
|
+
poster: (0, movie_helper_1.getMoviePoster)(el),
|
|
47
|
+
photo: (0, movie_helper_1.getMovieRandomPhoto)(el),
|
|
48
|
+
trivia: (0, movie_helper_1.getMovieTrivia)(el),
|
|
49
49
|
creators: {
|
|
50
|
-
directors: (0, movie_helper_1.
|
|
51
|
-
writers: (0, movie_helper_1.
|
|
52
|
-
cinematography: (0, movie_helper_1.
|
|
53
|
-
music: (0, movie_helper_1.
|
|
54
|
-
actors: (0, movie_helper_1.
|
|
55
|
-
basedOn: (0, movie_helper_1.
|
|
56
|
-
producers: (0, movie_helper_1.
|
|
57
|
-
filmEditing: (0, movie_helper_1.
|
|
58
|
-
costumeDesign: (0, movie_helper_1.
|
|
59
|
-
productionDesign: (0, movie_helper_1.
|
|
50
|
+
directors: (0, movie_helper_1.getMovieGroup)(el, 'Režie'),
|
|
51
|
+
writers: (0, movie_helper_1.getMovieGroup)(el, 'Scénář'),
|
|
52
|
+
cinematography: (0, movie_helper_1.getMovieGroup)(el, 'Kamera'),
|
|
53
|
+
music: (0, movie_helper_1.getMovieGroup)(el, 'Hudba'),
|
|
54
|
+
actors: (0, movie_helper_1.getMovieGroup)(el, 'Hrají'),
|
|
55
|
+
basedOn: (0, movie_helper_1.getMovieGroup)(el, 'Předloha'),
|
|
56
|
+
producers: (0, movie_helper_1.getMovieGroup)(el, 'Produkce'),
|
|
57
|
+
filmEditing: (0, movie_helper_1.getMovieGroup)(el, 'Střih'),
|
|
58
|
+
costumeDesign: (0, movie_helper_1.getMovieGroup)(el, 'Kostýmy'),
|
|
59
|
+
productionDesign: (0, movie_helper_1.getMovieGroup)(el, 'Scénografie')
|
|
60
60
|
},
|
|
61
|
-
vod: (0, movie_helper_1.
|
|
62
|
-
tags: (0, movie_helper_1.
|
|
63
|
-
premieres: (0, movie_helper_1.
|
|
64
|
-
related: (0, movie_helper_1.
|
|
65
|
-
similar: (0, movie_helper_1.
|
|
61
|
+
vod: (0, movie_helper_1.getMovieVods)(asideEl),
|
|
62
|
+
tags: (0, movie_helper_1.getMovieTags)(asideEl),
|
|
63
|
+
premieres: (0, movie_helper_1.getMoviePremieres)(asideEl),
|
|
64
|
+
related: (0, movie_helper_1.getMovieBoxMovies)(asideEl, 'Související'),
|
|
65
|
+
similar: (0, movie_helper_1.getMovieBoxMovies)(asideEl, 'Podobné')
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
}
|