node-csfd-api
Advanced tools
Comparing version 1.11.0-beta.1 to 1.11.0-next.0
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.fetchPage = void 0; | ||
const cross_fetch_1 = __importDefault(require("cross-fetch")); | ||
const node_fetch_1 = __importDefault(require("node-fetch")); | ||
const USER_AGENTS = [ | ||
@@ -20,3 +20,3 @@ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36', | ||
try { | ||
const response = await (0, cross_fetch_1.default)(url, { headers }); | ||
const response = await (0, node_fetch_1.default)(url, { headers }); | ||
if (response.status >= 400 && response.status < 600) { | ||
@@ -23,0 +23,0 @@ throw new Error(`node-csfd-api: Bad response ${response.status} for url: ${url}`); |
@@ -15,4 +15,2 @@ import { HTMLElement } from 'node-html-parser'; | ||
export declare const getPoster: (el: HTMLElement) => string; | ||
export declare const getRandomPhoto: (el: HTMLElement) => string; | ||
export declare const getTrivia: (el: HTMLElement) => string[]; | ||
export declare const getDescriptions: (el: HTMLElement) => string[]; | ||
@@ -19,0 +17,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.getTrivia = 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; | ||
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; | ||
const global_helper_1 = require("./global.helper"); | ||
@@ -93,4 +93,4 @@ const getId = (el) => { | ||
const poster = el.querySelector('.film-posters img'); | ||
// Resolve empty image | ||
if (poster) { | ||
// Resolve empty image | ||
if ((_a = poster.classNames) === null || _a === void 0 ? void 0 : _a.includes('empty-image')) { | ||
@@ -110,24 +110,2 @@ 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 { | ||
return null; | ||
} | ||
}; | ||
exports.getRandomPhoto = getRandomPhoto; | ||
const getTrivia = (el) => { | ||
const triviaNodes = el.querySelectorAll('.article-trivia ul li'); | ||
if (triviaNodes === null || triviaNodes === void 0 ? void 0 : triviaNodes.length) { | ||
return triviaNodes.map((node) => node.textContent.trim().replace(/(\r\n|\n|\r|\t)/gm, '')); | ||
} | ||
else { | ||
return null; | ||
} | ||
}; | ||
exports.getTrivia = getTrivia; | ||
const getDescriptions = (el) => { | ||
@@ -134,0 +112,0 @@ var _a; |
@@ -5,3 +5,2 @@ import { CSFDScreening } from './global'; | ||
poster: string; | ||
photo: string; | ||
ratingCount: number | null; | ||
@@ -12,3 +11,2 @@ duration: number | string; | ||
descriptions: string[]; | ||
trivia: string[]; | ||
genres: CSFDGenres[] | string[]; | ||
@@ -23,3 +21,3 @@ creators: CSFDCreators; | ||
export interface CSFDVod { | ||
title: 'Netflix' | 'hbogo' | 'Primve Video' | 'Apple TV+' | 'ivysilani' | 'Aerovod' | 'o2tv' | 'Voyo' | 'FILMY ČESKY A ZADARMO' | 'VAPET' | 'VOREL FILM' | string; | ||
title: 'Netflix' | 'hbogo' | 'Prime Video' | 'Apple TV+' | 'ivysilani' | 'Aerovod' | 'o2tv' | 'Voyo' | 'FILMY ČESKY A ZADARMO' | 'VAPET' | 'VOREL FILM' | string; | ||
url: string; | ||
@@ -26,0 +24,0 @@ } |
{ | ||
"name": "node-csfd-api", | ||
"version": "1.11.0-beta.1", | ||
"version": "1.11.0-next.0", | ||
"description": "Simple NPM library for scraping CSFD", | ||
@@ -19,3 +19,2 @@ "main": "./index.js", | ||
"release:beta": "npm version preminor --preid=beta -m \"chore(update): prelease %s β\"", | ||
"prerelease:beta": "npm version prerelease --preid=beta -m \"chore(update): prelease %s β\"", | ||
"release:patch": "git checkout master && npm version patch -m \"chore(update): patch release %s 🐛\"", | ||
@@ -26,3 +25,3 @@ "release:minor": "git checkout master && npm version minor -m \"chore(update): release %s 🚀\"", | ||
"dependencies": { | ||
"cross-fetch": "^3.1.4", | ||
"node-fetch": "cjs", | ||
"node-html-parser": "^5.1.0" | ||
@@ -29,0 +28,0 @@ }, |
@@ -62,4 +62,2 @@ [![npm version](https://badge.fury.io/js/node-csfd-api.svg)](https://badge.fury.io/js/node-csfd-api) | ||
ratingCount: 6654, | ||
photo: '//image.pmgstatic.com/cache/resized/w1326/files/images/film/photos/162/980/162980090_bbffbb.jpg', | ||
trivia: ['Když Henry (Tory Kittles) se svým mladším bratrem...', 'Ve filmu se střídají...'], | ||
titlesOther: [ | ||
@@ -377,3 +375,2 @@ { country: 'USA', title: 'Dragged Across Concrete' }, | ||
- [x] Similar movies | ||
- [x] Trivia | ||
- [ ] All images | ||
@@ -380,0 +377,0 @@ - [ ] Reviews |
@@ -35,4 +35,2 @@ "use strict"; | ||
poster: (0, movie_helper_1.getPoster)(el), | ||
photo: (0, movie_helper_1.getRandomPhoto)(el), | ||
trivia: (0, movie_helper_1.getTrivia)(el), | ||
creators: { | ||
@@ -39,0 +37,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)}/prehled/`; | ||
const movieUrl = (movie) => `https://www.csfd.cz/film/${encodeURIComponent(movie)}`; | ||
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
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
40
2
57665
125
1048
447
+ Addednode-fetch@cjs
+ Addednode-fetch@2.6.7(transitive)
- Removedcross-fetch@^3.1.4
- Removedcross-fetch@3.1.8(transitive)
- Removednode-fetch@2.7.0(transitive)