node-csfd-api
Advanced tools
Comparing version 1.10.0 to 1.11.0-beta.0
@@ -15,2 +15,3 @@ import { HTMLElement } from 'node-html-parser'; | ||
export declare const getPoster: (el: HTMLElement) => string; | ||
export declare const getRandomPhoto: (el: HTMLElement) => string; | ||
export declare const getDescriptions: (el: HTMLElement) => string[]; | ||
@@ -17,0 +18,0 @@ export declare const getDirectors: (el: HTMLElement) => CSFDCreator[]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
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.getRatingCount = 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.getRandomPhoto = exports.getPoster = exports.getTitlesOther = exports.getDuration = exports.getYear = exports.getRatingCount = exports.getRating = exports.getColorRating = exports.getOrigins = exports.getGenres = exports.getTitle = exports.getId = void 0; | ||
const global_helper_1 = require("./global.helper"); | ||
@@ -93,13 +93,30 @@ const getId = (el) => { | ||
const poster = el.querySelector('.film-posters img'); | ||
// Resolve empty image | ||
if ((_a = poster.classNames) === null || _a === void 0 ? void 0 : _a.includes('empty-image')) { | ||
if (poster) { | ||
// Resolve empty image | ||
if ((_a = poster.classNames) === null || _a === void 0 ? void 0 : _a.includes('empty-image')) { | ||
return null; | ||
} | ||
else { | ||
// Full sized image (not thumb) | ||
const imageThumb = poster.attributes.src.split('?')[0]; | ||
return imageThumb.replace(/\/w140\//, '/w1080/'); | ||
} | ||
} | ||
else { | ||
return null; | ||
} | ||
}; | ||
exports.getPoster = getPoster; | ||
const getRandomPhoto = (el) => { | ||
var _a; | ||
const imageNode = el.querySelector('.gallery-item picture img'); | ||
const image = (_a = imageNode === null || imageNode === void 0 ? void 0 : imageNode.attributes) === null || _a === void 0 ? void 0 : _a.src; | ||
if (image) { | ||
return image.replace(/\/w663\//, '/w1326/'); | ||
} | ||
else { | ||
// Full sized image (not thumb) | ||
const imageThumb = poster.attributes.src.split('?')[0]; | ||
return imageThumb.replace(/\/w140\//, '/w1080/'); | ||
return null; | ||
} | ||
}; | ||
exports.getPoster = getPoster; | ||
exports.getRandomPhoto = getRandomPhoto; | ||
const getDescriptions = (el) => { | ||
@@ -106,0 +123,0 @@ var _a; |
@@ -5,2 +5,3 @@ import { CSFDScreening } from './global'; | ||
poster: string; | ||
photo: string; | ||
ratingCount: number | null; | ||
@@ -7,0 +8,0 @@ duration: number | string; |
{ | ||
"name": "node-csfd-api", | ||
"version": "1.10.0", | ||
"version": "1.11.0-beta.0", | ||
"description": "Simple NPM library for scraping CSFD", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -35,2 +35,3 @@ "use strict"; | ||
poster: (0, movie_helper_1.getPoster)(el), | ||
photo: (0, movie_helper_1.getRandomPhoto)(el), | ||
creators: { | ||
@@ -37,0 +38,0 @@ directors: (0, movie_helper_1.getDirectors)(el), |
@@ -6,3 +6,3 @@ "use strict"; | ||
exports.userRatingsUrl = userRatingsUrl; | ||
const movieUrl = (movie) => `https://www.csfd.cz/film/${encodeURIComponent(movie)}`; | ||
const movieUrl = (movie) => `https://www.csfd.cz/film/${encodeURIComponent(movie)}/prehled/`; | ||
exports.movieUrl = movieUrl; | ||
@@ -9,0 +9,0 @@ const creatorUrl = (creator) => `https://www.csfd.cz/tvurce/${encodeURIComponent(creator)}`; |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
58258
1062
1