node-csfd-api
Advanced tools
Comparing version 1.7.0 to 1.8.0
@@ -0,4 +1,6 @@ | ||
import { CSFDCreator } from './interfaces/creator.interface'; | ||
import { CSFDMovie } from './interfaces/movie.interface'; | ||
import { CSFDSearch } from './interfaces/search.interface'; | ||
import { CSFDUserRatingConfig, CSFDUserRatings } from './interfaces/user-ratings.interface'; | ||
import { CreatorScraper } from './services/creator.service'; | ||
import { MovieScraper } from './services/movie.service'; | ||
@@ -10,8 +12,10 @@ import { SearchScraper } from './services/search.service'; | ||
private movieService; | ||
private creatorService; | ||
private searchService; | ||
constructor(userRatingsService: UserRatingsScraper, movieService: MovieScraper, searchService: SearchScraper); | ||
constructor(userRatingsService: UserRatingsScraper, movieService: MovieScraper, creatorService: CreatorScraper, searchService: SearchScraper); | ||
userRatings(user: string | number, config?: CSFDUserRatingConfig): Promise<CSFDUserRatings[]>; | ||
movie(movie: number): Promise<CSFDMovie>; | ||
creator(creator: number): Promise<CSFDCreator>; | ||
search(text: string): Promise<CSFDSearch>; | ||
} | ||
export declare const csfd: Csfd; |
10
index.js
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.csfd = exports.Csfd = void 0; | ||
const creator_service_1 = require("./services/creator.service"); | ||
const movie_service_1 = require("./services/movie.service"); | ||
@@ -8,5 +9,6 @@ const search_service_1 = require("./services/search.service"); | ||
class Csfd { | ||
constructor(userRatingsService, movieService, searchService) { | ||
constructor(userRatingsService, movieService, creatorService, searchService) { | ||
this.userRatingsService = userRatingsService; | ||
this.movieService = movieService; | ||
this.creatorService = creatorService; | ||
this.searchService = searchService; | ||
@@ -20,2 +22,5 @@ } | ||
} | ||
async creator(creator) { | ||
return this.creatorService.creator(+creator); | ||
} | ||
async search(text) { | ||
@@ -28,3 +33,4 @@ return this.searchService.search(text); | ||
const userRatingsScraper = new user_ratings_service_1.UserRatingsScraper(); | ||
const creatorScraper = new creator_service_1.CreatorScraper(); | ||
const searchScraper = new search_service_1.SearchScraper(); | ||
exports.csfd = new Csfd(userRatingsScraper, movieScraper, searchScraper); | ||
exports.csfd = new Csfd(userRatingsScraper, movieScraper, creatorScraper, searchScraper); |
{ | ||
"name": "node-csfd-api", | ||
"version": "1.7.0", | ||
"version": "1.8.0", | ||
"description": "Simple NPM library for scraping CSFD", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -36,3 +36,3 @@ [![npm version](https://badge.fury.io/js/node-csfd-api.svg)](https://badge.fury.io/js/node-csfd-api) | ||
Get info about [this movie](https://www.csfd.cz/film/535121-na-spatne-strane/komentare/) | ||
Get info about [this movie](https://www.csfd.cz/film/535121-na-spatne-strane/komentare/) _(id: 535121)_ | ||
@@ -184,2 +184,89 @@ ```javascript | ||
## Creators | ||
> Search creators and filmography | ||
```javascript | ||
import { csfd } from 'node-csfd-api'; | ||
csfd.creator(2120).then((creator) => console.log(creator)); | ||
``` | ||
### Results | ||
```javascript | ||
{ | ||
id: 2120, | ||
name: 'Quentin Tarantino', | ||
birthday: '27.03.1963', | ||
birthplace: 'Knoxville, Tennessee, USA', | ||
photo: '//image.pmgstatic.com/cache/resized/w100h132crop/files/images/creator/photos/164/515/164515525_b98f8a.jpg', | ||
age: 58, | ||
bio: 'Quentin Tarantino se narodil 27. března roku 1963 v americkém Knoxville teprve šestnáctileté Connie Tarantinové. Své jméno Quentin dostal podle matčiny oblíbené televizní postavy Quinta ze seriálu "Gunsmoke". Quentinův otec byl jistý Tony Tarantino, který rodinu opustil když byl Quentin ještě malinký. Jeho dětství a dospívání ovlivnily nejen filmy, ale pop kultura obecně. Televizní seriály, komiksy, populární hudba, to vše jako mladý hltal ve velkém a stále neměl…', | ||
films: [ | ||
{ | ||
id: 527699, | ||
title: 'Tenkrát v Hollywoodu', | ||
year: 2019, | ||
colorRating: 'good' | ||
}, | ||
{ | ||
id: 362228, | ||
title: 'Osm hrozných', | ||
year: 2015, | ||
colorRating: 'good' | ||
}, | ||
{ | ||
id: 294824, | ||
title: 'Nespoutaný Django', | ||
year: 2012, | ||
colorRating: 'good' | ||
}, | ||
{ | ||
id: 117077, | ||
title: 'Hanebný pancharti', | ||
year: 2009, | ||
colorRating: 'good' | ||
}, | ||
{ | ||
id: 229384, | ||
title: 'Grindhouse: Auto zabiják', | ||
year: 2007, | ||
colorRating: 'average' | ||
}, | ||
{ | ||
id: 178904, | ||
title: 'Sin City - město hříchu', | ||
year: 2005, | ||
colorRating: 'good' | ||
}, | ||
{ | ||
id: 136304, | ||
title: 'Kill Bill 2', | ||
year: 2004, | ||
colorRating: 'good' | ||
}, | ||
{ id: 43483, title: 'Kill Bill', year: 2003, colorRating: 'good' }, | ||
{ | ||
id: 8850, | ||
title: 'Jackie Brown', | ||
year: 1997, | ||
colorRating: 'good' | ||
}, | ||
{ | ||
id: 7743, | ||
title: 'Čtyři pokoje', | ||
year: 1995, | ||
colorRating: 'good' | ||
}, | ||
{ | ||
id: 8852, | ||
title: 'Pulp Fiction: Historky z podsvětí', | ||
year: 1994, | ||
colorRating: 'good' | ||
} | ||
] | ||
} | ||
``` | ||
## User Ratings | ||
@@ -296,5 +383,5 @@ | ||
- [ ] TV Series | ||
- [ ] Creators | ||
- [ ] Bio | ||
- [ ] Movies | ||
- [x] Creators | ||
- [x] Bio | ||
- [x] Movies (TODO categories) | ||
- [x] User Ratings | ||
@@ -301,0 +388,0 @@ - [x] Last ratings |
export declare const userRatingsUrl: (user: string | number, page?: number) => string; | ||
export declare const movieUrl: (movie: number) => string; | ||
export declare const creatorUrl: (creator: number | string) => string; | ||
export declare const searchUrl: (text: string) => string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.searchUrl = exports.movieUrl = exports.userRatingsUrl = void 0; | ||
exports.searchUrl = exports.creatorUrl = exports.movieUrl = exports.userRatingsUrl = void 0; | ||
const userRatingsUrl = (user, page) => `https://www.csfd.cz/uzivatel/${encodeURIComponent(user)}/hodnoceni/${page ? '?page=' + page : ''}`; | ||
@@ -8,3 +8,5 @@ exports.userRatingsUrl = userRatingsUrl; | ||
exports.movieUrl = movieUrl; | ||
const creatorUrl = (creator) => `https://www.csfd.cz/tvurce/${encodeURIComponent(creator)}`; | ||
exports.creatorUrl = creatorUrl; | ||
const searchUrl = (text) => `https://www.csfd.cz/hledat/?q=${encodeURIComponent(text)}`; | ||
exports.searchUrl = searchUrl; |
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
56699
38
1026
446