node-csfd-api 2.14.0 → 2.14.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.
@@ -1,6 +1,6 @@
1
- import { CSFDCinemaGroupedFilmsByDate, CSFDCinemaMeta, CSFDCinemaMovie } from 'interfaces/cinema.interface';
2
1
  import { HTMLElement } from 'node-html-parser';
3
2
  import { CSFDColorRating } from '../interfaces/global';
3
+ import { CSFDCinemaGroupedFilmsByDate, CSFDCinemaMeta, CSFDCinemaMovie } from './../interfaces/cinema.interface';
4
4
  export declare const getColorRating: (el: HTMLElement) => CSFDColorRating;
5
5
  export declare const getCinemaId: (el: HTMLElement | null) => number;
6
6
  export declare const getId: (url: string) => number | null;
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CSFDCinema, CSFDCinemaPeriod } 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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-csfd-api",
3
- "version": "2.14.0",
3
+ "version": "2.14.1",
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>",
@@ -7,7 +7,11 @@ const creator_helper_1 = require("../helpers/creator.helper");
7
7
  const vars_1 = require("../vars");
8
8
  class CreatorScraper {
9
9
  async creator(creatorId) {
10
- const url = (0, vars_1.creatorUrl)(+creatorId);
10
+ const id = Number(creatorId);
11
+ if (isNaN(id)) {
12
+ throw new Error('node-csfd-api: creatorId must be a valid number');
13
+ }
14
+ const url = (0, vars_1.creatorUrl)(id);
11
15
  const response = await (0, fetchers_1.fetchPage)(url);
12
16
  const creatorHtml = (0, node_html_parser_1.parse)(response);
13
17
  const asideNode = creatorHtml.querySelector('.creator-about');
@@ -7,7 +7,11 @@ const movie_helper_1 = require("../helpers/movie.helper");
7
7
  const vars_1 = require("../vars");
8
8
  class MovieScraper {
9
9
  async movie(movieId) {
10
- const url = (0, vars_1.movieUrl)(+movieId);
10
+ const id = Number(movieId);
11
+ if (isNaN(id)) {
12
+ throw new Error('node-csfd-api: movieId must be a valid number');
13
+ }
14
+ const url = (0, vars_1.movieUrl)(id);
11
15
  const response = await (0, fetchers_1.fetchPage)(url);
12
16
  const movieHtml = (0, node_html_parser_1.parse)(response);
13
17
  const pageClasses = movieHtml.querySelector('.page-content').classNames.split(' ');
package/vars.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CSFDCinemaPeriod } from 'interfaces/cinema.interface';
1
+ import { CSFDCinemaPeriod } from './interfaces/cinema.interface';
2
2
  export declare const userRatingsUrl: (user: string | number, page?: number) => string;
3
3
  export declare const movieUrl: (movie: number) => string;
4
4
  export declare const creatorUrl: (creator: number | string) => string;