node-csfd-api
Advanced tools
Comparing version 2.6.0 to 2.7.0
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.fetchPage = void 0; | ||
const cross_fetch_1 = __importDefault(require("cross-fetch")); | ||
// Check if `fetch` is available in global scope (nodejs 18+) or in window (browser). If not, use cross-fetch polyfill. | ||
const cross_fetch_1 = require("cross-fetch"); | ||
const fetchSafe = (typeof fetch === 'function' && fetch) || // ServiceWorker fetch (Cloud Functions + Chrome extension) | ||
(typeof global === 'object' && global.fetch) || // Node.js 18+ fetch | ||
(typeof window !== 'undefined' && window.fetch) || // Browser fetch | ||
cross_fetch_1.fetch; // Polyfill fetch | ||
const USER_AGENTS = [ | ||
@@ -19,3 +21,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 fetchSafe(url, { headers }); | ||
if (response.status >= 400 && response.status < 600) { | ||
@@ -22,0 +24,0 @@ throw new Error(`node-csfd-api: Bad response ${response.status} for url: ${url}`); |
{ | ||
"name": "node-csfd-api", | ||
"version": "2.6.0", | ||
"version": "2.7.0", | ||
"description": "ČSFD API in JavaScript. Amazing NPM library for scrapping csfd.cz :)", | ||
@@ -16,3 +16,3 @@ "main": "./index.js", | ||
"test": "jest", | ||
"publish:next": "yarn && yarn build && yarn test --coverage true && npm publish --folder dist --tag beta", | ||
"publish:next": "yarn && yarn build && yarn test --coverage true && cd dist && npm publish --tag next", | ||
"postversion": "git push && git push --follow-tags", | ||
@@ -25,2 +25,6 @@ "release:beta": "npm version preminor --preid=beta -m \"chore(update): prelease %s β\"", | ||
}, | ||
"publishConfig": { | ||
"access": "public", | ||
"registry": "https://registry.npmjs.org" | ||
}, | ||
"dependencies": { | ||
@@ -27,0 +31,0 @@ "cross-fetch": "^3.1.5", |
@@ -6,3 +6,3 @@ [![npm version](https://badge.fury.io/js/node-csfd-api.svg)](https://badge.fury.io/js/node-csfd-api) | ||
# CSFD API 2022 | ||
# CSFD API 2023 | ||
@@ -177,2 +177,15 @@ > JavaScript NPM library for scraping **Czech Movie Database (csfd.cz)** | ||
], | ||
tvSeries: [ | ||
{ | ||
id: 71924, | ||
title: 'Království', | ||
year: 1994, | ||
url: 'https://www.csfd.cz/film/71924-kralovstvi/', | ||
type: 'seriál', | ||
colorRating: 'good', | ||
poster: 'https://image.pmgstatic.com/cache/resized/w60h85/files/images/film/posters/166/708/166708064_2da697.jpg', | ||
origins: ['Dánsko'], | ||
creators: [] | ||
} | ||
], | ||
users: [ | ||
@@ -386,4 +399,4 @@ { | ||
- [x] Users | ||
- [x] TV Series | ||
- [ ] Creators | ||
- [ ] TV Series | ||
- [x] Creators | ||
@@ -449,3 +462,3 @@ - [x] Bio | ||
Copyright © 2022 [Lukas Bartak](http://bartweb.cz) | ||
Copyright © 2020 – 2023 [Lukas Bartak](http://bartweb.cz) | ||
@@ -452,0 +465,0 @@ Proudly powered by nature 🗻, wind 💨, tea 🍵 and beer 🍺 ;) |
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
Network access
Supply chain riskThis module accesses the network.
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
63828
1155
466
2