node-csfd-api
Advanced tools
Comparing version 1.5.0 to 1.6.1
import { HTMLElement } from 'node-html-parser'; | ||
import { CSFDColorRating } from '../interfaces/global'; | ||
import { CSFDCreator, CSFDCreatorGroups, CSFDGenres, CSFDPremiere, CSFDTitlesOther, CSFDVod } from '../interfaces/movie.interface'; | ||
import { CSFDBoxContent, CSFDCreator, CSFDCreatorGroups, CSFDGenres, CSFDMovieListItem, CSFDPremiere, CSFDTitlesOther, CSFDVod } from '../interfaces/movie.interface'; | ||
export declare const getId: (el: HTMLElement) => number; | ||
@@ -20,3 +20,5 @@ export declare const getTitle: (el: HTMLElement) => string; | ||
export declare const getVods: (el: HTMLElement) => CSFDVod[]; | ||
export declare const getBoxContent: (el: HTMLElement, box: string) => HTMLElement; | ||
export declare const getBoxMovies: (el: HTMLElement, boxName: CSFDBoxContent) => CSFDMovieListItem[]; | ||
export declare const getPremieres: (el: HTMLElement) => CSFDPremiere[]; | ||
export declare const getTags: (el: HTMLElement) => string[]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getTags = exports.getPremieres = exports.getVods = exports.getType = exports.getGroup = exports.parsePeople = exports.getDirectors = exports.getDescriptions = exports.getPoster = exports.getTitlesOther = exports.getDuration = exports.getYear = exports.getRating = exports.getColorRating = exports.getOrigins = exports.getGenres = exports.getTitle = exports.getId = void 0; | ||
exports.getTags = exports.getPremieres = exports.getBoxMovies = exports.getBoxContent = exports.getVods = exports.getType = exports.getGroup = exports.parsePeople = exports.getDirectors = exports.getDescriptions = exports.getPoster = exports.getTitlesOther = exports.getDuration = exports.getYear = exports.getRating = exports.getColorRating = exports.getOrigins = exports.getGenres = exports.getTitle = exports.getId = void 0; | ||
const global_helper_1 = require("./global.helper"); | ||
@@ -151,7 +151,25 @@ const getId = (el) => { | ||
exports.getVods = getVods; | ||
// // TODO tags | ||
// export const getBoxContent = (el: HTMLElement, box: string): HTMLElement => { | ||
// const headers = el.querySelectorAll('section.box .box-header'); | ||
// return headers.find((header) => header.querySelector('h3').text.trim().includes(box)); | ||
// }; | ||
// Get box content | ||
const getBoxContent = (el, box) => { | ||
var _a; | ||
const headers = el.querySelectorAll('section.box .box-header'); | ||
return (_a = headers.find((header) => header.querySelector('h3').text.trim().includes(box))) === null || _a === void 0 ? void 0 : _a.parentNode; | ||
}; | ||
exports.getBoxContent = getBoxContent; | ||
const getBoxMovies = (el, boxName) => { | ||
const movieListItem = []; | ||
const box = exports.getBoxContent(el, boxName); | ||
const movieTitleNodes = box === null || box === void 0 ? void 0 : box.querySelectorAll('.article-header .film-title-name'); | ||
if (movieTitleNodes === null || movieTitleNodes === void 0 ? void 0 : movieTitleNodes.length) { | ||
for (const item of movieTitleNodes) { | ||
movieListItem.push({ | ||
id: global_helper_1.parseIdFromUrl(item.attributes.href), | ||
title: item.textContent.trim(), | ||
url: `https://www.csfd.cz${item.attributes.href}` | ||
}); | ||
} | ||
} | ||
return movieListItem; | ||
}; | ||
exports.getBoxMovies = getBoxMovies; | ||
const getPremieres = (el) => { | ||
@@ -158,0 +176,0 @@ var _a; |
@@ -14,2 +14,4 @@ import { CSFDScreening } from './global'; | ||
premieres: CSFDPremiere[]; | ||
related: CSFDMovieListItem[]; | ||
similar: CSFDMovieListItem[]; | ||
} | ||
@@ -48,2 +50,7 @@ export interface CSFDVod { | ||
} | ||
export interface CSFDMovieListItem { | ||
id: number; | ||
title: string; | ||
url: string; | ||
} | ||
export declare type CSFDGenres = 'Akční' | 'Animovaný' | 'Dobrodružný' | 'Dokumentární' | 'Drama' | 'Experimentální' | 'Fantasy' | 'Film-Noir' | 'Historický' | 'Horor' | 'Hudební' | 'IMAX' | 'Katastrofický' | 'Komedie' | 'Krátkometrážní' | 'Krimi' | 'Loutkový' | 'Muzikál' | 'Mysteriózní' | 'Naučný' | 'Podobenství' | 'Poetický' | 'Pohádka' | 'Povídkový' | 'Psychologický' | 'Publicistický' | 'Reality-TV' | 'Road movie' | 'Rodinný' | 'Romantický' | 'Sci-Fi' | 'Soutěžní' | 'Sportovní' | 'Stand-up' | 'Talk-show' | 'Taneční' | 'Telenovela' | 'Thriller' | 'Válečný' | 'Western' | 'Zábavný' | 'Životopisný'; | ||
@@ -57,1 +64,2 @@ export declare type CSFDCreatorGroups = 'Režie' | 'Scénář' | 'Kamera' | 'Hudba' | 'Hrají' | 'Produkce' | 'Střih' | 'Předloha' | 'Scénografie' | 'Kostýmy'; | ||
} | ||
export declare type CSFDBoxContent = 'Související' | 'Podobné'; |
{ | ||
"name": "node-csfd-api", | ||
"version": "1.5.0", | ||
"version": "1.6.1", | ||
"description": "Simple NPM library for scraping CSFD", | ||
@@ -11,3 +11,3 @@ "main": "./index.js", | ||
"build": "tsc", | ||
"postbuild": "npm-prepare-dist -s postinstall", | ||
"postbuild": "npm-prepare-dist -s postinstall -s prepare", | ||
"tsc": "tsc", | ||
@@ -26,3 +26,3 @@ "demo": "ts-node demo", | ||
"cross-fetch": "^3.1.4", | ||
"node-html-parser": "^3.1.3" | ||
"node-html-parser": "^3.1.4" | ||
}, | ||
@@ -29,0 +29,0 @@ "repository": { |
@@ -284,6 +284,6 @@ [![npm version](https://badge.fury.io/js/node-csfd-api.svg)](https://badge.fury.io/js/node-csfd-api) | ||
- [x] Premieres | ||
- [x] Related movies | ||
- [x] Similar movies | ||
- [ ] All images | ||
- [ ] Reviews | ||
- [ ] Related movies | ||
- [ ] Connected movies | ||
- [ ] OST | ||
@@ -290,0 +290,0 @@ - [ ] Search |
@@ -48,3 +48,5 @@ "use strict"; | ||
tags: movie_helper_1.getTags(asideEl), | ||
premieres: movie_helper_1.getPremieres(asideEl) | ||
premieres: movie_helper_1.getPremieres(asideEl), | ||
related: movie_helper_1.getBoxMovies(asideEl, 'Související'), | ||
similar: movie_helper_1.getBoxMovies(asideEl, 'Podobné') | ||
}; | ||
@@ -51,0 +53,0 @@ } |
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
47123
865
Updatednode-html-parser@^3.1.4