node-csfd-api 3.0.0-next.1 → 3.0.0-next.2
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/search.helper.js +19 -8
- package/cjs/services/search.service.js +1 -1
- package/esm/helpers/search.helper.js +19 -8
- package/esm/services/search.service.js +1 -1
- package/package.json +2 -3
- package/types/helpers/creator.helper.d.ts +5 -5
- package/types/helpers/movie.helper.d.ts +4 -4
- package/types/helpers/search.helper.d.ts +1 -1
- package/types/interfaces/creator.interface.d.ts +1 -1
- package/types/interfaces/global.d.ts +3 -3
- package/types/interfaces/movie.interface.d.ts +5 -4
- package/types/interfaces/user-ratings.interface.d.ts +1 -1
|
@@ -37,13 +37,24 @@ const getOrigins = (el) => {
|
|
|
37
37
|
};
|
|
38
38
|
exports.getOrigins = getOrigins;
|
|
39
39
|
const parsePeople = (el, type) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
let who;
|
|
41
|
+
if (type === 'directors')
|
|
42
|
+
who = 'Režie:';
|
|
43
|
+
if (type === 'actors')
|
|
44
|
+
who = 'Hrají:';
|
|
45
|
+
const peopleNode = Array.from(el && el.querySelectorAll('.article-content p')).find((el) => el.textContent.includes(who));
|
|
46
|
+
if (peopleNode) {
|
|
47
|
+
const people = Array.from(peopleNode.querySelectorAll('a'));
|
|
48
|
+
return people.map((person) => {
|
|
49
|
+
return {
|
|
50
|
+
id: (0, global_helper_1.parseIdFromUrl)(person.attributes.href),
|
|
51
|
+
name: person.innerText.trim(),
|
|
52
|
+
url: `https://www.csfd.cz${person.attributes.href}`
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
48
59
|
};
|
|
49
60
|
exports.parsePeople = parsePeople;
|
|
@@ -42,7 +42,7 @@ class SearchScraper {
|
|
|
42
42
|
poster: (0, search_helper_1.getPoster)(m),
|
|
43
43
|
origins: (0, search_helper_1.getOrigins)(m),
|
|
44
44
|
creators: {
|
|
45
|
-
directors: (0, search_helper_1.parsePeople)(m, '
|
|
45
|
+
directors: (0, search_helper_1.parsePeople)(m, 'directors'),
|
|
46
46
|
actors: (0, search_helper_1.parsePeople)(m, 'actors')
|
|
47
47
|
}
|
|
48
48
|
};
|
|
@@ -27,12 +27,23 @@ export const getOrigins = (el) => {
|
|
|
27
27
|
return originsAll === null || originsAll === void 0 ? void 0 : originsAll.split('/').map((country) => country.trim());
|
|
28
28
|
};
|
|
29
29
|
export const parsePeople = (el, type) => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
let who;
|
|
31
|
+
if (type === 'directors')
|
|
32
|
+
who = 'Režie:';
|
|
33
|
+
if (type === 'actors')
|
|
34
|
+
who = 'Hrají:';
|
|
35
|
+
const peopleNode = Array.from(el && el.querySelectorAll('.article-content p')).find((el) => el.textContent.includes(who));
|
|
36
|
+
if (peopleNode) {
|
|
37
|
+
const people = Array.from(peopleNode.querySelectorAll('a'));
|
|
38
|
+
return people.map((person) => {
|
|
39
|
+
return {
|
|
40
|
+
id: parseIdFromUrl(person.attributes.href),
|
|
41
|
+
name: person.innerText.trim(),
|
|
42
|
+
url: `https://www.csfd.cz${person.attributes.href}`
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
38
49
|
};
|
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.2",
|
|
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>",
|
|
@@ -24,8 +24,7 @@
|
|
|
24
24
|
"release:major": "git checkout master && npm version major -m \"chore(update): major release %s 💥\""
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"
|
|
28
|
-
"node-html-parser": "^6.1.1"
|
|
27
|
+
"node-html-parser": "^6.1.4"
|
|
29
28
|
},
|
|
30
29
|
"repository": {
|
|
31
30
|
"url": "git+https://github.com/bartholomej/node-csfd-api.git",
|
|
@@ -3,15 +3,15 @@ import { CSFDCreatorScreening } from '../interfaces/creator.interface';
|
|
|
3
3
|
import { CSFDColorRating } from '../interfaces/global';
|
|
4
4
|
export declare const getColorRating: (el: HTMLElement) => CSFDColorRating;
|
|
5
5
|
export declare const getId: (url: string) => number;
|
|
6
|
-
export declare const getName: (el: HTMLElement) => string;
|
|
7
|
-
export declare const getBirthdayInfo: (el: HTMLElement) => {
|
|
6
|
+
export declare const getName: (el: HTMLElement | null) => string;
|
|
7
|
+
export declare const getBirthdayInfo: (el: HTMLElement | null) => {
|
|
8
8
|
birthday: string;
|
|
9
9
|
age: number;
|
|
10
10
|
birthPlace: string;
|
|
11
11
|
};
|
|
12
|
-
export declare const getBio: (el: HTMLElement) => string;
|
|
13
|
-
export declare const getPhoto: (el: HTMLElement) => string;
|
|
12
|
+
export declare const getBio: (el: HTMLElement | null) => string;
|
|
13
|
+
export declare const getPhoto: (el: HTMLElement | null) => string;
|
|
14
14
|
export declare const parseBirthday: (text: string) => any;
|
|
15
15
|
export declare const parseAge: (text: string) => any;
|
|
16
16
|
export declare const parseBirthPlace: (text: string) => any;
|
|
17
|
-
export declare const getFilms: (el: HTMLElement) => CSFDCreatorScreening[];
|
|
17
|
+
export declare const getFilms: (el: HTMLElement | null) => CSFDCreatorScreening[];
|
|
@@ -11,14 +11,14 @@ export declare const getRatingCount: (el: HTMLElement) => number;
|
|
|
11
11
|
export declare const getYear: (el: string) => number;
|
|
12
12
|
export declare const getDuration: (jsonLdRaw: string, el: HTMLElement) => number;
|
|
13
13
|
export declare const getTitlesOther: (el: HTMLElement) => CSFDTitlesOther[];
|
|
14
|
-
export declare const getPoster: (el: HTMLElement) => string;
|
|
15
|
-
export declare const getRandomPhoto: (el: HTMLElement) => string;
|
|
16
|
-
export declare const getTrivia: (el: HTMLElement) => string[];
|
|
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
17
|
export declare const getDescriptions: (el: HTMLElement) => string[];
|
|
18
18
|
export declare const parsePeople: (el: HTMLElement) => CSFDCreator[];
|
|
19
19
|
export declare const getGroup: (el: HTMLElement, group: CSFDCreatorGroups) => CSFDCreator[];
|
|
20
20
|
export declare const getType: (el: HTMLElement) => string;
|
|
21
|
-
export declare const getVods: (el: HTMLElement) => CSFDVod[];
|
|
21
|
+
export declare const getVods: (el: HTMLElement | null) => CSFDVod[];
|
|
22
22
|
export declare const getBoxContent: (el: HTMLElement, box: string) => HTMLElement;
|
|
23
23
|
export declare const getBoxMovies: (el: HTMLElement, boxName: CSFDBoxContent) => CSFDMovieListItem[];
|
|
24
24
|
export declare const getPremieres: (el: HTMLElement) => CSFDPremiere[];
|
|
@@ -8,4 +8,4 @@ export declare const getUrl: (el: HTMLElement) => string;
|
|
|
8
8
|
export declare const getColorRating: (el: HTMLElement) => CSFDColorRating;
|
|
9
9
|
export declare const getPoster: (el: HTMLElement) => string;
|
|
10
10
|
export declare const getOrigins: (el: HTMLElement) => string[];
|
|
11
|
-
export declare const parsePeople: (el: HTMLElement, type: '
|
|
11
|
+
export declare const parsePeople: (el: HTMLElement, type: 'directors' | 'actors') => CSFDCreator[];
|
|
@@ -17,6 +17,6 @@ export interface CSFDScreening {
|
|
|
17
17
|
*/
|
|
18
18
|
colorRating: CSFDColorRating;
|
|
19
19
|
}
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
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';
|
|
@@ -17,8 +17,9 @@ export interface CSFDMovie extends CSFDScreening {
|
|
|
17
17
|
related: CSFDMovieListItem[];
|
|
18
18
|
similar: CSFDMovieListItem[];
|
|
19
19
|
}
|
|
20
|
+
export type CSFDVodService = 'Netflix' | 'hbogo' | 'Prime Video' | 'Apple TV+' | 'iTunes' | 'KVIFF.TV' | 'Edisonline' | 'o2tv' | 'SledovaniTV' | 'Starmax' | 'DAFilms' | 'FILMY ČESKY A ZADARMO' | 'Youtube Česká filmová klasika' | 'VAPET' | 'VOREL FILM' | 'ivysilani' | 'Google Play' | 'Voyo' | 'DVD';
|
|
20
21
|
export interface CSFDVod {
|
|
21
|
-
title:
|
|
22
|
+
title: CSFDVodService;
|
|
22
23
|
url: string;
|
|
23
24
|
}
|
|
24
25
|
export interface CSFDCreators {
|
|
@@ -54,12 +55,12 @@ export interface CSFDMovieListItem {
|
|
|
54
55
|
title: string;
|
|
55
56
|
url: string;
|
|
56
57
|
}
|
|
57
|
-
export
|
|
58
|
-
export
|
|
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';
|
|
59
60
|
export interface CSFDPremiere {
|
|
60
61
|
country: string;
|
|
61
62
|
format: string;
|
|
62
63
|
date: string;
|
|
63
64
|
company: string;
|
|
64
65
|
}
|
|
65
|
-
export
|
|
66
|
+
export type CSFDBoxContent = 'Související' | 'Podobné';
|