node-csfd-api 2.5.0 → 2.6.0
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/package.json +2 -2
- package/services/search.service.js +23 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-csfd-api",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "ČSFD API in JavaScript. Amazing NPM library for scrapping csfd.cz :)",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"author": "BART! <bart@bartweb.cz>",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"api"
|
|
48
48
|
],
|
|
49
49
|
"engines": {
|
|
50
|
-
"node": ">=
|
|
50
|
+
"node": ">= 14"
|
|
51
51
|
},
|
|
52
52
|
"license": "MIT",
|
|
53
53
|
"module": "./index.js",
|
|
@@ -14,11 +14,13 @@ class SearchScraper {
|
|
|
14
14
|
const html = (0, node_html_parser_1.parse)(response);
|
|
15
15
|
const moviesNode = html.querySelectorAll('.main-movies article');
|
|
16
16
|
const usersNode = html.querySelectorAll('.main-users article');
|
|
17
|
-
|
|
17
|
+
const tvSeriesNode = html.querySelectorAll('.main-series article');
|
|
18
|
+
return this.parseSearch(moviesNode, usersNode, tvSeriesNode);
|
|
18
19
|
}
|
|
19
|
-
parseSearch(moviesNode, usersNode) {
|
|
20
|
+
parseSearch(moviesNode, usersNode, tvSeriesNode) {
|
|
20
21
|
const movies = [];
|
|
21
22
|
const users = [];
|
|
23
|
+
const tvSeries = [];
|
|
22
24
|
moviesNode.map((m) => {
|
|
23
25
|
const url = (0, search_helper_1.getUrl)(m);
|
|
24
26
|
const movie = {
|
|
@@ -48,10 +50,28 @@ class SearchScraper {
|
|
|
48
50
|
};
|
|
49
51
|
users.push(user);
|
|
50
52
|
});
|
|
53
|
+
tvSeriesNode.map((m) => {
|
|
54
|
+
const url = (0, search_helper_1.getUrl)(m);
|
|
55
|
+
const user = {
|
|
56
|
+
id: (0, global_helper_1.parseIdFromUrl)(url),
|
|
57
|
+
title: (0, search_helper_1.getTitle)(m),
|
|
58
|
+
year: (0, search_helper_1.getYear)(m),
|
|
59
|
+
url: `https://www.csfd.cz${url}`,
|
|
60
|
+
type: (0, search_helper_1.getType)(m),
|
|
61
|
+
colorRating: (0, search_helper_1.getColorRating)(m),
|
|
62
|
+
poster: (0, search_helper_1.getPoster)(m),
|
|
63
|
+
origins: (0, search_helper_1.getOrigins)(m),
|
|
64
|
+
creators: {
|
|
65
|
+
directors: (0, search_helper_1.parsePeople)(m, 'directors'),
|
|
66
|
+
actors: (0, search_helper_1.parsePeople)(m, 'actors')
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
tvSeries.push(user);
|
|
70
|
+
});
|
|
51
71
|
const search = {
|
|
52
72
|
movies: movies,
|
|
53
73
|
users: users,
|
|
54
|
-
tvSeries:
|
|
74
|
+
tvSeries: tvSeries,
|
|
55
75
|
creators: []
|
|
56
76
|
};
|
|
57
77
|
return search;
|