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 0.3.0 to 0.4.0

helpers/movie.helper.d.ts

1

fetchers/index.d.ts
export declare const fetchUserRatings: (user: string | number) => Promise<string>;
export declare const fetchMovie: (movie: string | number) => Promise<string>;

@@ -6,3 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.fetchUserRatings = void 0;
exports.fetchMovie = exports.fetchUserRatings = void 0;
const cross_fetch_1 = __importDefault(require("cross-fetch"));

@@ -15,1 +15,6 @@ const vars_1 = require("../vars");

};
exports.fetchMovie = async (movie) => {
const url = vars_1.movieUrl(movie);
const response = await cross_fetch_1.default(url);
return await response.text();
};

10

index.d.ts

@@ -0,7 +1,10 @@

import { CSFDMovie } from 'interfaces/movie.interface';
import { CSFDFilmTypes } from './interfaces/global';
import { CSFDUserRatings } from './interfaces/user-ratings';
import { UserRatingsScraper } from './services/user-ratings';
import { CSFDUserRatings } from './interfaces/user-ratings.interface';
import { MovieScraper } from './services/movie.service';
import { UserRatingsScraper } from './services/user-ratings.service';
export declare class Csfd {
private userRatingsService;
constructor(userRatingsService: UserRatingsScraper);
private movieService;
constructor(userRatingsService: UserRatingsScraper, movieService: MovieScraper);
userRatings(user: string | number, config?: {

@@ -11,3 +14,4 @@ includesOnly?: CSFDFilmTypes[];

}): Promise<CSFDUserRatings[]>;
movie(movie: string | number): Promise<CSFDMovie>;
}
export declare const csfd: Csfd;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.csfd = exports.Csfd = void 0;
const user_ratings_1 = require("./services/user-ratings");
const movie_service_1 = require("./services/movie.service");
const user_ratings_service_1 = require("./services/user-ratings.service");
class Csfd {
constructor(userRatingsService) {
constructor(userRatingsService, movieService) {
this.userRatingsService = userRatingsService;
this.movieService = movieService;
}

@@ -12,5 +14,9 @@ async userRatings(user, config) {

}
async movie(movie) {
return this.movieService.movie(movie);
}
}
exports.Csfd = Csfd;
const userRatingsScraper = new user_ratings_1.UserRatingsScraper();
exports.csfd = new Csfd(userRatingsScraper);
const movieScraper = new movie_service_1.MovieScraper();
const userRatingsScraper = new user_ratings_service_1.UserRatingsScraper();
exports.csfd = new Csfd(userRatingsScraper, movieScraper);
export interface CSFDScreening {
title: string;
year: number;
year: number | string;
url: string;

@@ -5,0 +5,0 @@ type: CSFDFilmTypes;

{
"name": "node-csfd-api",
"version": "0.3.0",
"version": "0.4.0",
"description": "Simple NPM library for scraping CSFD",

@@ -5,0 +5,0 @@ "main": "./index.js",

@@ -29,2 +29,72 @@ [![npm version](https://badge.fury.io/js/node-csfd-api.svg)](https://badge.fury.io/js/node-csfd-api)

### Movie
Get info about [this movie](https://www.csfd.cz/film/535121-na-spatne-strane/komentare/)
```javascript
import { csfd } from 'node-csfd-api';
csfd.movie('535121').then((movie) => console.log(movie));
```
#### Results
```javascript
{
title: 'Na špatné straně',
year: '2018',
descriptions: [
'Otupělý policejní veterán Ridgeman (Mel Gibson)...',
'Brett je policajt tesne ...'
],
genres: [ 'Krimi', 'Drama', 'Thriller' ],
type: 'film',
url: 'https://www.csfd.cz/film/535121',
origins: [ 'USA', 'Kanada' ],
overallRating: 3,
otherTitles: [
{ country: 'USA', title: 'Dragged Across Concrete' },
{ country: 'Kanada', title: 'Dragged Across Concrete' },
{ country: 'Slovensko', title: 'Na zlej strane' },
{ country: 'Austrálie', title: 'Dragged Across Concrete' },
{ country: 'Velká Británie', title: 'Dragged Across Concrete' }
],
poster: '//img.csfd.cz/files/images/film/posters/163/579/163579352_bf8737.jpg?h180',
directors: [
{
name: 'S. Craig Zahler',
url: 'https://www.csfd.cz/tvurce/87470-s-craig-zahler/'
}
],
actors: [
{
name: 'Mel Gibson',
url: 'https://www.csfd.cz/tvurce/1-mel-gibson/'
},
...
],
basedOn: [],
writers: [
{
name: 'S. Craig Zahler',
url: 'https://www.csfd.cz/tvurce/87470-s-craig-zahler/'
}
],
music: [
{
name: 'Jeff Herriott',
url: 'https://www.csfd.cz/tvurce/203209-jeff-herriott/'
},
...
],
producers: [
{
name: 'Sefton Fincham',
url: 'https://www.csfd.cz/tvurce/320006-sefton-fincham/'
},
...
]
}
```
### User Ratings

@@ -31,0 +101,0 @@

export declare const userRatingsUrl: (user: string | number) => string;
export declare const movieUrl: (movie: string | number) => string;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.userRatingsUrl = void 0;
exports.movieUrl = exports.userRatingsUrl = void 0;
exports.userRatingsUrl = (user) => `https://www.csfd.cz/uzivatel/${encodeURIComponent(user)}/hodnoceni/`;
exports.movieUrl = (movie) => `https://www.csfd.cz/film/${encodeURIComponent(movie)}`;
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