kinoklub-api
Advanced tools
Comparing version 0.0.1-next.5 to 0.0.1-next.6
@@ -17,1 +17,2 @@ import { HTMLElement } from 'node-html-parser'; | ||
export declare const getCurrentProjection: (el: HTMLElement) => KinoklubProjection; | ||
export declare const getProjections: (el: HTMLElement) => KinoklubProjection[]; |
@@ -57,6 +57,9 @@ import { resolveCinema, resolveDate } from './global.helper.js'; | ||
export const getCurrentProjection = (el) => { | ||
const element = el.querySelector('.modal-body__projection-row--current'); | ||
return parseProjection(element); | ||
}; | ||
const parseProjection = (el) => { | ||
var _a, _b, _c; | ||
const element = el.querySelector('.modal-body__projection-row--current'); | ||
if (element) { | ||
const cinemaName = element.querySelector('.modal-body__projection-cinema span').textContent; | ||
if (el) { | ||
const cinemaName = el.querySelector('.modal-body__projection-cinema span').textContent; | ||
const cinema = resolveCinema(cinemaName); | ||
@@ -83,1 +86,5 @@ const day = (_a = el | ||
}; | ||
export const getProjections = (el) => { | ||
const element = el.querySelectorAll('.modal-body__projection-row'); | ||
return element.map((el) => parseProjection(el)); | ||
}; |
@@ -14,2 +14,3 @@ import { KinoklubCinema } from './global'; | ||
projection?: KinoklubProjection; | ||
projectionsOther?: KinoklubProjection[]; | ||
} | ||
@@ -19,3 +20,3 @@ export interface KinoklubProjection { | ||
price: string; | ||
cinema: KinoklubCinema; | ||
cinema: KinoklubCinema | string; | ||
} | ||
@@ -22,0 +23,0 @@ export interface KinoklubMovieCsfd { |
{ | ||
"name": "kinoklub-api", | ||
"version": "0.0.1-next.5", | ||
"version": "0.0.1-next.6", | ||
"description": "Support library for KinoKlub", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -12,3 +12,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { fetchPage } from '../fetchers/index.js'; | ||
import { getButton, getCurrentProjection, getDescription, getImage, getInfo, getTags, getTitle, getTitleOriginal, getYoutube } from '../helpers/movie.helper.js'; | ||
import { getButton, getCurrentProjection, getDescription, getImage, getInfo, getProjections, getTags, getTitle, getTitleOriginal, getYoutube } from '../helpers/movie.helper.js'; | ||
import { movieUrl } from '../vars.js'; | ||
@@ -37,5 +37,6 @@ export class MovieScraper { | ||
image: getImage(el), | ||
projection: getCurrentProjection(el) | ||
projection: getCurrentProjection(el), | ||
projectionsOther: getProjections(el) | ||
}; | ||
} | ||
} |
19168
398