Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-csfd-api

Package Overview
Dependencies
Maintainers
1
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-csfd-api - npm Package Compare versions

Comparing version 1.10.0 to 1.11.0-beta.0

1

helpers/movie.helper.d.ts

@@ -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[];

31

helpers/movie.helper.js
"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)}`;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc