node-csfd-api-racintom 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/.editorconfig +13 -0
  2. package/.eslintrc.json +33 -0
  3. package/.gitattributes +2 -0
  4. package/.github/FUNDING.yml +8 -0
  5. package/.github/pull_request_template.md +19 -0
  6. package/.github/workflows/main.yml +40 -0
  7. package/.github/workflows/publish.yml +73 -0
  8. package/.github/workflows/test.yml +43 -0
  9. package/.husky/pre-commit +1 -0
  10. package/.idea/codeStyles/Project.xml +72 -0
  11. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  12. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  13. package/.idea/misc.xml +6 -0
  14. package/.idea/modules.xml +8 -0
  15. package/.idea/node-csfd-api.iml +9 -0
  16. package/.idea/prettier.xml +6 -0
  17. package/.idea/vcs.xml +7 -0
  18. package/.nvmrc +1 -0
  19. package/.prettierignore +8 -0
  20. package/.prettierrc +10 -0
  21. package/.vscode/settings.json +16 -0
  22. package/Dockerfile +19 -0
  23. package/README.md +510 -0
  24. package/demo.ts +35 -0
  25. package/eslint.config.mjs +55 -0
  26. package/package.json +86 -0
  27. package/server.ts +66 -0
  28. package/src/fetchers/fetch.polyfill.ts +7 -0
  29. package/src/fetchers/index.ts +25 -0
  30. package/src/helpers/creator.helper.ts +95 -0
  31. package/src/helpers/global.helper.ts +70 -0
  32. package/src/helpers/movie.helper.ts +276 -0
  33. package/src/helpers/search-user.helper.ts +19 -0
  34. package/src/helpers/search.helper.ts +66 -0
  35. package/src/helpers/user-ratings.helper.ts +62 -0
  36. package/src/index.ts +42 -0
  37. package/src/interfaces/creator.interface.ts +14 -0
  38. package/src/interfaces/global.ts +36 -0
  39. package/src/interfaces/movie.interface.ts +157 -0
  40. package/src/interfaces/search.interface.ts +32 -0
  41. package/src/interfaces/user-ratings.interface.ts +21 -0
  42. package/src/services/creator.service.ts +34 -0
  43. package/src/services/movie.service.ts +89 -0
  44. package/src/services/search.service.ts +101 -0
  45. package/src/services/user-ratings.service.ts +106 -0
  46. package/src/vars.ts +13 -0
  47. package/tests/creator.test.ts +182 -0
  48. package/tests/fetchers.test.ts +109 -0
  49. package/tests/global.test.ts +35 -0
  50. package/tests/helpers.test.ts +59 -0
  51. package/tests/mocks/creator-actor.html.ts +2244 -0
  52. package/tests/mocks/creator-composer-empty.html.ts +683 -0
  53. package/tests/mocks/creator-director.html.ts +3407 -0
  54. package/tests/mocks/movie1.html.ts +1430 -0
  55. package/tests/mocks/movie2.html.ts +740 -0
  56. package/tests/mocks/movie3.html.ts +1843 -0
  57. package/tests/mocks/movie4.html.ts +1568 -0
  58. package/tests/mocks/search.html.ts +838 -0
  59. package/tests/mocks/series1.html.ts +1540 -0
  60. package/tests/mocks/userRatings.html.ts +1354 -0
  61. package/tests/movie.test.ts +606 -0
  62. package/tests/search.test.ts +379 -0
  63. package/tests/services.test.ts +106 -0
  64. package/tests/user-ratings.test.ts +142 -0
  65. package/tests/vars.test.ts +34 -0
  66. package/tsconfig.json +23 -0
  67. package/vitest.config.mts +10 -0
package/README.md ADDED
@@ -0,0 +1,510 @@
1
+ [![npm version](https://badge.fury.io/js/node-csfd-api.svg)](https://badge.fury.io/js/node-csfd-api)
2
+ [![Package License](https://img.shields.io/npm/l/node-csfd-api.svg)](https://www.npmjs.com/node-csfd-api)
3
+ [![Build & Publish](https://github.com/bartholomej/node-csfd-api/workflows/Publish/badge.svg)](https://github.com/bartholomej/node-csfd-api/actions)
4
+ [![codecov](https://codecov.io/gh/bartholomej/node-csfd-api/branch/master/graph/badge.svg?token=YQH9UoVrGP)](https://codecov.io/gh/bartholomej/node-csfd-api)
5
+
6
+ # CSFD API 🎥 2025
7
+
8
+ > JavaScript NPM library for scraping **Czech Movie Database (csfd.cz)**
9
+ >
10
+ > - JavaScript / TypeScript
11
+ > - Browser + Node.js (SSR)
12
+ > - Tested (~100% Code coverage)
13
+ > - ✅ Ready for new ČSFD 2025!
14
+ > - You can use in:
15
+ > - Docker – [_How to do it?_](#-docker)
16
+ > - Firebase function
17
+ > - AWS λ (lambda function)
18
+ > - CloudFlare Worker
19
+ > - Chrome extension
20
+ > - React native app
21
+ > - Browsers (Pay attention to CORS)
22
+
23
+ ## 🗜️ Install
24
+
25
+ ```bash
26
+ npm install node-csfd-api
27
+ # yarn add node-csfd-api
28
+ ```
29
+
30
+ ## 🛠️ Usage and examples
31
+
32
+ - [Movies and TV Series](#Movie)
33
+ - [User Ratings](#User-Ratings)
34
+ - [Search](#Search)
35
+ - [Creators](#Creators)
36
+
37
+ ### Movie
38
+
39
+ > Get info about [this movie](https://www.csfd.cz/film/535121-na-spatne-strane/komentare/) _(id: 535121)_
40
+
41
+ ```javascript
42
+ import { csfd } from 'node-csfd-api';
43
+
44
+ csfd.movie(535121).then((movie) => console.log(movie));
45
+ ```
46
+
47
+ <details>
48
+ <summary>Click here to see full result example</summary>
49
+
50
+ ```javascript
51
+ {
52
+ id: 535121,
53
+ title: 'Na špatné straně',
54
+ year: '2018',
55
+ descriptions: [
56
+ 'Otupělý policejní veterán Ridgeman (Mel Gibson)...',
57
+ 'Brett je policajt tesne ...'
58
+ ],
59
+ genres: [ 'Krimi', 'Drama', 'Thriller' ],
60
+ type: 'film',
61
+ url: 'https://www.csfd.cz/film/535121',
62
+ origins: [ 'USA', 'Kanada' ],
63
+ colorRating: 'good',
64
+ rating: 73,
65
+ ratingCount: 6654,
66
+ photo: '//image.pmgstatic.com/cache/resized/w1326/files/images/film/photos/162/980/162980090_bbffbb.jpg',
67
+ trivia: ['Když Henry (Tory Kittles) se svým mladším bratrem...', 'Ve filmu se střídají...'],
68
+ titlesOther: [
69
+ { country: 'USA', title: 'Dragged Across Concrete' },
70
+ { country: 'Kanada', title: 'Dragged Across Concrete' },
71
+ { country: 'Slovensko', title: 'Na zlej strane' },
72
+ { country: 'Austrálie', title: 'Dragged Across Concrete' },
73
+ { country: 'Velká Británie', title: 'Dragged Across Concrete' }
74
+ ],
75
+ poster: 'https://image.pmgstatic.com/cache/resized/w1080/files/images/film/posters/163/579/163579352_bf8737.jpg',
76
+ creators: {
77
+ directors: [
78
+ {
79
+ id: 87470,
80
+ name: 'S. Craig Zahler',
81
+ url: 'https://www.csfd.cz/tvurce/87470-s-craig-zahler/'
82
+ }
83
+ ],
84
+ actors: [
85
+ {
86
+ id: 1,
87
+ name: 'Mel Gibson',
88
+ url: 'https://www.csfd.cz/tvurce/1-mel-gibson/'
89
+ }
90
+ ],
91
+ basedOn: [],
92
+ writers: [
93
+ {
94
+ id: 87470,
95
+ name: 'S. Craig Zahler',
96
+ url: 'https://www.csfd.cz/tvurce/87470-s-craig-zahler/'
97
+ }
98
+ ],
99
+ music: [
100
+ {
101
+ id: 203209,
102
+ name: 'Jeff Herriott',
103
+ url: 'https://www.csfd.cz/tvurce/203209-jeff-herriott/'
104
+ }
105
+ ],
106
+ producers: [
107
+ {
108
+ id: 320006,
109
+ name: 'Sefton Fincham',
110
+ url: 'https://www.csfd.cz/tvurce/320006-sefton-fincham/'
111
+ }
112
+ ]
113
+ },
114
+ vod: [
115
+ {
116
+ title: 'Voyo',
117
+ url: 'https://voyo.nova.cz/filmy/4604-na-spatne-strane'
118
+ },
119
+ {
120
+ title: 'DVD',
121
+ url: 'https://filmy.heureka.cz/na-spatne-strane-dvd/#utm_source=csfd.cz&utm_medium=cooperation&utm_campaign=csfd_movies_feed'
122
+ }
123
+ ],
124
+ tags: ['policie', 'zbraně', 'zloděj', 'město', 'sledování'],
125
+ premieres: [
126
+ {
127
+ country: 'Česko',
128
+ format: 'Na Blu-ray',
129
+ date: '07.08.2019',
130
+ company: 'Magic Box'
131
+ },
132
+ {
133
+ country: 'USA',
134
+ format: 'V kinech',
135
+ date: '22.03.2019',
136
+ company: 'Lionsgate US'
137
+ }
138
+ ]
139
+ }
140
+ ```
141
+ </details>
142
+
143
+ ### Search
144
+
145
+ > Search movies, users and TV series
146
+
147
+ ```javascript
148
+ import { csfd } from 'node-csfd-api';
149
+
150
+ csfd.search('bart').then((search) => console.log(search));
151
+ ```
152
+
153
+ <details>
154
+ <summary>Click here to see full result example</summary>
155
+
156
+ ```javascript
157
+ [
158
+ {
159
+ id: 19653,
160
+ title: 'Black Bart',
161
+ year: '1975',
162
+ url: 'https://www.csfd.cz/film/19653-black-bart/',
163
+ type: 'TV film',
164
+ colorRating: 'bad',
165
+ poster: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7',
166
+ origins: ['USA'],
167
+ creators: {
168
+ directors: [{
169
+ id: 87470,
170
+ name: 'S. Craig Zahler',
171
+ url: 'https://www.csfd.cz/tvurce/87470-s-craig-zahler/'
172
+ }],
173
+ actors: [{
174
+ id: 1,
175
+ name: 'Mel Gibson',
176
+ url: 'https://www.csfd.cz/tvurce/1-mel-gibson/'
177
+ }]
178
+ }
179
+ }
180
+ ],
181
+ tvSeries: [
182
+ {
183
+ id: 71924,
184
+ title: 'Království',
185
+ year: 1994,
186
+ url: 'https://www.csfd.cz/film/71924-kralovstvi/',
187
+ type: 'seriál',
188
+ colorRating: 'good',
189
+ poster: 'https://image.pmgstatic.com/cache/resized/w60h85/files/images/film/posters/166/708/166708064_2da697.jpg',
190
+ origins: ['Dánsko'],
191
+ creators: []
192
+ }
193
+ ],
194
+ users: [
195
+ {
196
+ id: 912,
197
+ user: 'BART!',
198
+ userRealName: 'Lukáš Barták',
199
+ avatar: 'https://image.pmgstatic.com/cache/resized/w45h60/files/images/user/avatars/000/281/281554_1c0fef.jpg',
200
+ url: 'https://www.csfd.cz/uzivatel/912-bart/'
201
+ }
202
+ ]
203
+ ```
204
+
205
+ </details>
206
+
207
+ ### Creators
208
+
209
+ > Get creator info + filmography
210
+
211
+ ```javascript
212
+ import { csfd } from 'node-csfd-api';
213
+
214
+ csfd.creator(2120).then((creator) => console.log(creator));
215
+ ```
216
+
217
+ <details>
218
+ <summary>Click here to see full result example</summary>
219
+
220
+ ```javascript
221
+ {
222
+ id: 2120,
223
+ name: 'Quentin Tarantino',
224
+ birthday: '27.03.1963',
225
+ birthplace: 'Knoxville, Tennessee, USA',
226
+ photo: 'https://image.pmgstatic.com/cache/resized/w100h132crop/files/images/creator/photos/164/515/164515525_b98f8a.jpg',
227
+ age: 58,
228
+ 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…',
229
+ films: [
230
+ {
231
+ id: 527699,
232
+ title: 'Tenkrát v Hollywoodu',
233
+ year: 2019,
234
+ colorRating: 'good'
235
+ },
236
+ {
237
+ id: 362228,
238
+ title: 'Osm hrozných',
239
+ year: 2015,
240
+ colorRating: 'good'
241
+ },
242
+ {
243
+ id: 294824,
244
+ title: 'Nespoutaný Django',
245
+ year: 2012,
246
+ colorRating: 'good'
247
+ },
248
+ {
249
+ id: 117077,
250
+ title: 'Hanebný pancharti',
251
+ year: 2009,
252
+ colorRating: 'good'
253
+ },
254
+ {
255
+ id: 229384,
256
+ title: 'Grindhouse: Auto zabiják',
257
+ year: 2007,
258
+ colorRating: 'average'
259
+ },
260
+ {
261
+ id: 178904,
262
+ title: 'Sin City - město hříchu',
263
+ year: 2005,
264
+ colorRating: 'good'
265
+ },
266
+ {
267
+ id: 136304,
268
+ title: 'Kill Bill 2',
269
+ year: 2004,
270
+ colorRating: 'good'
271
+ },
272
+ { id: 43483, title: 'Kill Bill', year: 2003, colorRating: 'good' },
273
+ {
274
+ id: 8850,
275
+ title: 'Jackie Brown',
276
+ year: 1997,
277
+ colorRating: 'good'
278
+ },
279
+ {
280
+ id: 7743,
281
+ title: 'Čtyři pokoje',
282
+ year: 1995,
283
+ colorRating: 'good'
284
+ },
285
+ {
286
+ id: 8852,
287
+ title: 'Pulp Fiction: Historky z podsvětí',
288
+ year: 1994,
289
+ colorRating: 'good'
290
+ }
291
+ ]
292
+ }
293
+ ```
294
+
295
+ </details>
296
+
297
+ ### User Ratings
298
+
299
+ #### Last ratings (last page)
300
+
301
+ Get [my last 50 ratings](https://www.csfd.cz/uzivatel/912-bart/hodnoceni/)
302
+
303
+ ```javascript
304
+ import { csfd } from 'node-csfd-api';
305
+
306
+ csfd.userRatings('912-bart').then((ratings) => console.log(ratings));
307
+ ```
308
+
309
+ #### All ratings (all pages)
310
+
311
+ > Warning: Use it wisely. Can be detected and banned. Consider using it together with `allPagesDelay` attribute.
312
+
313
+ Get [all of my ratings](https://www.csfd.cz/uzivatel/912-bart/hodnoceni/)
314
+
315
+ ```javascript
316
+ import { csfd } from 'node-csfd-api';
317
+
318
+ csfd
319
+ .userRatings('912-bart', {
320
+ allPages: true, // Download all pages (one by one)
321
+ allPageDelay: 2000 // Make delay 2000ms on each page request
322
+ })
323
+ .then((ratings) => console.log(ratings));
324
+ ```
325
+
326
+ <details>
327
+ <summary>Click here to see full result example</summary>
328
+
329
+ ```javascript
330
+ [
331
+ {
332
+ title: 'David Attenborough: Život na naší planetě',
333
+ year: 2020,
334
+ type: 'film',
335
+ url: 'https://www.csfd.cz/film/812944-david-attenborough-zivot-na-nasi-planete/',
336
+ colorRating: 'good',
337
+ userDate: '01.11.2020',
338
+ userRating: 5
339
+ },
340
+ {
341
+ title: 'Coronation',
342
+ year: 2020,
343
+ type: 'film',
344
+ url: 'https://www.csfd.cz/film/912552-coronation/',
345
+ colorRating: 'good',
346
+ userDate: '28.10.2020',
347
+ userRating: 4
348
+ }
349
+ ];
350
+ ```
351
+
352
+ </details>
353
+
354
+ #### Options for user ratings
355
+
356
+ | Option | Type | Default | Description |
357
+ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ------- | ------------------------------------------------------ |
358
+ | **includesOnly** | [CSFDFilmTypes[]](https://github.com/bartholomej/node-csfd-api/blob/8fa5f9cbc7e7f2b62b0bd2c2b5a24c9a63444f6a/src/interfaces/global.ts#L25) | null | Including only film types. eg. `['seriál', 'koncert']` |
359
+ | **exclude** | [CSFDFilmTypes[]](https://github.com/bartholomej/node-csfd-api/blob/8fa5f9cbc7e7f2b62b0bd2c2b5a24c9a63444f6a/src/interfaces/global.ts#L25) | null | Excluding film types eg. `['epizoda', 'série']` |
360
+ | **allPages** | boolean | false | Get all pages |
361
+ | **allPagesDelay** | number | 0 | Delay on each page request. In milliseconds |
362
+
363
+ _Note: You can not use both parameters `includesOnly` and `excludes`. Parameter `includesOnly` has a priority._
364
+
365
+ ## 📦 Docker
366
+
367
+ You can use this library in Docker.
368
+
369
+ We have [prepared a Docker image](https://hub.docker.com/r/bartholomej/node-csfd-api) for you.
370
+
371
+ ### Prebuilt image
372
+
373
+ ```bash
374
+ docker pull bartholomej/node-csfd-api
375
+ ```
376
+
377
+ ### Build & run your own image
378
+
379
+ > Build image
380
+
381
+ ```bash
382
+ docker build -t node-csfd-api .
383
+ ```
384
+
385
+ > Run image on port 3000
386
+
387
+ ```bash
388
+ docker run -p 3000:3000 node-csfd-api
389
+ ```
390
+
391
+ > Open http://localhost:3000
392
+
393
+ ### API endpoints
394
+
395
+ > Some examples
396
+
397
+ - `/movie/535121`
398
+ - `/search/quentin+tarantino`
399
+ - `/creator/2120`
400
+ - `/user-ratings/912-bart`
401
+
402
+ ## 🧑‍💻 Used by
403
+
404
+ ### Web extensions
405
+
406
+ - [Netflix: chrome extension](https://chrome.google.com/webstore/detail/netflix-csfd/eomgekccbddnlpmehgdjmlphndjgnlni) ([code](https://github.com/bartholomej/netflix-csfd-ext))
407
+ - [Dafilms: chrome extension](https://chrome.google.com/webstore/detail/dafilms/hgcgneddmgflnbmhkjnefiobjgobbmdm) ([code](https://github.com/bartholomej/dafilms-ext))
408
+ - [Kviff.tv: chrome extension](https://chrome.google.com/webstore/detail/kvifftv-%20-csfd/ihpngekoejodiligajlppbeedofhnmfm) ([code](https://github.com/bartholomej/kviff-ext))
409
+
410
+ ### Web applications
411
+
412
+ - [bartweb.cz](https://bartweb.cz) – **Last seen** section (**Firebase function**)
413
+
414
+ ### Mobile applications
415
+
416
+ - [KinoKlub](https://play.google.com/store/apps/details?id=com.aquasoup) – Mobile application for AeroFilms (React Native: Android + iOS application)
417
+
418
+ ## 🔮 Roadmap
419
+
420
+ ### Scraping more pages
421
+
422
+ - [ ] Movies
423
+ - [x] Titles
424
+ - [x] Years
425
+ - [x] Type
426
+ - [x] User rating
427
+ - [x] Color rating
428
+ - [x] Poster
429
+ - [x] Duration
430
+ - [x] Origins
431
+ - [x] Descriptions
432
+ - [x] Genres
433
+ - [x] VOD
434
+ - [x] Tags
435
+ - [x] Premieres
436
+ - [x] Creators
437
+ - [x] Directors
438
+ - [x] Writers
439
+ - [x] Cinematography
440
+ - [x] Music
441
+ - [x] Actors
442
+ - [x] BasedOn
443
+ - [x] Producers
444
+ - [x] Film editors
445
+ - [x] Costume designers
446
+ - [x] Production designers
447
+ - [x] Premieres
448
+ - [x] Related movies
449
+ - [x] Similar movies
450
+ - [x] Trivia
451
+ - [x] Photo from movie (random)
452
+ - [ ] Reviews
453
+ - [ ] OST
454
+ - [ ] Search
455
+ - [x] Movies
456
+ - [x] Users
457
+ - [x] TV Series
458
+ - [ ] Creators
459
+ - [x] Creators
460
+ - [x] Bio
461
+ - [x] Movies (TODO categories)
462
+ - [x] User Ratings
463
+ - [x] Last ratings
464
+ - [x] All pages
465
+
466
+ ## 🛠️ Development
467
+
468
+ ### Developing and debugging library
469
+
470
+ ```bash
471
+ yarn start
472
+ ```
473
+
474
+ ### Run demo locally
475
+
476
+ You can find and modify it in [`./demo.ts`](https://github.com/bartholomej/node-csfd-api/blob/master/demo.ts) file
477
+
478
+ ```bash
479
+ yarn demo
480
+ ```
481
+
482
+ ## 🤝 Contribution
483
+
484
+ I welcome you to customize this according to your needs ;)
485
+
486
+ Pull requests for any improvements would be great!
487
+
488
+ ## ⭐️ Show your support
489
+
490
+ Give a ⭐️ if this project helped you!
491
+
492
+ Or if you are brave enough consider [making a donation](https://github.com/sponsors/bartholomej) for some 🍺 or 🍵 ;)
493
+
494
+ ## 🕵️‍♀️ Privacy Policy
495
+
496
+ I DO NOT STORE ANY DATA. PERIOD.
497
+
498
+ 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.
499
+
500
+ That's why, with node-csfd-api, what happens on your device stays on your device till disappear.
501
+
502
+ ## 📝 License
503
+
504
+ Copyright &copy; 2020 – 2025 [Lukas Bartak](http://bartweb.cz)
505
+
506
+ Proudly powered by nature 🗻, wind 💨, tea 🍵 and beer 🍺 ;)
507
+
508
+ All contents are licensed under the [MIT license].
509
+
510
+ [mit license]: LICENSE
package/demo.ts ADDED
@@ -0,0 +1,35 @@
1
+ // import { writeFile } from 'fs';
2
+ import { csfd } from './src';
3
+
4
+ // Parse movie
5
+ csfd.movie(10135).then((movie) => console.log(movie));
6
+
7
+ // csfd.search('matrix').then((search) => console.log(search));
8
+
9
+ // Parse creator
10
+ csfd.creator(2120).then((creator) => console.log(creator));
11
+
12
+ /**
13
+ * USER RATINGS
14
+ */
15
+
16
+ // Save all pages in json file
17
+ // const userId = 912;
18
+
19
+ // csfd
20
+ // .userRatings(userId, {
21
+ // excludes: ['epizoda', 'pořad', 'série'],
22
+ // allPages: false,
23
+ // allPagesDelay: 2000
24
+ // })
25
+ // .then((ratings) => {
26
+ // console.log('Saved in file:', `./${userId}.json`);
27
+ // writeFile(`${userId}.json`, JSON.stringify(ratings), (err) => {
28
+ // if (err) return console.log(err);
29
+ // });
30
+ // });
31
+
32
+ // Only TV series
33
+ // csfd
34
+ // .userRatings('912-bart', { includesOnly: ['seriál'] })
35
+ // .then((ratings) => console.log(ratings));
@@ -0,0 +1,55 @@
1
+ import { FlatCompat } from '@eslint/eslintrc';
2
+ import js from '@eslint/js';
3
+ import typescriptEslint from '@typescript-eslint/eslint-plugin';
4
+ import tsParser from '@typescript-eslint/parser';
5
+ import prettier from 'eslint-plugin-prettier';
6
+ import globals from 'globals';
7
+ import path from 'node:path';
8
+ import { fileURLToPath } from 'node:url';
9
+
10
+ const __filename = fileURLToPath(import.meta.url);
11
+ const __dirname = path.dirname(__filename);
12
+ const compat = new FlatCompat({
13
+ baseDirectory: __dirname,
14
+ recommendedConfig: js.configs.recommended,
15
+ allConfig: js.configs.all
16
+ });
17
+
18
+ export default [
19
+ ...compat.extends('google', 'plugin:prettier/recommended'),
20
+ {
21
+ plugins: {
22
+ '@typescript-eslint': typescriptEslint,
23
+ prettier
24
+ },
25
+
26
+ languageOptions: {
27
+ globals: {
28
+ ...globals.browser,
29
+ ...globals.node,
30
+ Atomics: 'readonly',
31
+ SharedArrayBuffer: 'readonly'
32
+ },
33
+
34
+ parser: tsParser,
35
+ ecmaVersion: 2018,
36
+ sourceType: 'module'
37
+ },
38
+
39
+ rules: {
40
+ 'require-jsdoc': 'off',
41
+ 'no-unused-vars': 'off',
42
+
43
+ '@typescript-eslint/no-unused-vars': [
44
+ 'error',
45
+ {
46
+ vars: 'all',
47
+ args: 'after-used',
48
+ ignoreRestSiblings: false
49
+ }
50
+ ],
51
+
52
+ 'prettier/prettier': 'error'
53
+ }
54
+ }
55
+ ];
package/package.json ADDED
@@ -0,0 +1,86 @@
1
+ {
2
+ "name": "node-csfd-api-racintom",
3
+ "version": "1.0.0",
4
+ "description": "ČSFD API in JavaScript. Amazing NPM library for scrapping csfd.cz :)",
5
+ "main": "index.js",
6
+ "author": "sergeras@seznam.cz",
7
+ "scripts": {
8
+ "start": "tsc -w",
9
+ "prebuild": "rimraf dist",
10
+ "build": "tsc",
11
+ "postbuild": "npm-prepare-dist -s postinstall -s prepare",
12
+ "tsc": "tsc",
13
+ "demo": "tsx demo",
14
+ "lint": "eslint ./src/**/**/* --fix",
15
+ "test": "vitest",
16
+ "test:coverage": "yarn test run --coverage",
17
+ "publish:next": "yarn && yarn build && yarn test:coverage && cd dist && yarn publish --tag next",
18
+ "postversion": "git push && git push --follow-tags",
19
+ "release:beta": "npm version preminor --preid=beta -m \"chore(update): prelease %s β\"",
20
+ "prerelease:beta": "npm version prerelease --preid=beta -m \"chore(update): prelease %s β\"",
21
+ "release:patch": "git checkout master && npm version patch -m \"chore(update): patch release %s 🐛\"",
22
+ "release:minor": "git checkout master && npm version minor -m \"chore(update): release %s 🚀\"",
23
+ "release:major": "git checkout master && npm version major -m \"chore(update): major release %s 💥\"",
24
+ "prepare": "husky"
25
+ },
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "dependencies": {
30
+ "cross-fetch": "^4.1.0",
31
+ "node-html-parser": "^7.0.1"
32
+ },
33
+ "devDependencies": {
34
+ "@babel/preset-typescript": "^7.27.1",
35
+ "@eslint/eslintrc": "^3.3.1",
36
+ "@eslint/js": "^9.33.0",
37
+ "@types/express": "^5.0.3",
38
+ "@types/node": "^24.2.1",
39
+ "@typescript-eslint/eslint-plugin": "^8.39.0",
40
+ "@typescript-eslint/parser": "^8.39.0",
41
+ "@vitest/coverage-istanbul": "^3.2.4",
42
+ "@vitest/ui": "3.2.4",
43
+ "eslint": "^9.33.0",
44
+ "eslint-config-google": "^0.14.0",
45
+ "eslint-config-prettier": "^10.1.8",
46
+ "eslint-plugin-prettier": "^5.5.4",
47
+ "express": "^5.1.0",
48
+ "globals": "^16.3.0",
49
+ "husky": "^9.1.7",
50
+ "lint-staged": "^16.1.5",
51
+ "npm-prepare-dist": "^0.5.0",
52
+ "prettier": "^3.6.2",
53
+ "rimraf": "^6.0.1",
54
+ "tsx": "^4.20.3",
55
+ "typescript": "^5.9.2",
56
+ "vitest": "^3.2.4"
57
+ },
58
+ "repository": {
59
+ "url": "https://github.com/racintom/node-csfd-api.git",
60
+ "type": "git"
61
+ },
62
+ "bugs": {
63
+ "url": "https://github.com/racintom/node-csfd-api/issues"
64
+ },
65
+ "homepage": "https://github.com/racintom/node-csfd-api#readme",
66
+ "keywords": [
67
+ "csfd",
68
+ "čsfd",
69
+ "ratings",
70
+ "movies",
71
+ "films",
72
+ "nodejs",
73
+ "node",
74
+ "typescript",
75
+ "scraper",
76
+ "parser",
77
+ "api"
78
+ ],
79
+ "engines": {
80
+ "node": ">= 18"
81
+ },
82
+ "license": "MIT",
83
+ "lint-staged": {
84
+ "*.ts": "eslint --cache --fix"
85
+ }
86
+ }