node-csfd-api 3.0.0-next.15 → 3.0.0-next.17
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/index.js +2 -2
- package/cjs/services/cinema.service.js +2 -2
- package/cjs/vars.js +1 -1
- package/esm/index.js +2 -2
- package/esm/services/cinema.service.js +2 -2
- package/esm/vars.js +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +2 -2
- package/types/interfaces/cinema.interface.d.ts +1 -0
- package/types/services/cinema.service.d.ts +2 -2
- package/types/vars.d.ts +2 -1
package/cjs/index.js
CHANGED
|
@@ -43,9 +43,9 @@ class Csfd {
|
|
|
43
43
|
return this.searchService.search(text);
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
cinema(district) {
|
|
46
|
+
cinema(district, period) {
|
|
47
47
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
return this.cinemaService.cinemas(+district);
|
|
48
|
+
return this.cinemaService.cinemas(+district, period);
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -15,9 +15,9 @@ const fetchers_1 = require("../fetchers");
|
|
|
15
15
|
const vars_1 = require("../vars");
|
|
16
16
|
const cinema_helper_1 = require("./../helpers/cinema.helper");
|
|
17
17
|
class CinemaScraper {
|
|
18
|
-
cinemas(district) {
|
|
18
|
+
cinemas(district = 1, period = 'today') {
|
|
19
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const url = (0, vars_1.cinemasUrl)(district,
|
|
20
|
+
const url = (0, vars_1.cinemasUrl)(district, period);
|
|
21
21
|
const response = yield (0, fetchers_1.fetchPage)(url);
|
|
22
22
|
const cinemasHtml = (0, node_html_parser_1.parse)(response);
|
|
23
23
|
const contentNode = cinemasHtml.querySelectorAll('#snippet--cinemas section.box');
|
package/cjs/vars.js
CHANGED
|
@@ -7,7 +7,7 @@ const movieUrl = (movie) => `https://www.csfd.cz/film/${encodeURIComponent(movie
|
|
|
7
7
|
exports.movieUrl = movieUrl;
|
|
8
8
|
const creatorUrl = (creator) => `https://www.csfd.cz/tvurce/${encodeURIComponent(creator)}`;
|
|
9
9
|
exports.creatorUrl = creatorUrl;
|
|
10
|
-
const cinemasUrl = (district
|
|
10
|
+
const cinemasUrl = (district, period) => {
|
|
11
11
|
return `https://www.csfd.cz/kino/?period=${period}&district=${district}`;
|
|
12
12
|
};
|
|
13
13
|
exports.cinemasUrl = cinemasUrl;
|
package/esm/index.js
CHANGED
|
@@ -40,9 +40,9 @@ export class Csfd {
|
|
|
40
40
|
return this.searchService.search(text);
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
cinema(district) {
|
|
43
|
+
cinema(district, period) {
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
return this.cinemaService.cinemas(+district);
|
|
45
|
+
return this.cinemaService.cinemas(+district, period);
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -12,9 +12,9 @@ import { fetchPage } from '../fetchers';
|
|
|
12
12
|
import { cinemasUrl } from '../vars';
|
|
13
13
|
import { getCinemaId, getCinemaUrl, getCoords, getGroupedFilmsByDate, parseCinema } from './../helpers/cinema.helper';
|
|
14
14
|
export class CinemaScraper {
|
|
15
|
-
cinemas(district) {
|
|
15
|
+
cinemas(district = 1, period = 'today') {
|
|
16
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
const url = cinemasUrl(district,
|
|
17
|
+
const url = cinemasUrl(district, period);
|
|
18
18
|
const response = yield fetchPage(url);
|
|
19
19
|
const cinemasHtml = parse(response);
|
|
20
20
|
const contentNode = cinemasHtml.querySelectorAll('#snippet--cinemas section.box');
|
package/esm/vars.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const userRatingsUrl = (user, page) => `https://www.csfd.cz/uzivatel/${encodeURIComponent(user)}/hodnoceni/${page ? '?page=' + page : ''}`;
|
|
2
2
|
export const movieUrl = (movie) => `https://www.csfd.cz/film/${encodeURIComponent(movie)}/prehled/`;
|
|
3
3
|
export const creatorUrl = (creator) => `https://www.csfd.cz/tvurce/${encodeURIComponent(creator)}`;
|
|
4
|
-
export const cinemasUrl = (district
|
|
4
|
+
export const cinemasUrl = (district, period) => {
|
|
5
5
|
return `https://www.csfd.cz/kino/?period=${period}&district=${district}`;
|
|
6
6
|
};
|
|
7
7
|
export const searchUrl = (text) => `https://www.csfd.cz/hledat/?q=${encodeURIComponent(text)}`;
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSFDCinema } from 'interfaces/cinema.interface';
|
|
1
|
+
import { CSFDCinema, CSFDCinemaPeriod } from 'interfaces/cinema.interface';
|
|
2
2
|
import { CSFDCreator } from './interfaces/creator.interface';
|
|
3
3
|
import { CSFDMovie } from './interfaces/movie.interface';
|
|
4
4
|
import { CSFDSearch } from './interfaces/search.interface';
|
|
@@ -19,6 +19,6 @@ export declare class Csfd {
|
|
|
19
19
|
movie(movie: number): Promise<CSFDMovie>;
|
|
20
20
|
creator(creator: number): Promise<CSFDCreator>;
|
|
21
21
|
search(text: string): Promise<CSFDSearch>;
|
|
22
|
-
cinema(district: number): Promise<CSFDCinema[]>;
|
|
22
|
+
cinema(district: number, period: CSFDCinemaPeriod): Promise<CSFDCinema[]>;
|
|
23
23
|
}
|
|
24
24
|
export declare const csfd: Csfd;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CSFDCinema } from '../interfaces/cinema.interface';
|
|
1
|
+
import { CSFDCinema, CSFDCinemaPeriod } from '../interfaces/cinema.interface';
|
|
2
2
|
export declare class CinemaScraper {
|
|
3
3
|
private cinema;
|
|
4
|
-
cinemas(district
|
|
4
|
+
cinemas(district?: number, period?: CSFDCinemaPeriod): Promise<CSFDCinema[]>;
|
|
5
5
|
private buildCinemas;
|
|
6
6
|
}
|
package/types/vars.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { CSFDCinemaPeriod } from 'interfaces/cinema.interface';
|
|
1
2
|
export declare const userRatingsUrl: (user: string | number, page?: number) => string;
|
|
2
3
|
export declare const movieUrl: (movie: number) => string;
|
|
3
4
|
export declare const creatorUrl: (creator: number | string) => string;
|
|
4
|
-
export declare const cinemasUrl: (district
|
|
5
|
+
export declare const cinemasUrl: (district: number | string, period: CSFDCinemaPeriod) => string;
|
|
5
6
|
export declare const searchUrl: (text: string) => string;
|