kinoklub-api
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -14,3 +14,3 @@ import { resolveCinema, resolveDate } from './global.helper.js'; | ||
export const getDescription = (el) => { | ||
const blocks = el.querySelectorAll('.modal-body__mobile-bottom p'); | ||
const blocks = el.querySelectorAll('.modal-body__mobile-bottom div:first-child'); | ||
const blocksCleaned = blocks.map((block) => { var _a, _b; return (_b = (_a = block === null || block === void 0 ? void 0 : block.textContent) === null || _a === void 0 ? void 0 : _a.replace(/(\r\n|\n|\r|\t)/gm, '')) === null || _b === void 0 ? void 0 : _b.trim(); }); | ||
@@ -17,0 +17,0 @@ return blocksCleaned.join('\n'); |
@@ -9,4 +9,12 @@ import { HTMLElement } from 'node-html-parser'; | ||
export declare const getPrice: (el: HTMLElement) => string; | ||
export declare const getTicketUrl: (el: HTMLElement) => string; | ||
export declare const getTicketParams: (el: HTMLElement) => { | ||
action: string; | ||
mrsId: string; | ||
eventId: string; | ||
successRedirect: string; | ||
failedRedirect: string; | ||
redirectAddTickets: string; | ||
language: string; | ||
}; | ||
export declare const getDay: (el: HTMLElement) => string; | ||
export declare const getCinema: (el: HTMLElement) => KinoklubCinema | string; |
@@ -24,5 +24,15 @@ import { resolveCinema } from './global.helper.js'; | ||
}; | ||
export const getTicketUrl = (el) => { | ||
var _a; | ||
return (_a = el.querySelector('.program__price a')) === null || _a === void 0 ? void 0 : _a.attributes.href; | ||
export const getTicketParams = (el) => { | ||
var _a, _b, _c, _d, _e, _f; | ||
const node = el.querySelector('.program__price form'); | ||
if (!node) | ||
return undefined; | ||
const action = node === null || node === void 0 ? void 0 : node.attributes.action; | ||
const mrsId = (_a = node.querySelector('input[name=mrsid]')) === null || _a === void 0 ? void 0 : _a.attributes.value; | ||
const eventId = (_b = node.querySelector('input[name=eventid]')) === null || _b === void 0 ? void 0 : _b.attributes.value; | ||
const successRedirect = (_c = node.querySelector('input[name=successredirect]')) === null || _c === void 0 ? void 0 : _c.attributes.value; | ||
const failedRedirect = (_d = node.querySelector('input[name=failedredirect]')) === null || _d === void 0 ? void 0 : _d.attributes.value; | ||
const redirectAddTickets = (_e = node.querySelector('input[name=redirectaddtickets]')) === null || _e === void 0 ? void 0 : _e.attributes.value; | ||
const language = (_f = node.querySelector('input[name=language]')) === null || _f === void 0 ? void 0 : _f.attributes.value; | ||
return { action, mrsId, eventId, successRedirect, failedRedirect, redirectAddTickets, language }; | ||
}; | ||
@@ -29,0 +39,0 @@ export const getDay = (el) => { |
{ | ||
"name": "kinoklub-api", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Support library for KinoKlub", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -13,4 +13,4 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { resolveDate } from '../helpers/global.helper.js'; | ||
import { getCinema, getDay, getHour, getId, getPrice, getRunning, getTags, getTicketUrl, getTitle } from '../helpers/program.helper.js'; | ||
import { programUrl } from '../vars.js'; | ||
import { getCinema, getDay, getHour, getId, getPrice, getRunning, getTags, getTicketParams, getTitle } from '../helpers/program.helper.js'; | ||
import { programUrl, ticketsRedirectUrl } from '../vars.js'; | ||
export class ProgramScraper { | ||
@@ -30,2 +30,4 @@ program(lang) { | ||
const day = getDay(m); | ||
const ticketParams = getTicketParams(m); | ||
const queryParams = new URLSearchParams(ticketParams).toString(); | ||
return { | ||
@@ -36,3 +38,3 @@ id: getId(m), | ||
price: getPrice(m), | ||
ticketUrl: getTicketUrl(m), | ||
ticketUrl: queryParams ? ticketsRedirectUrl + '?' + queryParams : null, | ||
cinema: getCinema(m), | ||
@@ -39,0 +41,0 @@ tags: getTags(m), |
import { Language } from './interfaces/global'; | ||
export declare const programUrl: (lang: Language) => string; | ||
export declare const movieUrl: (movieId: number, lang: Language) => string; | ||
export declare const ticketsRedirectUrl = "https://bartweb.cz/kinoklub/redirect.html"; |
export const programUrl = (lang) => `https://www.kinoaero.cz/api_program?cinema%5B%5D=1&cinema%5B%5D=2&cinema%5B%5D=3&hall%5B%5D=1&hall%5B%5D=2&hall%5B%5D=3&ef=0&m=&wp=0&arch=0&ao=0&d=0&_locale=${lang}`; | ||
export const movieUrl = (movieId, lang) => `https://www.kinoaero.cz/api_film/?pr=${movieId}&_locale=${lang}`; | ||
export const ticketsRedirectUrl = 'https://bartweb.cz/kinoklub/redirect.html'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21419
431