node-csfd-api
Advanced tools
Comparing version 3.0.0-next.1 to 3.0.0-next.2
@@ -40,11 +40,22 @@ "use strict"; | ||
const parsePeople = (el, type) => { | ||
const people = el.querySelectorAll(`.article-content .${type} a`); | ||
return people.map((person) => { | ||
return { | ||
id: (0, global_helper_1.parseIdFromUrl)(person.attributes.href), | ||
name: person.innerText.trim(), | ||
url: `https://www.csfd.cz${person.attributes.href}` | ||
}; | ||
}); | ||
let who; | ||
if (type === 'directors') | ||
who = 'Režie:'; | ||
if (type === 'actors') | ||
who = 'Hrají:'; | ||
const peopleNode = Array.from(el && el.querySelectorAll('.article-content p')).find((el) => el.textContent.includes(who)); | ||
if (peopleNode) { | ||
const people = Array.from(peopleNode.querySelectorAll('a')); | ||
return people.map((person) => { | ||
return { | ||
id: (0, global_helper_1.parseIdFromUrl)(person.attributes.href), | ||
name: person.innerText.trim(), | ||
url: `https://www.csfd.cz${person.attributes.href}` | ||
}; | ||
}); | ||
} | ||
else { | ||
return []; | ||
} | ||
}; | ||
exports.parsePeople = parsePeople; |
@@ -45,3 +45,3 @@ "use strict"; | ||
creators: { | ||
directors: (0, search_helper_1.parsePeople)(m, 'director'), | ||
directors: (0, search_helper_1.parsePeople)(m, 'directors'), | ||
actors: (0, search_helper_1.parsePeople)(m, 'actors') | ||
@@ -48,0 +48,0 @@ } |
@@ -30,10 +30,21 @@ import { addProtocol, parseColor, parseIdFromUrl } from './global.helper'; | ||
export const parsePeople = (el, type) => { | ||
const people = el.querySelectorAll(`.article-content .${type} a`); | ||
return people.map((person) => { | ||
return { | ||
id: parseIdFromUrl(person.attributes.href), | ||
name: person.innerText.trim(), | ||
url: `https://www.csfd.cz${person.attributes.href}` | ||
}; | ||
}); | ||
let who; | ||
if (type === 'directors') | ||
who = 'Režie:'; | ||
if (type === 'actors') | ||
who = 'Hrají:'; | ||
const peopleNode = Array.from(el && el.querySelectorAll('.article-content p')).find((el) => el.textContent.includes(who)); | ||
if (peopleNode) { | ||
const people = Array.from(peopleNode.querySelectorAll('a')); | ||
return people.map((person) => { | ||
return { | ||
id: parseIdFromUrl(person.attributes.href), | ||
name: person.innerText.trim(), | ||
url: `https://www.csfd.cz${person.attributes.href}` | ||
}; | ||
}); | ||
} | ||
else { | ||
return []; | ||
} | ||
}; |
@@ -42,3 +42,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
creators: { | ||
directors: parsePeople(m, 'director'), | ||
directors: parsePeople(m, 'directors'), | ||
actors: parsePeople(m, 'actors') | ||
@@ -45,0 +45,0 @@ } |
{ | ||
"name": "node-csfd-api", | ||
"version": "3.0.0-next.1", | ||
"version": "3.0.0-next.2", | ||
"description": "ČSFD API in JavaScript. Amazing NPM library for scrapping csfd.cz :)", | ||
@@ -27,4 +27,3 @@ "main": "./cjs/index.js", | ||
"dependencies": { | ||
"cross-fetch": "^3.1.5", | ||
"node-html-parser": "^6.1.1" | ||
"node-html-parser": "^6.1.4" | ||
}, | ||
@@ -31,0 +30,0 @@ "repository": { |
@@ -6,4 +6,4 @@ import { HTMLElement } from 'node-html-parser'; | ||
export declare const getId: (url: string) => number; | ||
export declare const getName: (el: HTMLElement) => string; | ||
export declare const getBirthdayInfo: (el: HTMLElement) => { | ||
export declare const getName: (el: HTMLElement | null) => string; | ||
export declare const getBirthdayInfo: (el: HTMLElement | null) => { | ||
birthday: string; | ||
@@ -13,7 +13,7 @@ age: number; | ||
}; | ||
export declare const getBio: (el: HTMLElement) => string; | ||
export declare const getPhoto: (el: HTMLElement) => string; | ||
export declare const getBio: (el: HTMLElement | null) => string; | ||
export declare const getPhoto: (el: HTMLElement | null) => string; | ||
export declare const parseBirthday: (text: string) => any; | ||
export declare const parseAge: (text: string) => any; | ||
export declare const parseBirthPlace: (text: string) => any; | ||
export declare const getFilms: (el: HTMLElement) => CSFDCreatorScreening[]; | ||
export declare const getFilms: (el: HTMLElement | null) => CSFDCreatorScreening[]; |
@@ -14,5 +14,5 @@ import { HTMLElement } from 'node-html-parser'; | ||
export declare const getTitlesOther: (el: HTMLElement) => CSFDTitlesOther[]; | ||
export declare const getPoster: (el: HTMLElement) => string; | ||
export declare const getRandomPhoto: (el: HTMLElement) => string; | ||
export declare const getTrivia: (el: HTMLElement) => string[]; | ||
export declare const getPoster: (el: HTMLElement | null) => string; | ||
export declare const getRandomPhoto: (el: HTMLElement | null) => string; | ||
export declare const getTrivia: (el: HTMLElement | null) => string[]; | ||
export declare const getDescriptions: (el: HTMLElement) => string[]; | ||
@@ -22,3 +22,3 @@ export declare const parsePeople: (el: HTMLElement) => CSFDCreator[]; | ||
export declare const getType: (el: HTMLElement) => string; | ||
export declare const getVods: (el: HTMLElement) => CSFDVod[]; | ||
export declare const getVods: (el: HTMLElement | null) => CSFDVod[]; | ||
export declare const getBoxContent: (el: HTMLElement, box: string) => HTMLElement; | ||
@@ -25,0 +25,0 @@ export declare const getBoxMovies: (el: HTMLElement, boxName: CSFDBoxContent) => CSFDMovieListItem[]; |
@@ -11,2 +11,2 @@ import { HTMLElement } from 'node-html-parser'; | ||
export declare const getOrigins: (el: HTMLElement) => string[]; | ||
export declare const parsePeople: (el: HTMLElement, type: 'director' | 'actors') => CSFDCreator[]; | ||
export declare const parsePeople: (el: HTMLElement, type: 'directors' | 'actors') => CSFDCreator[]; |
@@ -12,2 +12,2 @@ import { CSFDScreening } from './global'; | ||
} | ||
export declare type CSFDCreatorScreening = Omit<CSFDScreening, 'url' | 'type'>; | ||
export type CSFDCreatorScreening = Omit<CSFDScreening, 'url' | 'type'>; |
@@ -20,4 +20,4 @@ export interface CSFDScreening { | ||
} | ||
export declare type CSFDColorRating = 'bad' | 'average' | 'good' | 'unknown'; | ||
export declare type CSFDStars = 0 | 1 | 2 | 3 | 4 | 5; | ||
export declare type CSFDFilmTypes = 'film' | 'TV film' | 'pořad' | 'seriál' | 'divadelní záznam' | 'koncert' | 'série' | 'studentský film' | 'amatérský film' | 'hudební videoklip' | 'epizoda'; | ||
export type CSFDColorRating = 'bad' | 'average' | 'good' | 'unknown'; | ||
export type CSFDStars = 0 | 1 | 2 | 3 | 4 | 5; | ||
export type CSFDFilmTypes = 'film' | 'TV film' | 'pořad' | 'seriál' | 'divadelní záznam' | 'koncert' | 'série' | 'studentský film' | 'amatérský film' | 'hudební videoklip' | 'epizoda'; |
@@ -20,4 +20,5 @@ import { CSFDScreening } from './global'; | ||
} | ||
export type CSFDVodService = 'Netflix' | 'hbogo' | 'Prime Video' | 'Apple TV+' | 'iTunes' | 'KVIFF.TV' | 'Edisonline' | 'o2tv' | 'SledovaniTV' | 'Starmax' | 'DAFilms' | 'FILMY ČESKY A ZADARMO' | 'Youtube Česká filmová klasika' | 'VAPET' | 'VOREL FILM' | 'ivysilani' | 'Google Play' | 'Voyo' | 'DVD'; | ||
export interface CSFDVod { | ||
title: 'Netflix' | 'hbogo' | 'Prime Video' | 'Apple TV+' | 'iTunes' | 'Aerovod' | 'Edisonline' | 'o2tv' | 'SledovaniTV' | 'Starmax' | 'DAFilms' | 'FILMY ČESKY A ZADARMO' | 'Youtube Česká filmová klasika' | 'VAPET' | 'VOREL FILM' | 'ivysilani' | 'Google Play' | 'Voyo' | string; | ||
title: CSFDVodService; | ||
url: string; | ||
@@ -58,4 +59,4 @@ } | ||
} | ||
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ý'; | ||
export declare type CSFDCreatorGroups = 'Režie' | 'Scénář' | 'Kamera' | 'Hudba' | 'Hrají' | 'Produkce' | 'Střih' | 'Předloha' | 'Scénografie' | 'Kostýmy'; | ||
export 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ý'; | ||
export type CSFDCreatorGroups = 'Režie' | 'Scénář' | 'Kamera' | 'Hudba' | 'Hrají' | 'Produkce' | 'Střih' | 'Předloha' | 'Scénografie' | 'Kostýmy'; | ||
export interface CSFDPremiere { | ||
@@ -67,2 +68,2 @@ country: string; | ||
} | ||
export declare type CSFDBoxContent = 'Související' | 'Podobné'; | ||
export type CSFDBoxContent = 'Související' | 'Podobné'; |
@@ -18,2 +18,2 @@ import { CSFDFilmTypes, CSFDScreening, CSFDStars } from './global'; | ||
} | ||
export declare type Colors = 'lightgrey' | 'blue' | 'red' | 'grey'; | ||
export type Colors = 'lightgrey' | 'blue' | 'red' | 'grey'; |
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
102042
1
2033
- Removedcross-fetch@^3.1.5
- Removedcross-fetch@3.1.8(transitive)
- Removednode-fetch@2.7.0(transitive)
- Removedtr46@0.0.3(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)
Updatednode-html-parser@^6.1.4