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

Simple NPM library for scraping CSFD

  • 1.6.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
125
decreased by-4.58%
Maintainers
1
Weekly downloads
 
Created
Source

npm version Package License Build & Publish codecov

CSFD API 2021

Tiny NPM library for scraping csfd.cz

  • Browser + Node.js (SSR)
  • TypeScript 100%
  • ✅ Ready for CSFD 2021!

Scraper:

Install

via yarn

yarn add node-csfd-api

via npm

npm install node-csfd-api

Movie

Get info about this movie

import { csfd } from 'node-csfd-api';

csfd.movie(535121).then((movie) => console.log(movie));

Results

{
  id: 535121,
  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' ],
  colorRating: 'good',
  rating: 73,
  titlesOther: [
    { 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',
  creators: {
    directors: [
    {
      id: 87470,
      name: 'S. Craig Zahler',
      url: 'https://www.csfd.cz/tvurce/87470-s-craig-zahler/'
      }
    ],
    actors: [
      {
        id: 1,
        name: 'Mel Gibson',
        url: 'https://www.csfd.cz/tvurce/1-mel-gibson/'
      }
    ],
    basedOn: [],
    writers: [
      {
        id: 87470,
        name: 'S. Craig Zahler',
        url: 'https://www.csfd.cz/tvurce/87470-s-craig-zahler/'
      }
    ],
    music: [
      {
        id: 203209,
        name: 'Jeff Herriott',
        url: 'https://www.csfd.cz/tvurce/203209-jeff-herriott/'
      }
    ],
    producers: [
      {
        id: 320006,
        name: 'Sefton Fincham',
        url: 'https://www.csfd.cz/tvurce/320006-sefton-fincham/'
      }
    ]
  },
  vod: [
    {
      title: 'Voyo',
      url: 'https://voyo.nova.cz/filmy/4604-na-spatne-strane'
    },
    {
      title: 'DVD',
      url: 'https://filmy.heureka.cz/na-spatne-strane-dvd/#utm_source=csfd.cz&utm_medium=cooperation&utm_campaign=csfd_movies_feed'
    }
  ],
  tags: ['policie', 'zbraně', 'zloděj', 'město', 'sledování'],
  premieres: [
   {
      country: 'Česko',
      format: 'Na Blu-ray',
      date: '07.08.2019',
      company: 'Magic Box'
    },
    {
      country: 'USA',
      format: 'V kinech',
      date: '22.03.2019',
      company: 'Lionsgate US'
    }
  ]
}

Search movies and users

import { csfd } from 'node-csfd-api';

csfd.search('bart').then((search) => console.log(search));

Results

movies: [
  {
    id: 19653,
    title: 'Black Bart',
    year: '1975',
    url: 'https://www.csfd.cz/film/19653-black-bart/',
    type: 'TV film',
    colorRating: 'bad',
    poster: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7',
    origins: ['USA'],
    creators: {
      directors: [{
        id: 87470,
        name: 'S. Craig Zahler',
        url: 'https://www.csfd.cz/tvurce/87470-s-craig-zahler/'
      }],
      actors: [{
        id: 1,
        name: 'Mel Gibson',
        url: 'https://www.csfd.cz/tvurce/1-mel-gibson/'
      }]
    }
  }
],
users: [
  {
    id: 912,
    user: 'BART!',
    userRealName: 'Lukáš Barták',
    avatar: '//image.pmgstatic.com/cache/resized/w45h60/files/images/user/avatars/000/281/281554_1c0fef.jpg',
    url: 'https://www.csfd.cz/uzivatel/912-bart/'
  }
]

User Ratings

Last ratings (last page)

Get my last 50 ratings

import { csfd } from 'node-csfd-api';

csfd.userRatings('912-bart').then((ratings) => console.log(ratings));

All ratings (all pages)

Warning: Use it wisely. Can be detected and banned. Consider using it together with allPagesDelay attribute.

Get all of my ratings

import { csfd } from 'node-csfd-api';

csfd
  .userRatings('912-bart', {
    allPages: true, // Download all pages (one by one)
    allPageDelay: 2000 // Make delay 2000ms on each page request
  })
  .then((ratings) => console.log(ratings));

Results

[
  {
    title: 'David Attenborough: Život na naší planetě',
    year: 2020,
    type: 'film',
    url: 'https://www.csfd.cz/film/812944-david-attenborough-zivot-na-nasi-planete/',
    colorRating: 'good',
    userDate: '01.11.2020',
    userRating: 5
  },
  {
    title: 'Coronation',
    year: 2020,
    type: 'film',
    url: 'https://www.csfd.cz/film/912552-coronation/',
    colorRating: 'good',
    userDate: '28.10.2020',
    userRating: 4
  }
];

Options

OptionTypeDefaultDescription
includesOnlyCSFDFilmTypes[]nullIncluding only film types. eg. ['TV Seriál', 'koncert']
excludeCSFDFilmTypes[]nullExcluding film types eg. ['epizoda', 'série']
allPagesbooleanfalseGet all pages
allPagesDelaynumber0Delay on each page request. In milliseconds

Note: You can not use both parameters 'includesOnly' and 'excludes'. Parameter 'includesOnly' has a priority.

Used by

  • Dafilms web extension (code) – Parser for film ratings (web extension)
  • bartweb.czLast seen section (Firebase function)
  • KinoKlub – Mobile application for Aerofilms (native Adnroid + iOS application)

Roadmap

Scraping more pages

  • Movies
    • Titles
    • Years
    • Type
    • User rating
    • Color rating
    • Poster
    • Duration
    • Origins
    • Descriptions
    • Genres
    • VOD
    • Tags
    • Premieres
    • Creators
      • Directors
      • Writers
      • Cinematography
      • Music
      • Actors
      • BasedOn
      • Producers
      • Film editors
      • Costume designers
      • Production designers
    • Premieres
    • Related movies
    • Similar movies
    • All images
    • Reviews
    • OST
  • Search
    • Movies
    • Users
    • Creators
    • TV Series
  • Creators
    • Bio
    • Movies
  • User Ratings
    • Last ratings
    • All pages

Development

Developing and debugging library

yarn start

Run demo locally

You can find and modify it in ./demo.ts file

yarn demo

Development (notes for me)

Publish Stable

yarn release:patch
# yarn release:minor
# yarn release:major

Publish next channel

  1. Bump version -beta.0 in package.json
  2. yarn release:beta

Contribution

I welcome you to customize this according to your needs ;)

Pull requests for any improvements would be great!

Donation

If this project have helped you save time please consider making a donation for some 🍺 or 🍵 ;)

Privacy Policy

I DO NOT STORE ANY DATA. PERIOD.

I physically can't. I have nowhere to store it. I don't even have a server database to store it. So even if Justin Bieber asked nicely to see your data, I wouldn't have anything to show him.

That's why, with CSFD Api, what happens on your device stays on your device till disappear.

License

Copyright © 2021 Lukas Bartak

Proudly powered by nature 🗻, wind 💨, tea 🍵 and beer 🍺 ;)

All contents are licensed under the MIT license.

Keywords

FAQs

Package last updated on 09 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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