node-csfd-api 3.0.0-next.13 → 3.0.0-next.15

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,11 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseMeta = exports.getFilms = exports.getGroupedFilmsByDate = exports.parseCinema = exports.getCinemaUrl = exports.getCoords = exports.getName = exports.getId = exports.getColorRating = void 0;
3
+ exports.parseMeta = exports.getFilms = exports.getGroupedFilmsByDate = exports.parseCinema = exports.getCinemaUrl = exports.getCoords = exports.getName = exports.getId = exports.getCinemaId = exports.getColorRating = void 0;
4
4
  const global_helper_1 = require("./global.helper");
5
5
  const getColorRating = (el) => {
6
6
  return (0, global_helper_1.parseColor)(el === null || el === void 0 ? void 0 : el.classNames.split(' ').pop());
7
7
  };
8
8
  exports.getColorRating = getColorRating;
9
+ const getCinemaId = (el) => {
10
+ var _a;
11
+ const id = (_a = el === null || el === void 0 ? void 0 : el.id) === null || _a === void 0 ? void 0 : _a.split('-')[1];
12
+ console.log('id', id);
13
+ return +id;
14
+ };
15
+ exports.getCinemaId = getCinemaId;
9
16
  const getId = (url) => {
10
17
  if (url) {
11
18
  return (0, global_helper_1.parseIdFromUrl)(url);
@@ -30,6 +30,7 @@ class CinemaScraper {
30
30
  contentNode.map((x) => {
31
31
  var _a, _b;
32
32
  const cinema = {
33
+ id: (0, cinema_helper_1.getCinemaId)(x),
33
34
  name: (_a = (0, cinema_helper_1.parseCinema)(x)) === null || _a === void 0 ? void 0 : _a.name,
34
35
  city: (_b = (0, cinema_helper_1.parseCinema)(x)) === null || _b === void 0 ? void 0 : _b.city,
35
36
  url: (0, cinema_helper_1.getCinemaUrl)(x),
@@ -2,6 +2,12 @@ import { parseColor, parseIdFromUrl } from './global.helper';
2
2
  export const getColorRating = (el) => {
3
3
  return parseColor(el === null || el === void 0 ? void 0 : el.classNames.split(' ').pop());
4
4
  };
5
+ export const getCinemaId = (el) => {
6
+ var _a;
7
+ const id = (_a = el === null || el === void 0 ? void 0 : el.id) === null || _a === void 0 ? void 0 : _a.split('-')[1];
8
+ console.log('id', id);
9
+ return +id;
10
+ };
5
11
  export const getId = (url) => {
6
12
  if (url) {
7
13
  return parseIdFromUrl(url);
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { parse } from 'node-html-parser';
11
11
  import { fetchPage } from '../fetchers';
12
12
  import { cinemasUrl } from '../vars';
13
- import { getCinemaUrl, getCoords, getGroupedFilmsByDate, parseCinema } from './../helpers/cinema.helper';
13
+ import { getCinemaId, getCinemaUrl, getCoords, getGroupedFilmsByDate, parseCinema } from './../helpers/cinema.helper';
14
14
  export class CinemaScraper {
15
15
  cinemas(district) {
16
16
  return __awaiter(this, void 0, void 0, function* () {
@@ -27,6 +27,7 @@ export class CinemaScraper {
27
27
  contentNode.map((x) => {
28
28
  var _a, _b;
29
29
  const cinema = {
30
+ id: getCinemaId(x),
30
31
  name: (_a = parseCinema(x)) === null || _a === void 0 ? void 0 : _a.name,
31
32
  city: (_b = parseCinema(x)) === null || _b === void 0 ? void 0 : _b.city,
32
33
  url: getCinemaUrl(x),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-csfd-api",
3
- "version": "3.0.0-next.13",
3
+ "version": "3.0.0-next.15",
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>",
@@ -2,6 +2,7 @@ import { CSFDCinemaGroupedFilmsByDate, CSFDCinemaMeta, CSFDCinemaMovie } from 'i
2
2
  import { HTMLElement } from 'node-html-parser';
3
3
  import { CSFDColorRating } from '../interfaces/global';
4
4
  export declare const getColorRating: (el: HTMLElement) => CSFDColorRating;
5
+ export declare const getCinemaId: (el: HTMLElement | null) => number;
5
6
  export declare const getId: (url: string) => number;
6
7
  export declare const getName: (el: HTMLElement | null) => string;
7
8
  export declare const getCoords: (el: HTMLElement | null) => {
@@ -1,5 +1,6 @@
1
1
  import { CSFDMovieListItem } from './movie.interface';
2
2
  export interface CSFDCinema {
3
+ id: number;
3
4
  name: string;
4
5
  city: string;
5
6
  url: string;