node-csfd-api 3.1.1 → 3.3.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.
- package/README.md +116 -3
- package/dto/user-ratings.d.mts +4 -0
- package/dto/user-ratings.d.ts +4 -0
- package/dto/user-reviews.d.mts +28 -0
- package/dto/user-reviews.d.ts +28 -0
- package/helpers/global.helper.js +2 -0
- package/helpers/global.helper.js.map +1 -1
- package/helpers/global.helper.mjs +2 -1
- package/helpers/global.helper.mjs.map +1 -1
- package/helpers/user-ratings.helper.js +1 -12
- package/helpers/user-ratings.helper.js.map +1 -1
- package/helpers/user-ratings.helper.mjs +2 -12
- package/helpers/user-ratings.helper.mjs.map +1 -1
- package/helpers/user-reviews.helper.js +57 -0
- package/helpers/user-reviews.helper.js.map +1 -0
- package/helpers/user-reviews.helper.mjs +48 -0
- package/helpers/user-reviews.helper.mjs.map +1 -0
- package/index.d.mts +5 -1
- package/index.d.ts +5 -1
- package/index.js +9 -2
- package/index.js.map +1 -1
- package/index.mjs +9 -2
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/services/cinema.service.d.mts +0 -1
- package/services/cinema.service.d.ts +0 -1
- package/services/cinema.service.js +2 -3
- package/services/cinema.service.js.map +1 -1
- package/services/cinema.service.mjs +2 -3
- package/services/cinema.service.mjs.map +1 -1
- package/services/creator.service.d.mts +0 -1
- package/services/creator.service.d.ts +0 -1
- package/services/creator.service.js +2 -3
- package/services/creator.service.js.map +1 -1
- package/services/creator.service.mjs +2 -3
- package/services/creator.service.mjs.map +1 -1
- package/services/movie.service.d.mts +0 -1
- package/services/movie.service.d.ts +0 -1
- package/services/movie.service.js +2 -3
- package/services/movie.service.js.map +1 -1
- package/services/movie.service.mjs +2 -3
- package/services/movie.service.mjs.map +1 -1
- package/services/user-ratings.service.d.mts +0 -1
- package/services/user-ratings.service.d.ts +0 -1
- package/services/user-ratings.service.js +12 -12
- package/services/user-ratings.service.js.map +1 -1
- package/services/user-ratings.service.mjs +12 -12
- package/services/user-ratings.service.mjs.map +1 -1
- package/services/user-reviews.service.d.mts +11 -0
- package/services/user-reviews.service.d.ts +11 -0
- package/services/user-reviews.service.js +68 -0
- package/services/user-reviews.service.js.map +1 -0
- package/services/user-reviews.service.mjs +66 -0
- package/services/user-reviews.service.mjs.map +1 -0
- package/vars.js +2 -0
- package/vars.js.map +1 -1
- package/vars.mjs +2 -1
- package/vars.mjs.map +1 -1
package/README.md
CHANGED
|
@@ -31,6 +31,7 @@ npm install node-csfd-api
|
|
|
31
31
|
|
|
32
32
|
- [Movies and TV Series](#Movie)
|
|
33
33
|
- [User Ratings](#User-Ratings)
|
|
34
|
+
- [User Reviews](#User-Reviews)
|
|
34
35
|
- [Search](#Search)
|
|
35
36
|
- [Creators](#Creators)
|
|
36
37
|
|
|
@@ -46,7 +47,7 @@ csfd.movie(535121).then((movie) => console.log(movie));
|
|
|
46
47
|
|
|
47
48
|
<details>
|
|
48
49
|
<summary>Click here to see full result example</summary>
|
|
49
|
-
|
|
50
|
+
|
|
50
51
|
```javascript
|
|
51
52
|
{
|
|
52
53
|
id: 535121,
|
|
@@ -138,6 +139,7 @@ csfd.movie(535121).then((movie) => console.log(movie));
|
|
|
138
139
|
]
|
|
139
140
|
}
|
|
140
141
|
```
|
|
142
|
+
|
|
141
143
|
</details>
|
|
142
144
|
|
|
143
145
|
### Search
|
|
@@ -152,7 +154,7 @@ csfd.search('bart').then((search) => console.log(search));
|
|
|
152
154
|
|
|
153
155
|
<details>
|
|
154
156
|
<summary>Click here to see full result example</summary>
|
|
155
|
-
|
|
157
|
+
|
|
156
158
|
```javascript
|
|
157
159
|
[
|
|
158
160
|
{
|
|
@@ -323,6 +325,20 @@ csfd
|
|
|
323
325
|
.then((ratings) => console.log(ratings));
|
|
324
326
|
```
|
|
325
327
|
|
|
328
|
+
#### Specific page
|
|
329
|
+
|
|
330
|
+
Get [second page of my ratings](https://www.csfd.cz/uzivatel/912-bart/hodnoceni/?page=2)
|
|
331
|
+
|
|
332
|
+
```javascript
|
|
333
|
+
import { csfd } from 'node-csfd-api';
|
|
334
|
+
|
|
335
|
+
csfd
|
|
336
|
+
.userRatings('912-bart', {
|
|
337
|
+
page: 2 // Get specific page
|
|
338
|
+
})
|
|
339
|
+
.then((ratings) => console.log(ratings));
|
|
340
|
+
```
|
|
341
|
+
|
|
326
342
|
<details>
|
|
327
343
|
<summary>Click here to see full result example</summary>
|
|
328
344
|
|
|
@@ -359,6 +375,98 @@ csfd
|
|
|
359
375
|
| **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
376
|
| **allPages** | boolean | false | Get all pages |
|
|
361
377
|
| **allPagesDelay** | number | 0 | Delay on each page request. In milliseconds |
|
|
378
|
+
| **page** | number | 1 | Specific page number to fetch (e.g., 2 for page 2) |
|
|
379
|
+
|
|
380
|
+
_Note: You can not use both parameters `includesOnly` and `excludes`. Parameter `includesOnly` has a priority._
|
|
381
|
+
|
|
382
|
+
### User Reviews
|
|
383
|
+
|
|
384
|
+
#### Last reviews (last page)
|
|
385
|
+
|
|
386
|
+
Get [user's last reviews](https://www.csfd.cz/uzivatel/195357-verbal/recenze/)
|
|
387
|
+
|
|
388
|
+
```javascript
|
|
389
|
+
import { csfd } from 'node-csfd-api';
|
|
390
|
+
|
|
391
|
+
csfd.userReviews(195357).then((reviews) => console.log(reviews));
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
#### All reviews (all pages)
|
|
395
|
+
|
|
396
|
+
> Warning: Use it wisely. Can be detected and banned. Consider using it together with `allPagesDelay` attribute.
|
|
397
|
+
|
|
398
|
+
Get [all user reviews](https://www.csfd.cz/uzivatel/195357-verbal/recenze/)
|
|
399
|
+
|
|
400
|
+
```javascript
|
|
401
|
+
import { csfd } from 'node-csfd-api';
|
|
402
|
+
|
|
403
|
+
csfd
|
|
404
|
+
.userReviews(195357, {
|
|
405
|
+
allPages: true, // Download all pages (one by one)
|
|
406
|
+
allPagesDelay: 2000 // Make delay 2000ms on each page request
|
|
407
|
+
})
|
|
408
|
+
.then((reviews) => console.log(reviews));
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
#### Specific page
|
|
412
|
+
|
|
413
|
+
Get [second page of user reviews](https://www.csfd.cz/uzivatel/195357-verbal/recenze/?page=2)
|
|
414
|
+
|
|
415
|
+
```javascript
|
|
416
|
+
import { csfd } from 'node-csfd-api';
|
|
417
|
+
|
|
418
|
+
csfd
|
|
419
|
+
.userReviews(195357, {
|
|
420
|
+
page: 2 // Get specific page
|
|
421
|
+
})
|
|
422
|
+
.then((reviews) => console.log(reviews));
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
<details>
|
|
426
|
+
<summary>Click here to see full result example</summary>
|
|
427
|
+
|
|
428
|
+
```javascript
|
|
429
|
+
[
|
|
430
|
+
{
|
|
431
|
+
id: 1391448,
|
|
432
|
+
title: 'Co s Péťou?',
|
|
433
|
+
year: 2025,
|
|
434
|
+
type: 'film',
|
|
435
|
+
url: 'https://www.csfd.cz/film/1391448-co-s-petou/prehled/',
|
|
436
|
+
colorRating: 'good',
|
|
437
|
+
userDate: '27.11.2025',
|
|
438
|
+
userRating: 4,
|
|
439
|
+
text: 'Co s Péťou? Inu, co by? Každý normální Sparťan by to okamžitě mrdnul z útesu...',
|
|
440
|
+
poster:
|
|
441
|
+
'https://image.pmgstatic.com/cache/resized/w240h339/files/images/film/posters/170/492/170492173_1l3djd.jpg'
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
id: 1530416,
|
|
445
|
+
title: 'Kouzlo derby',
|
|
446
|
+
year: 2025,
|
|
447
|
+
type: 'film',
|
|
448
|
+
url: 'https://www.csfd.cz/film/1530416-kouzlo-derby/prehled/',
|
|
449
|
+
colorRating: 'average',
|
|
450
|
+
userDate: '26.11.2025',
|
|
451
|
+
userRating: 1,
|
|
452
|
+
text: 'Typické kolečkoidní sebevykradačské pásmo klišovitých...',
|
|
453
|
+
poster:
|
|
454
|
+
'https://image.pmgstatic.com/cache/resized/w240h339/files/images/film/posters/170/230/170230377_cimu90.jpg'
|
|
455
|
+
}
|
|
456
|
+
];
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
</details>
|
|
460
|
+
|
|
461
|
+
#### Options for user reviews
|
|
462
|
+
|
|
463
|
+
| Option | Type | Default | Description |
|
|
464
|
+
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ------- | ------------------------------------------------------ |
|
|
465
|
+
| **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']` |
|
|
466
|
+
| **exclude** | [CSFDFilmTypes[]](https://github.com/bartholomej/node-csfd-api/blob/8fa5f9cbc7e7f2b62b0bd2c2b5a24c9a63444f6a/src/interfaces/global.ts#L25) | null | Excluding film types eg. `['epizoda', 'série']` |
|
|
467
|
+
| **allPages** | boolean | false | Get all pages |
|
|
468
|
+
| **allPagesDelay** | number | 0 | Delay on each page request. In milliseconds |
|
|
469
|
+
| **page** | number | 1 | Specific page number to fetch (e.g., 2 for page 2) |
|
|
362
470
|
|
|
363
471
|
_Note: You can not use both parameters `includesOnly` and `excludes`. Parameter `includesOnly` has a priority._
|
|
364
472
|
|
|
@@ -398,6 +506,7 @@ docker run -p 3000:3000 node-csfd-api
|
|
|
398
506
|
- `/search/quentin+tarantino`
|
|
399
507
|
- `/creator/2120`
|
|
400
508
|
- `/user-ratings/912-bart`
|
|
509
|
+
- `/user-reviews/195357`
|
|
401
510
|
|
|
402
511
|
## 🧑💻 Used by
|
|
403
512
|
|
|
@@ -449,7 +558,7 @@ docker run -p 3000:3000 node-csfd-api
|
|
|
449
558
|
- [x] Similar movies
|
|
450
559
|
- [x] Trivia
|
|
451
560
|
- [x] Photo from movie (random)
|
|
452
|
-
- [ ] Reviews
|
|
561
|
+
- [ ] Reviews (from movie page)
|
|
453
562
|
- [ ] OST
|
|
454
563
|
- [ ] Search
|
|
455
564
|
- [x] Movies
|
|
@@ -462,6 +571,10 @@ docker run -p 3000:3000 node-csfd-api
|
|
|
462
571
|
- [x] User Ratings
|
|
463
572
|
- [x] Last ratings
|
|
464
573
|
- [x] All pages
|
|
574
|
+
- [x] User Reviews
|
|
575
|
+
- [x] Last reviews
|
|
576
|
+
- [x] All pages
|
|
577
|
+
- [ ] Filter by type
|
|
465
578
|
|
|
466
579
|
## 🛠️ Development
|
|
467
580
|
|
package/dto/user-ratings.d.mts
CHANGED
|
@@ -16,6 +16,10 @@ interface CSFDUserRatingConfig {
|
|
|
16
16
|
* Delay on each page request. In milliseconds
|
|
17
17
|
*/
|
|
18
18
|
allPagesDelay?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Specific page number to fetch (e.g., 2 for second page)
|
|
21
|
+
*/
|
|
22
|
+
page?: number;
|
|
19
23
|
}
|
|
20
24
|
type Colors = 'lightgrey' | 'blue' | 'red' | 'grey';
|
|
21
25
|
//#endregion
|
package/dto/user-ratings.d.ts
CHANGED
|
@@ -16,6 +16,10 @@ interface CSFDUserRatingConfig {
|
|
|
16
16
|
* Delay on each page request. In milliseconds
|
|
17
17
|
*/
|
|
18
18
|
allPagesDelay?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Specific page number to fetch (e.g., 2 for second page)
|
|
21
|
+
*/
|
|
22
|
+
page?: number;
|
|
19
23
|
}
|
|
20
24
|
type Colors = 'lightgrey' | 'blue' | 'red' | 'grey';
|
|
21
25
|
//#endregion
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CSFDFilmTypes, CSFDScreening, CSFDStars } from "./global.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/dto/user-reviews.d.ts
|
|
4
|
+
interface CSFDUserReviews extends CSFDScreening {
|
|
5
|
+
userRating: CSFDStars;
|
|
6
|
+
userDate: string;
|
|
7
|
+
text: string;
|
|
8
|
+
poster: string;
|
|
9
|
+
}
|
|
10
|
+
interface CSFDUserReviewsConfig {
|
|
11
|
+
includesOnly?: CSFDFilmTypes[];
|
|
12
|
+
excludes?: CSFDFilmTypes[];
|
|
13
|
+
/**
|
|
14
|
+
* Fetch all reviews. (Warning: Use it wisely. Can be detected and banned. Consider using it together with `allPagesDelay` attribute)
|
|
15
|
+
*/
|
|
16
|
+
allPages?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Delay on each page request. In milliseconds
|
|
19
|
+
*/
|
|
20
|
+
allPagesDelay?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Specific page number to fetch (e.g., 2 for second page)
|
|
23
|
+
*/
|
|
24
|
+
page?: number;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { CSFDUserReviews, CSFDUserReviewsConfig };
|
|
28
|
+
//# sourceMappingURL=user-reviews.d.mts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CSFDFilmTypes, CSFDScreening, CSFDStars } from "./global.js";
|
|
2
|
+
|
|
3
|
+
//#region src/dto/user-reviews.d.ts
|
|
4
|
+
interface CSFDUserReviews extends CSFDScreening {
|
|
5
|
+
userRating: CSFDStars;
|
|
6
|
+
userDate: string;
|
|
7
|
+
text: string;
|
|
8
|
+
poster: string;
|
|
9
|
+
}
|
|
10
|
+
interface CSFDUserReviewsConfig {
|
|
11
|
+
includesOnly?: CSFDFilmTypes[];
|
|
12
|
+
excludes?: CSFDFilmTypes[];
|
|
13
|
+
/**
|
|
14
|
+
* Fetch all reviews. (Warning: Use it wisely. Can be detected and banned. Consider using it together with `allPagesDelay` attribute)
|
|
15
|
+
*/
|
|
16
|
+
allPages?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Delay on each page request. In milliseconds
|
|
19
|
+
*/
|
|
20
|
+
allPagesDelay?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Specific page number to fetch (e.g., 2 for second page)
|
|
23
|
+
*/
|
|
24
|
+
page?: number;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { CSFDUserReviews, CSFDUserReviewsConfig };
|
|
28
|
+
//# sourceMappingURL=user-reviews.d.ts.map
|
package/helpers/global.helper.js
CHANGED
|
@@ -40,6 +40,7 @@ const getDuration = (matches) => {
|
|
|
40
40
|
const parseISO8601Duration = (iso) => {
|
|
41
41
|
return +getDuration(iso.match(/(-)?P(?:([.,\d]+)Y)?(?:([.,\d]+)M)?(?:([.,\d]+)W)?(?:([.,\d]+)D)?T(?:([.,\d]+)H)?(?:([.,\d]+)M)?(?:([.,\d]+)S)?/)).minutes;
|
|
42
42
|
};
|
|
43
|
+
const sleep = (ms) => new Promise((res) => setTimeout(res, ms));
|
|
43
44
|
|
|
44
45
|
//#endregion
|
|
45
46
|
exports.addProtocol = addProtocol;
|
|
@@ -47,4 +48,5 @@ exports.getColor = getColor;
|
|
|
47
48
|
exports.parseColor = parseColor;
|
|
48
49
|
exports.parseISO8601Duration = parseISO8601Duration;
|
|
49
50
|
exports.parseIdFromUrl = parseIdFromUrl;
|
|
51
|
+
exports.sleep = sleep;
|
|
50
52
|
//# sourceMappingURL=global.helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global.helper.js","names":[],"sources":["../../src/helpers/global.helper.ts"],"sourcesContent":["import { CSFDColorRating } from '../dto/global';\nimport { Colors } from '../dto/user-ratings';\n\nexport const parseIdFromUrl = (url: string): number => {\n if (url) {\n const idSlug = url?.split('/')[2];\n const id = idSlug?.split('-')[0];\n return +id || null;\n } else {\n return null;\n }\n};\n\nexport const getColor = (cls: string): CSFDColorRating => {\n switch (cls) {\n case 'page-lightgrey':\n return 'unknown';\n case 'page-red':\n return 'good';\n case 'page-blue':\n return 'average';\n case 'page-grey':\n return 'bad';\n default:\n return 'unknown';\n }\n};\n\nexport const parseColor = (quality: Colors): CSFDColorRating => {\n switch (quality) {\n case 'lightgrey':\n return 'unknown';\n case 'red':\n return 'good';\n case 'blue':\n return 'average';\n case 'grey':\n return 'bad';\n default:\n return 'unknown';\n }\n};\n\nexport const addProtocol = (url: string): string => {\n return url.startsWith('//') ? 'https:' + url : url;\n};\n\nexport const getDuration = (matches: any[]) => {\n return {\n sign: matches[1] === undefined ? '+' : '-',\n years: matches[2] === undefined ? 0 : matches[2],\n months: matches[3] === undefined ? 0 : matches[3],\n weeks: matches[4] === undefined ? 0 : matches[4],\n days: matches[5] === undefined ? 0 : matches[5],\n hours: matches[6] === undefined ? 0 : matches[6],\n minutes: matches[7] === undefined ? 0 : matches[7],\n seconds: matches[8] === undefined ? 0 : matches[8]\n };\n};\n\nexport const parseISO8601Duration = (iso: string): number => {\n const iso8601DurationRegex =\n /(-)?P(?:([.,\\d]+)Y)?(?:([.,\\d]+)M)?(?:([.,\\d]+)W)?(?:([.,\\d]+)D)?T(?:([.,\\d]+)H)?(?:([.,\\d]+)M)?(?:([.,\\d]+)S)?/;\n\n const matches = iso.match(iso8601DurationRegex);\n\n const duration = getDuration(matches);\n\n return +duration.minutes;\n};\n"],"mappings":";;AAGA,MAAa,kBAAkB,QAAwB;AACrD,KAAI,IAGF,QAAO,EAFQ,KAAK,MAAM,IAAI,CAAC,KACZ,MAAM,IAAI,CAAC,MAChB;KAEd,QAAO;;AAIX,MAAa,YAAY,QAAiC;AACxD,SAAQ,KAAR;EACE,KAAK,iBACH,QAAO;EACT,KAAK,WACH,QAAO;EACT,KAAK,YACH,QAAO;EACT,KAAK,YACH,QAAO;EACT,QACE,QAAO;;;AAIb,MAAa,cAAc,YAAqC;AAC9D,SAAQ,SAAR;EACE,KAAK,YACH,QAAO;EACT,KAAK,MACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,QACE,QAAO;;;AAIb,MAAa,eAAe,QAAwB;AAClD,QAAO,IAAI,WAAW,KAAK,GAAG,WAAW,MAAM;;AAGjD,MAAa,eAAe,YAAmB;AAC7C,QAAO;EACL,MAAM,QAAQ,OAAO,SAAY,MAAM;EACvC,OAAO,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAC9C,QAAQ,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAC/C,OAAO,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAC9C,MAAM,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAC7C,OAAO,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAC9C,SAAS,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAChD,SAAS,QAAQ,OAAO,SAAY,IAAI,QAAQ;EACjD;;AAGH,MAAa,wBAAwB,QAAwB;AAQ3D,QAAO,CAFU,YAFD,IAAI,MAFlB,kHAE6C,CAEV,CAEpB"}
|
|
1
|
+
{"version":3,"file":"global.helper.js","names":[],"sources":["../../src/helpers/global.helper.ts"],"sourcesContent":["import { CSFDColorRating } from '../dto/global';\nimport { Colors } from '../dto/user-ratings';\n\nexport const parseIdFromUrl = (url: string): number => {\n if (url) {\n const idSlug = url?.split('/')[2];\n const id = idSlug?.split('-')[0];\n return +id || null;\n } else {\n return null;\n }\n};\n\nexport const getColor = (cls: string): CSFDColorRating => {\n switch (cls) {\n case 'page-lightgrey':\n return 'unknown';\n case 'page-red':\n return 'good';\n case 'page-blue':\n return 'average';\n case 'page-grey':\n return 'bad';\n default:\n return 'unknown';\n }\n};\n\nexport const parseColor = (quality: Colors): CSFDColorRating => {\n switch (quality) {\n case 'lightgrey':\n return 'unknown';\n case 'red':\n return 'good';\n case 'blue':\n return 'average';\n case 'grey':\n return 'bad';\n default:\n return 'unknown';\n }\n};\n\nexport const addProtocol = (url: string): string => {\n return url.startsWith('//') ? 'https:' + url : url;\n};\n\nexport const getDuration = (matches: any[]) => {\n return {\n sign: matches[1] === undefined ? '+' : '-',\n years: matches[2] === undefined ? 0 : matches[2],\n months: matches[3] === undefined ? 0 : matches[3],\n weeks: matches[4] === undefined ? 0 : matches[4],\n days: matches[5] === undefined ? 0 : matches[5],\n hours: matches[6] === undefined ? 0 : matches[6],\n minutes: matches[7] === undefined ? 0 : matches[7],\n seconds: matches[8] === undefined ? 0 : matches[8]\n };\n};\n\nexport const parseISO8601Duration = (iso: string): number => {\n const iso8601DurationRegex =\n /(-)?P(?:([.,\\d]+)Y)?(?:([.,\\d]+)M)?(?:([.,\\d]+)W)?(?:([.,\\d]+)D)?T(?:([.,\\d]+)H)?(?:([.,\\d]+)M)?(?:([.,\\d]+)S)?/;\n\n const matches = iso.match(iso8601DurationRegex);\n\n const duration = getDuration(matches);\n\n return +duration.minutes;\n};\n\n// Sleep in loop\nexport const sleep = (ms: number) => new Promise((res) => setTimeout(res, ms));\n"],"mappings":";;AAGA,MAAa,kBAAkB,QAAwB;AACrD,KAAI,IAGF,QAAO,EAFQ,KAAK,MAAM,IAAI,CAAC,KACZ,MAAM,IAAI,CAAC,MAChB;KAEd,QAAO;;AAIX,MAAa,YAAY,QAAiC;AACxD,SAAQ,KAAR;EACE,KAAK,iBACH,QAAO;EACT,KAAK,WACH,QAAO;EACT,KAAK,YACH,QAAO;EACT,KAAK,YACH,QAAO;EACT,QACE,QAAO;;;AAIb,MAAa,cAAc,YAAqC;AAC9D,SAAQ,SAAR;EACE,KAAK,YACH,QAAO;EACT,KAAK,MACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,QACE,QAAO;;;AAIb,MAAa,eAAe,QAAwB;AAClD,QAAO,IAAI,WAAW,KAAK,GAAG,WAAW,MAAM;;AAGjD,MAAa,eAAe,YAAmB;AAC7C,QAAO;EACL,MAAM,QAAQ,OAAO,SAAY,MAAM;EACvC,OAAO,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAC9C,QAAQ,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAC/C,OAAO,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAC9C,MAAM,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAC7C,OAAO,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAC9C,SAAS,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAChD,SAAS,QAAQ,OAAO,SAAY,IAAI,QAAQ;EACjD;;AAGH,MAAa,wBAAwB,QAAwB;AAQ3D,QAAO,CAFU,YAFD,IAAI,MAFlB,kHAE6C,CAEV,CAEpB;;AAInB,MAAa,SAAS,OAAe,IAAI,SAAS,QAAQ,WAAW,KAAK,GAAG,CAAC"}
|
|
@@ -39,7 +39,8 @@ const getDuration = (matches) => {
|
|
|
39
39
|
const parseISO8601Duration = (iso) => {
|
|
40
40
|
return +getDuration(iso.match(/(-)?P(?:([.,\d]+)Y)?(?:([.,\d]+)M)?(?:([.,\d]+)W)?(?:([.,\d]+)D)?T(?:([.,\d]+)H)?(?:([.,\d]+)M)?(?:([.,\d]+)S)?/)).minutes;
|
|
41
41
|
};
|
|
42
|
+
const sleep = (ms) => new Promise((res) => setTimeout(res, ms));
|
|
42
43
|
|
|
43
44
|
//#endregion
|
|
44
|
-
export { addProtocol, getColor, parseColor, parseISO8601Duration, parseIdFromUrl };
|
|
45
|
+
export { addProtocol, getColor, parseColor, parseISO8601Duration, parseIdFromUrl, sleep };
|
|
45
46
|
//# sourceMappingURL=global.helper.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global.helper.mjs","names":[],"sources":["../../src/helpers/global.helper.ts"],"sourcesContent":["import { CSFDColorRating } from '../dto/global';\nimport { Colors } from '../dto/user-ratings';\n\nexport const parseIdFromUrl = (url: string): number => {\n if (url) {\n const idSlug = url?.split('/')[2];\n const id = idSlug?.split('-')[0];\n return +id || null;\n } else {\n return null;\n }\n};\n\nexport const getColor = (cls: string): CSFDColorRating => {\n switch (cls) {\n case 'page-lightgrey':\n return 'unknown';\n case 'page-red':\n return 'good';\n case 'page-blue':\n return 'average';\n case 'page-grey':\n return 'bad';\n default:\n return 'unknown';\n }\n};\n\nexport const parseColor = (quality: Colors): CSFDColorRating => {\n switch (quality) {\n case 'lightgrey':\n return 'unknown';\n case 'red':\n return 'good';\n case 'blue':\n return 'average';\n case 'grey':\n return 'bad';\n default:\n return 'unknown';\n }\n};\n\nexport const addProtocol = (url: string): string => {\n return url.startsWith('//') ? 'https:' + url : url;\n};\n\nexport const getDuration = (matches: any[]) => {\n return {\n sign: matches[1] === undefined ? '+' : '-',\n years: matches[2] === undefined ? 0 : matches[2],\n months: matches[3] === undefined ? 0 : matches[3],\n weeks: matches[4] === undefined ? 0 : matches[4],\n days: matches[5] === undefined ? 0 : matches[5],\n hours: matches[6] === undefined ? 0 : matches[6],\n minutes: matches[7] === undefined ? 0 : matches[7],\n seconds: matches[8] === undefined ? 0 : matches[8]\n };\n};\n\nexport const parseISO8601Duration = (iso: string): number => {\n const iso8601DurationRegex =\n /(-)?P(?:([.,\\d]+)Y)?(?:([.,\\d]+)M)?(?:([.,\\d]+)W)?(?:([.,\\d]+)D)?T(?:([.,\\d]+)H)?(?:([.,\\d]+)M)?(?:([.,\\d]+)S)?/;\n\n const matches = iso.match(iso8601DurationRegex);\n\n const duration = getDuration(matches);\n\n return +duration.minutes;\n};\n"],"mappings":";AAGA,MAAa,kBAAkB,QAAwB;AACrD,KAAI,IAGF,QAAO,EAFQ,KAAK,MAAM,IAAI,CAAC,KACZ,MAAM,IAAI,CAAC,MAChB;KAEd,QAAO;;AAIX,MAAa,YAAY,QAAiC;AACxD,SAAQ,KAAR;EACE,KAAK,iBACH,QAAO;EACT,KAAK,WACH,QAAO;EACT,KAAK,YACH,QAAO;EACT,KAAK,YACH,QAAO;EACT,QACE,QAAO;;;AAIb,MAAa,cAAc,YAAqC;AAC9D,SAAQ,SAAR;EACE,KAAK,YACH,QAAO;EACT,KAAK,MACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,QACE,QAAO;;;AAIb,MAAa,eAAe,QAAwB;AAClD,QAAO,IAAI,WAAW,KAAK,GAAG,WAAW,MAAM;;AAGjD,MAAa,eAAe,YAAmB;AAC7C,QAAO;EACL,MAAM,QAAQ,OAAO,SAAY,MAAM;EACvC,OAAO,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAC9C,QAAQ,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAC/C,OAAO,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAC9C,MAAM,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAC7C,OAAO,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAC9C,SAAS,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAChD,SAAS,QAAQ,OAAO,SAAY,IAAI,QAAQ;EACjD;;AAGH,MAAa,wBAAwB,QAAwB;AAQ3D,QAAO,CAFU,YAFD,IAAI,MAFlB,kHAE6C,CAEV,CAEpB"}
|
|
1
|
+
{"version":3,"file":"global.helper.mjs","names":[],"sources":["../../src/helpers/global.helper.ts"],"sourcesContent":["import { CSFDColorRating } from '../dto/global';\nimport { Colors } from '../dto/user-ratings';\n\nexport const parseIdFromUrl = (url: string): number => {\n if (url) {\n const idSlug = url?.split('/')[2];\n const id = idSlug?.split('-')[0];\n return +id || null;\n } else {\n return null;\n }\n};\n\nexport const getColor = (cls: string): CSFDColorRating => {\n switch (cls) {\n case 'page-lightgrey':\n return 'unknown';\n case 'page-red':\n return 'good';\n case 'page-blue':\n return 'average';\n case 'page-grey':\n return 'bad';\n default:\n return 'unknown';\n }\n};\n\nexport const parseColor = (quality: Colors): CSFDColorRating => {\n switch (quality) {\n case 'lightgrey':\n return 'unknown';\n case 'red':\n return 'good';\n case 'blue':\n return 'average';\n case 'grey':\n return 'bad';\n default:\n return 'unknown';\n }\n};\n\nexport const addProtocol = (url: string): string => {\n return url.startsWith('//') ? 'https:' + url : url;\n};\n\nexport const getDuration = (matches: any[]) => {\n return {\n sign: matches[1] === undefined ? '+' : '-',\n years: matches[2] === undefined ? 0 : matches[2],\n months: matches[3] === undefined ? 0 : matches[3],\n weeks: matches[4] === undefined ? 0 : matches[4],\n days: matches[5] === undefined ? 0 : matches[5],\n hours: matches[6] === undefined ? 0 : matches[6],\n minutes: matches[7] === undefined ? 0 : matches[7],\n seconds: matches[8] === undefined ? 0 : matches[8]\n };\n};\n\nexport const parseISO8601Duration = (iso: string): number => {\n const iso8601DurationRegex =\n /(-)?P(?:([.,\\d]+)Y)?(?:([.,\\d]+)M)?(?:([.,\\d]+)W)?(?:([.,\\d]+)D)?T(?:([.,\\d]+)H)?(?:([.,\\d]+)M)?(?:([.,\\d]+)S)?/;\n\n const matches = iso.match(iso8601DurationRegex);\n\n const duration = getDuration(matches);\n\n return +duration.minutes;\n};\n\n// Sleep in loop\nexport const sleep = (ms: number) => new Promise((res) => setTimeout(res, ms));\n"],"mappings":";AAGA,MAAa,kBAAkB,QAAwB;AACrD,KAAI,IAGF,QAAO,EAFQ,KAAK,MAAM,IAAI,CAAC,KACZ,MAAM,IAAI,CAAC,MAChB;KAEd,QAAO;;AAIX,MAAa,YAAY,QAAiC;AACxD,SAAQ,KAAR;EACE,KAAK,iBACH,QAAO;EACT,KAAK,WACH,QAAO;EACT,KAAK,YACH,QAAO;EACT,KAAK,YACH,QAAO;EACT,QACE,QAAO;;;AAIb,MAAa,cAAc,YAAqC;AAC9D,SAAQ,SAAR;EACE,KAAK,YACH,QAAO;EACT,KAAK,MACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,QACE,QAAO;;;AAIb,MAAa,eAAe,QAAwB;AAClD,QAAO,IAAI,WAAW,KAAK,GAAG,WAAW,MAAM;;AAGjD,MAAa,eAAe,YAAmB;AAC7C,QAAO;EACL,MAAM,QAAQ,OAAO,SAAY,MAAM;EACvC,OAAO,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAC9C,QAAQ,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAC/C,OAAO,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAC9C,MAAM,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAC7C,OAAO,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAC9C,SAAS,QAAQ,OAAO,SAAY,IAAI,QAAQ;EAChD,SAAS,QAAQ,OAAO,SAAY,IAAI,QAAQ;EACjD;;AAGH,MAAa,wBAAwB,QAAwB;AAQ3D,QAAO,CAFU,YAFD,IAAI,MAFlB,kHAE6C,CAEV,CAEpB;;AAInB,MAAa,SAAS,OAAe,IAAI,SAAS,QAAQ,WAAW,KAAK,GAAG,CAAC"}
|
|
@@ -20,7 +20,7 @@ const getUserRatingYear = (el) => {
|
|
|
20
20
|
return +el.querySelectorAll("td.name .film-title-info .info")[0]?.text.slice(1, -1) || null;
|
|
21
21
|
};
|
|
22
22
|
const getUserRatingColorRating = (el) => {
|
|
23
|
-
return parseColor(el.querySelector("td.name .icon").classNames.split(" ").pop());
|
|
23
|
+
return require_global_helper.parseColor(el.querySelector("td.name .icon").classNames.split(" ").pop());
|
|
24
24
|
};
|
|
25
25
|
const getUserRatingDate = (el) => {
|
|
26
26
|
return el.querySelector("td.date-only").text.trim();
|
|
@@ -28,16 +28,6 @@ const getUserRatingDate = (el) => {
|
|
|
28
28
|
const getUserRatingUrl = (el) => {
|
|
29
29
|
return `https://www.csfd.cz${el.querySelector("td.name .film-title-name").attributes.href}`;
|
|
30
30
|
};
|
|
31
|
-
const parseColor = (quality) => {
|
|
32
|
-
switch (quality) {
|
|
33
|
-
case "lightgrey": return "unknown";
|
|
34
|
-
case "red": return "good";
|
|
35
|
-
case "blue": return "average";
|
|
36
|
-
case "grey": return "bad";
|
|
37
|
-
default: return "unknown";
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
const sleep = (ms) => new Promise((res) => setTimeout(res, ms));
|
|
41
31
|
|
|
42
32
|
//#endregion
|
|
43
33
|
exports.getUserRating = getUserRating;
|
|
@@ -48,5 +38,4 @@ exports.getUserRatingTitle = getUserRatingTitle;
|
|
|
48
38
|
exports.getUserRatingType = getUserRatingType;
|
|
49
39
|
exports.getUserRatingUrl = getUserRatingUrl;
|
|
50
40
|
exports.getUserRatingYear = getUserRatingYear;
|
|
51
|
-
exports.sleep = sleep;
|
|
52
41
|
//# sourceMappingURL=user-ratings.helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-ratings.helper.js","names":["parseIdFromUrl"],"sources":["../../src/helpers/user-ratings.helper.ts"],"sourcesContent":["import { HTMLElement } from 'node-html-parser';\nimport { CSFDColorRating, CSFDFilmTypes, CSFDStars } from '../dto/global';\nimport { Colors } from '../dto/user-ratings';\nimport { parseIdFromUrl } from './global.helper';\n\nexport const getUserRatingId = (el: HTMLElement): number => {\n const url = el.querySelector('td.name .film-title-name').attributes.href;\n return parseIdFromUrl(url);\n};\n\nexport const getUserRating = (el: HTMLElement): CSFDStars => {\n const ratingText = el.querySelector('td.star-rating-only .stars').classNames.split(' ').pop();\n\n const rating = ratingText.includes('stars-') ? +ratingText.split('-').pop() : 0;\n return rating as CSFDStars;\n};\n\nexport const getUserRatingType = (el: HTMLElement): CSFDFilmTypes => {\n const typeText = el.querySelectorAll('td.name .film-title-info .info');\n\n return (typeText.length > 1 ? typeText[1].text.slice(1, -1) : 'film') as CSFDFilmTypes;\n};\n\nexport const getUserRatingTitle = (el: HTMLElement): string => {\n return el.querySelector('td.name .film-title-name').text;\n};\n\nexport const getUserRatingYear = (el: HTMLElement): number => {\n return +el.querySelectorAll('td.name .film-title-info .info')[0]?.text.slice(1, -1) || null;\n};\n\nexport const getUserRatingColorRating = (el: HTMLElement): CSFDColorRating => {\n const color = parseColor(el.querySelector('td.name .icon').classNames.split(' ').pop() as Colors);\n return color;\n};\n\nexport const getUserRatingDate = (el: HTMLElement): string => {\n return el.querySelector('td.date-only').text.trim();\n};\n\nexport const getUserRatingUrl = (el: HTMLElement): string => {\n const url = el.querySelector('td.name .film-title-name').attributes.href;\n return `https://www.csfd.cz${url}`;\n};\n
|
|
1
|
+
{"version":3,"file":"user-ratings.helper.js","names":["parseIdFromUrl","parseColor"],"sources":["../../src/helpers/user-ratings.helper.ts"],"sourcesContent":["import { HTMLElement } from 'node-html-parser';\nimport { CSFDColorRating, CSFDFilmTypes, CSFDStars } from '../dto/global';\nimport { Colors } from '../dto/user-ratings';\nimport { parseColor, parseIdFromUrl } from './global.helper';\n\nexport const getUserRatingId = (el: HTMLElement): number => {\n const url = el.querySelector('td.name .film-title-name').attributes.href;\n return parseIdFromUrl(url);\n};\n\nexport const getUserRating = (el: HTMLElement): CSFDStars => {\n const ratingText = el.querySelector('td.star-rating-only .stars').classNames.split(' ').pop();\n\n const rating = ratingText.includes('stars-') ? +ratingText.split('-').pop() : 0;\n return rating as CSFDStars;\n};\n\nexport const getUserRatingType = (el: HTMLElement): CSFDFilmTypes => {\n const typeText = el.querySelectorAll('td.name .film-title-info .info');\n\n return (typeText.length > 1 ? typeText[1].text.slice(1, -1) : 'film') as CSFDFilmTypes;\n};\n\nexport const getUserRatingTitle = (el: HTMLElement): string => {\n return el.querySelector('td.name .film-title-name').text;\n};\n\nexport const getUserRatingYear = (el: HTMLElement): number => {\n return +el.querySelectorAll('td.name .film-title-info .info')[0]?.text.slice(1, -1) || null;\n};\n\nexport const getUserRatingColorRating = (el: HTMLElement): CSFDColorRating => {\n const color = parseColor(el.querySelector('td.name .icon').classNames.split(' ').pop() as Colors);\n return color;\n};\n\nexport const getUserRatingDate = (el: HTMLElement): string => {\n return el.querySelector('td.date-only').text.trim();\n};\n\nexport const getUserRatingUrl = (el: HTMLElement): string => {\n const url = el.querySelector('td.name .film-title-name').attributes.href;\n return `https://www.csfd.cz${url}`;\n};\n"],"mappings":";;;AAKA,MAAa,mBAAmB,OAA4B;CAC1D,MAAM,MAAM,GAAG,cAAc,2BAA2B,CAAC,WAAW;AACpE,QAAOA,qCAAe,IAAI;;AAG5B,MAAa,iBAAiB,OAA+B;CAC3D,MAAM,aAAa,GAAG,cAAc,6BAA6B,CAAC,WAAW,MAAM,IAAI,CAAC,KAAK;AAG7F,QADe,WAAW,SAAS,SAAS,GAAG,CAAC,WAAW,MAAM,IAAI,CAAC,KAAK,GAAG;;AAIhF,MAAa,qBAAqB,OAAmC;CACnE,MAAM,WAAW,GAAG,iBAAiB,iCAAiC;AAEtE,QAAQ,SAAS,SAAS,IAAI,SAAS,GAAG,KAAK,MAAM,GAAG,GAAG,GAAG;;AAGhE,MAAa,sBAAsB,OAA4B;AAC7D,QAAO,GAAG,cAAc,2BAA2B,CAAC;;AAGtD,MAAa,qBAAqB,OAA4B;AAC5D,QAAO,CAAC,GAAG,iBAAiB,iCAAiC,CAAC,IAAI,KAAK,MAAM,GAAG,GAAG,IAAI;;AAGzF,MAAa,4BAA4B,OAAqC;AAE5E,QADcC,iCAAW,GAAG,cAAc,gBAAgB,CAAC,WAAW,MAAM,IAAI,CAAC,KAAK,CAAW;;AAInG,MAAa,qBAAqB,OAA4B;AAC5D,QAAO,GAAG,cAAc,eAAe,CAAC,KAAK,MAAM;;AAGrD,MAAa,oBAAoB,OAA4B;AAE3D,QAAO,sBADK,GAAG,cAAc,2BAA2B,CAAC,WAAW"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseIdFromUrl } from "./global.helper.mjs";
|
|
1
|
+
import { parseColor, parseIdFromUrl } from "./global.helper.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/helpers/user-ratings.helper.ts
|
|
4
4
|
const getUserRatingId = (el) => {
|
|
@@ -28,17 +28,7 @@ const getUserRatingDate = (el) => {
|
|
|
28
28
|
const getUserRatingUrl = (el) => {
|
|
29
29
|
return `https://www.csfd.cz${el.querySelector("td.name .film-title-name").attributes.href}`;
|
|
30
30
|
};
|
|
31
|
-
const parseColor = (quality) => {
|
|
32
|
-
switch (quality) {
|
|
33
|
-
case "lightgrey": return "unknown";
|
|
34
|
-
case "red": return "good";
|
|
35
|
-
case "blue": return "average";
|
|
36
|
-
case "grey": return "bad";
|
|
37
|
-
default: return "unknown";
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
const sleep = (ms) => new Promise((res) => setTimeout(res, ms));
|
|
41
31
|
|
|
42
32
|
//#endregion
|
|
43
|
-
export { getUserRating, getUserRatingColorRating, getUserRatingDate, getUserRatingId, getUserRatingTitle, getUserRatingType, getUserRatingUrl, getUserRatingYear
|
|
33
|
+
export { getUserRating, getUserRatingColorRating, getUserRatingDate, getUserRatingId, getUserRatingTitle, getUserRatingType, getUserRatingUrl, getUserRatingYear };
|
|
44
34
|
//# sourceMappingURL=user-ratings.helper.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-ratings.helper.mjs","names":[],"sources":["../../src/helpers/user-ratings.helper.ts"],"sourcesContent":["import { HTMLElement } from 'node-html-parser';\nimport { CSFDColorRating, CSFDFilmTypes, CSFDStars } from '../dto/global';\nimport { Colors } from '../dto/user-ratings';\nimport { parseIdFromUrl } from './global.helper';\n\nexport const getUserRatingId = (el: HTMLElement): number => {\n const url = el.querySelector('td.name .film-title-name').attributes.href;\n return parseIdFromUrl(url);\n};\n\nexport const getUserRating = (el: HTMLElement): CSFDStars => {\n const ratingText = el.querySelector('td.star-rating-only .stars').classNames.split(' ').pop();\n\n const rating = ratingText.includes('stars-') ? +ratingText.split('-').pop() : 0;\n return rating as CSFDStars;\n};\n\nexport const getUserRatingType = (el: HTMLElement): CSFDFilmTypes => {\n const typeText = el.querySelectorAll('td.name .film-title-info .info');\n\n return (typeText.length > 1 ? typeText[1].text.slice(1, -1) : 'film') as CSFDFilmTypes;\n};\n\nexport const getUserRatingTitle = (el: HTMLElement): string => {\n return el.querySelector('td.name .film-title-name').text;\n};\n\nexport const getUserRatingYear = (el: HTMLElement): number => {\n return +el.querySelectorAll('td.name .film-title-info .info')[0]?.text.slice(1, -1) || null;\n};\n\nexport const getUserRatingColorRating = (el: HTMLElement): CSFDColorRating => {\n const color = parseColor(el.querySelector('td.name .icon').classNames.split(' ').pop() as Colors);\n return color;\n};\n\nexport const getUserRatingDate = (el: HTMLElement): string => {\n return el.querySelector('td.date-only').text.trim();\n};\n\nexport const getUserRatingUrl = (el: HTMLElement): string => {\n const url = el.querySelector('td.name .film-title-name').attributes.href;\n return `https://www.csfd.cz${url}`;\n};\n
|
|
1
|
+
{"version":3,"file":"user-ratings.helper.mjs","names":[],"sources":["../../src/helpers/user-ratings.helper.ts"],"sourcesContent":["import { HTMLElement } from 'node-html-parser';\nimport { CSFDColorRating, CSFDFilmTypes, CSFDStars } from '../dto/global';\nimport { Colors } from '../dto/user-ratings';\nimport { parseColor, parseIdFromUrl } from './global.helper';\n\nexport const getUserRatingId = (el: HTMLElement): number => {\n const url = el.querySelector('td.name .film-title-name').attributes.href;\n return parseIdFromUrl(url);\n};\n\nexport const getUserRating = (el: HTMLElement): CSFDStars => {\n const ratingText = el.querySelector('td.star-rating-only .stars').classNames.split(' ').pop();\n\n const rating = ratingText.includes('stars-') ? +ratingText.split('-').pop() : 0;\n return rating as CSFDStars;\n};\n\nexport const getUserRatingType = (el: HTMLElement): CSFDFilmTypes => {\n const typeText = el.querySelectorAll('td.name .film-title-info .info');\n\n return (typeText.length > 1 ? typeText[1].text.slice(1, -1) : 'film') as CSFDFilmTypes;\n};\n\nexport const getUserRatingTitle = (el: HTMLElement): string => {\n return el.querySelector('td.name .film-title-name').text;\n};\n\nexport const getUserRatingYear = (el: HTMLElement): number => {\n return +el.querySelectorAll('td.name .film-title-info .info')[0]?.text.slice(1, -1) || null;\n};\n\nexport const getUserRatingColorRating = (el: HTMLElement): CSFDColorRating => {\n const color = parseColor(el.querySelector('td.name .icon').classNames.split(' ').pop() as Colors);\n return color;\n};\n\nexport const getUserRatingDate = (el: HTMLElement): string => {\n return el.querySelector('td.date-only').text.trim();\n};\n\nexport const getUserRatingUrl = (el: HTMLElement): string => {\n const url = el.querySelector('td.name .film-title-name').attributes.href;\n return `https://www.csfd.cz${url}`;\n};\n"],"mappings":";;;AAKA,MAAa,mBAAmB,OAA4B;CAC1D,MAAM,MAAM,GAAG,cAAc,2BAA2B,CAAC,WAAW;AACpE,QAAO,eAAe,IAAI;;AAG5B,MAAa,iBAAiB,OAA+B;CAC3D,MAAM,aAAa,GAAG,cAAc,6BAA6B,CAAC,WAAW,MAAM,IAAI,CAAC,KAAK;AAG7F,QADe,WAAW,SAAS,SAAS,GAAG,CAAC,WAAW,MAAM,IAAI,CAAC,KAAK,GAAG;;AAIhF,MAAa,qBAAqB,OAAmC;CACnE,MAAM,WAAW,GAAG,iBAAiB,iCAAiC;AAEtE,QAAQ,SAAS,SAAS,IAAI,SAAS,GAAG,KAAK,MAAM,GAAG,GAAG,GAAG;;AAGhE,MAAa,sBAAsB,OAA4B;AAC7D,QAAO,GAAG,cAAc,2BAA2B,CAAC;;AAGtD,MAAa,qBAAqB,OAA4B;AAC5D,QAAO,CAAC,GAAG,iBAAiB,iCAAiC,CAAC,IAAI,KAAK,MAAM,GAAG,GAAG,IAAI;;AAGzF,MAAa,4BAA4B,OAAqC;AAE5E,QADc,WAAW,GAAG,cAAc,gBAAgB,CAAC,WAAW,MAAM,IAAI,CAAC,KAAK,CAAW;;AAInG,MAAa,qBAAqB,OAA4B;AAC5D,QAAO,GAAG,cAAc,eAAe,CAAC,KAAK,MAAM;;AAGrD,MAAa,oBAAoB,OAA4B;AAE3D,QAAO,sBADK,GAAG,cAAc,2BAA2B,CAAC,WAAW"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const require_global_helper = require('./global.helper.js');
|
|
2
|
+
|
|
3
|
+
//#region src/helpers/user-reviews.helper.ts
|
|
4
|
+
const getUserReviewId = (el) => {
|
|
5
|
+
const url = el.querySelector(".film-title-name").attributes.href;
|
|
6
|
+
return require_global_helper.parseIdFromUrl(url);
|
|
7
|
+
};
|
|
8
|
+
const getUserReviewRating = (el) => {
|
|
9
|
+
const ratingText = el.querySelector(".star-rating .stars").classNames.split(" ").pop();
|
|
10
|
+
return ratingText.includes("stars-") ? +ratingText.split("-").pop() : 0;
|
|
11
|
+
};
|
|
12
|
+
const getUserReviewType = (el) => {
|
|
13
|
+
const typeText = el.querySelectorAll(".film-title-info .info");
|
|
14
|
+
return typeText.length > 1 ? typeText[1].text.slice(1, -1) : "film";
|
|
15
|
+
};
|
|
16
|
+
const getUserReviewTitle = (el) => {
|
|
17
|
+
return el.querySelector(".film-title-name").text;
|
|
18
|
+
};
|
|
19
|
+
const getUserReviewYear = (el) => {
|
|
20
|
+
const infoSpan = el.querySelector(".film-title-info .info");
|
|
21
|
+
return infoSpan ? +infoSpan.text.replace(/[()]/g, "") : null;
|
|
22
|
+
};
|
|
23
|
+
const getUserReviewColorRating = (el) => {
|
|
24
|
+
return require_global_helper.parseColor(el.querySelector(".film-title-nooverflow .icon")?.classNames.split(" ").pop());
|
|
25
|
+
};
|
|
26
|
+
const getUserReviewDate = (el) => {
|
|
27
|
+
return el.querySelector(".header-right-info .info time").text.trim();
|
|
28
|
+
};
|
|
29
|
+
const getUserReviewUrl = (el) => {
|
|
30
|
+
return `https://www.csfd.cz${el.querySelector(".film-title-name").attributes.href}`;
|
|
31
|
+
};
|
|
32
|
+
const getUserReviewText = (el) => {
|
|
33
|
+
return el.querySelector(".user-reviews-text .comment").text.trim();
|
|
34
|
+
};
|
|
35
|
+
const getUserReviewPoster = (el) => {
|
|
36
|
+
const img = el.querySelector(".article-img img");
|
|
37
|
+
const srcset = img?.attributes.srcset;
|
|
38
|
+
if (srcset) {
|
|
39
|
+
const poster3x = srcset.split(",").map((s) => s.trim()).find((s) => s.endsWith("3x"));
|
|
40
|
+
if (poster3x) return `https:${poster3x.replace(/\s+3x$/, "").trim()}`;
|
|
41
|
+
}
|
|
42
|
+
const src = img?.attributes.src;
|
|
43
|
+
return src ? `https:${src}` : null;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
exports.getUserReviewColorRating = getUserReviewColorRating;
|
|
48
|
+
exports.getUserReviewDate = getUserReviewDate;
|
|
49
|
+
exports.getUserReviewId = getUserReviewId;
|
|
50
|
+
exports.getUserReviewPoster = getUserReviewPoster;
|
|
51
|
+
exports.getUserReviewRating = getUserReviewRating;
|
|
52
|
+
exports.getUserReviewText = getUserReviewText;
|
|
53
|
+
exports.getUserReviewTitle = getUserReviewTitle;
|
|
54
|
+
exports.getUserReviewType = getUserReviewType;
|
|
55
|
+
exports.getUserReviewUrl = getUserReviewUrl;
|
|
56
|
+
exports.getUserReviewYear = getUserReviewYear;
|
|
57
|
+
//# sourceMappingURL=user-reviews.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-reviews.helper.js","names":["parseIdFromUrl","parseColor"],"sources":["../../src/helpers/user-reviews.helper.ts"],"sourcesContent":["import { HTMLElement } from 'node-html-parser';\nimport { CSFDColorRating, CSFDFilmTypes, CSFDStars } from '../dto/global';\nimport { Colors } from '../dto/user-ratings';\nimport { parseColor, parseIdFromUrl } from './global.helper';\n\nexport const getUserReviewId = (el: HTMLElement): number => {\n const url = el.querySelector('.film-title-name').attributes.href;\n return parseIdFromUrl(url);\n};\n\nexport const getUserReviewRating = (el: HTMLElement): CSFDStars => {\n const ratingText = el.querySelector('.star-rating .stars').classNames.split(' ').pop();\n\n const rating = ratingText.includes('stars-') ? +ratingText.split('-').pop() : 0;\n return rating as CSFDStars;\n};\n\nexport const getUserReviewType = (el: HTMLElement): CSFDFilmTypes => {\n // Type can be in the second .info span (e.g., \"(seriál)\") // TODO need more tests\n const typeText = el.querySelectorAll('.film-title-info .info');\n\n return (typeText.length > 1 ? typeText[1].text.slice(1, -1) : 'film') as CSFDFilmTypes;\n};\n\nexport const getUserReviewTitle = (el: HTMLElement): string => {\n return el.querySelector('.film-title-name').text;\n};\n\nexport const getUserReviewYear = (el: HTMLElement): number => {\n const infoSpan = el.querySelector('.film-title-info .info');\n return infoSpan ? +infoSpan.text.replace(/[()]/g, '') : null;\n};\n\nexport const getUserReviewColorRating = (el: HTMLElement): CSFDColorRating => {\n const icon = el.querySelector('.film-title-nooverflow .icon');\n const color = parseColor(icon?.classNames.split(' ').pop() as Colors);\n return color;\n};\n\nexport const getUserReviewDate = (el: HTMLElement): string => {\n return el.querySelector('.header-right-info .info time').text.trim();\n};\n\nexport const getUserReviewUrl = (el: HTMLElement): string => {\n const url = el.querySelector('.film-title-name').attributes.href;\n return `https://www.csfd.cz${url}`;\n};\n\nexport const getUserReviewText = (el: HTMLElement): string => {\n return el.querySelector('.user-reviews-text .comment').text.trim();\n};\n\nexport const getUserReviewPoster = (el: HTMLElement): string => {\n const img = el.querySelector('.article-img img');\n const srcset = img?.attributes.srcset;\n\n if (srcset) {\n // Extract 3x version from srcset (e.g., \"url 1x, url 2x, url 3x\")\n const srcsetParts = srcset.split(',').map((s) => s.trim());\n const poster3x = srcsetParts.find((s) => s.endsWith('3x'));\n if (poster3x) {\n const url = poster3x.replace(/\\s+3x$/, '').trim();\n return `https:${url}`;\n }\n }\n\n // Fallback to src if srcset not available\n const src = img?.attributes.src;\n return src ? `https:${src}` : null;\n};\n"],"mappings":";;;AAKA,MAAa,mBAAmB,OAA4B;CAC1D,MAAM,MAAM,GAAG,cAAc,mBAAmB,CAAC,WAAW;AAC5D,QAAOA,qCAAe,IAAI;;AAG5B,MAAa,uBAAuB,OAA+B;CACjE,MAAM,aAAa,GAAG,cAAc,sBAAsB,CAAC,WAAW,MAAM,IAAI,CAAC,KAAK;AAGtF,QADe,WAAW,SAAS,SAAS,GAAG,CAAC,WAAW,MAAM,IAAI,CAAC,KAAK,GAAG;;AAIhF,MAAa,qBAAqB,OAAmC;CAEnE,MAAM,WAAW,GAAG,iBAAiB,yBAAyB;AAE9D,QAAQ,SAAS,SAAS,IAAI,SAAS,GAAG,KAAK,MAAM,GAAG,GAAG,GAAG;;AAGhE,MAAa,sBAAsB,OAA4B;AAC7D,QAAO,GAAG,cAAc,mBAAmB,CAAC;;AAG9C,MAAa,qBAAqB,OAA4B;CAC5D,MAAM,WAAW,GAAG,cAAc,yBAAyB;AAC3D,QAAO,WAAW,CAAC,SAAS,KAAK,QAAQ,SAAS,GAAG,GAAG;;AAG1D,MAAa,4BAA4B,OAAqC;AAG5E,QADcC,iCADD,GAAG,cAAc,+BAA+B,EAC9B,WAAW,MAAM,IAAI,CAAC,KAAK,CAAW;;AAIvE,MAAa,qBAAqB,OAA4B;AAC5D,QAAO,GAAG,cAAc,gCAAgC,CAAC,KAAK,MAAM;;AAGtE,MAAa,oBAAoB,OAA4B;AAE3D,QAAO,sBADK,GAAG,cAAc,mBAAmB,CAAC,WAAW;;AAI9D,MAAa,qBAAqB,OAA4B;AAC5D,QAAO,GAAG,cAAc,8BAA8B,CAAC,KAAK,MAAM;;AAGpE,MAAa,uBAAuB,OAA4B;CAC9D,MAAM,MAAM,GAAG,cAAc,mBAAmB;CAChD,MAAM,SAAS,KAAK,WAAW;AAE/B,KAAI,QAAQ;EAGV,MAAM,WADc,OAAO,MAAM,IAAI,CAAC,KAAK,MAAM,EAAE,MAAM,CAAC,CAC7B,MAAM,MAAM,EAAE,SAAS,KAAK,CAAC;AAC1D,MAAI,SAEF,QAAO,SADK,SAAS,QAAQ,UAAU,GAAG,CAAC,MAAM;;CAMrD,MAAM,MAAM,KAAK,WAAW;AAC5B,QAAO,MAAM,SAAS,QAAQ"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { parseColor, parseIdFromUrl } from "./global.helper.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/helpers/user-reviews.helper.ts
|
|
4
|
+
const getUserReviewId = (el) => {
|
|
5
|
+
const url = el.querySelector(".film-title-name").attributes.href;
|
|
6
|
+
return parseIdFromUrl(url);
|
|
7
|
+
};
|
|
8
|
+
const getUserReviewRating = (el) => {
|
|
9
|
+
const ratingText = el.querySelector(".star-rating .stars").classNames.split(" ").pop();
|
|
10
|
+
return ratingText.includes("stars-") ? +ratingText.split("-").pop() : 0;
|
|
11
|
+
};
|
|
12
|
+
const getUserReviewType = (el) => {
|
|
13
|
+
const typeText = el.querySelectorAll(".film-title-info .info");
|
|
14
|
+
return typeText.length > 1 ? typeText[1].text.slice(1, -1) : "film";
|
|
15
|
+
};
|
|
16
|
+
const getUserReviewTitle = (el) => {
|
|
17
|
+
return el.querySelector(".film-title-name").text;
|
|
18
|
+
};
|
|
19
|
+
const getUserReviewYear = (el) => {
|
|
20
|
+
const infoSpan = el.querySelector(".film-title-info .info");
|
|
21
|
+
return infoSpan ? +infoSpan.text.replace(/[()]/g, "") : null;
|
|
22
|
+
};
|
|
23
|
+
const getUserReviewColorRating = (el) => {
|
|
24
|
+
return parseColor(el.querySelector(".film-title-nooverflow .icon")?.classNames.split(" ").pop());
|
|
25
|
+
};
|
|
26
|
+
const getUserReviewDate = (el) => {
|
|
27
|
+
return el.querySelector(".header-right-info .info time").text.trim();
|
|
28
|
+
};
|
|
29
|
+
const getUserReviewUrl = (el) => {
|
|
30
|
+
return `https://www.csfd.cz${el.querySelector(".film-title-name").attributes.href}`;
|
|
31
|
+
};
|
|
32
|
+
const getUserReviewText = (el) => {
|
|
33
|
+
return el.querySelector(".user-reviews-text .comment").text.trim();
|
|
34
|
+
};
|
|
35
|
+
const getUserReviewPoster = (el) => {
|
|
36
|
+
const img = el.querySelector(".article-img img");
|
|
37
|
+
const srcset = img?.attributes.srcset;
|
|
38
|
+
if (srcset) {
|
|
39
|
+
const poster3x = srcset.split(",").map((s) => s.trim()).find((s) => s.endsWith("3x"));
|
|
40
|
+
if (poster3x) return `https:${poster3x.replace(/\s+3x$/, "").trim()}`;
|
|
41
|
+
}
|
|
42
|
+
const src = img?.attributes.src;
|
|
43
|
+
return src ? `https:${src}` : null;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
export { getUserReviewColorRating, getUserReviewDate, getUserReviewId, getUserReviewPoster, getUserReviewRating, getUserReviewText, getUserReviewTitle, getUserReviewType, getUserReviewUrl, getUserReviewYear };
|
|
48
|
+
//# sourceMappingURL=user-reviews.helper.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-reviews.helper.mjs","names":[],"sources":["../../src/helpers/user-reviews.helper.ts"],"sourcesContent":["import { HTMLElement } from 'node-html-parser';\nimport { CSFDColorRating, CSFDFilmTypes, CSFDStars } from '../dto/global';\nimport { Colors } from '../dto/user-ratings';\nimport { parseColor, parseIdFromUrl } from './global.helper';\n\nexport const getUserReviewId = (el: HTMLElement): number => {\n const url = el.querySelector('.film-title-name').attributes.href;\n return parseIdFromUrl(url);\n};\n\nexport const getUserReviewRating = (el: HTMLElement): CSFDStars => {\n const ratingText = el.querySelector('.star-rating .stars').classNames.split(' ').pop();\n\n const rating = ratingText.includes('stars-') ? +ratingText.split('-').pop() : 0;\n return rating as CSFDStars;\n};\n\nexport const getUserReviewType = (el: HTMLElement): CSFDFilmTypes => {\n // Type can be in the second .info span (e.g., \"(seriál)\") // TODO need more tests\n const typeText = el.querySelectorAll('.film-title-info .info');\n\n return (typeText.length > 1 ? typeText[1].text.slice(1, -1) : 'film') as CSFDFilmTypes;\n};\n\nexport const getUserReviewTitle = (el: HTMLElement): string => {\n return el.querySelector('.film-title-name').text;\n};\n\nexport const getUserReviewYear = (el: HTMLElement): number => {\n const infoSpan = el.querySelector('.film-title-info .info');\n return infoSpan ? +infoSpan.text.replace(/[()]/g, '') : null;\n};\n\nexport const getUserReviewColorRating = (el: HTMLElement): CSFDColorRating => {\n const icon = el.querySelector('.film-title-nooverflow .icon');\n const color = parseColor(icon?.classNames.split(' ').pop() as Colors);\n return color;\n};\n\nexport const getUserReviewDate = (el: HTMLElement): string => {\n return el.querySelector('.header-right-info .info time').text.trim();\n};\n\nexport const getUserReviewUrl = (el: HTMLElement): string => {\n const url = el.querySelector('.film-title-name').attributes.href;\n return `https://www.csfd.cz${url}`;\n};\n\nexport const getUserReviewText = (el: HTMLElement): string => {\n return el.querySelector('.user-reviews-text .comment').text.trim();\n};\n\nexport const getUserReviewPoster = (el: HTMLElement): string => {\n const img = el.querySelector('.article-img img');\n const srcset = img?.attributes.srcset;\n\n if (srcset) {\n // Extract 3x version from srcset (e.g., \"url 1x, url 2x, url 3x\")\n const srcsetParts = srcset.split(',').map((s) => s.trim());\n const poster3x = srcsetParts.find((s) => s.endsWith('3x'));\n if (poster3x) {\n const url = poster3x.replace(/\\s+3x$/, '').trim();\n return `https:${url}`;\n }\n }\n\n // Fallback to src if srcset not available\n const src = img?.attributes.src;\n return src ? `https:${src}` : null;\n};\n"],"mappings":";;;AAKA,MAAa,mBAAmB,OAA4B;CAC1D,MAAM,MAAM,GAAG,cAAc,mBAAmB,CAAC,WAAW;AAC5D,QAAO,eAAe,IAAI;;AAG5B,MAAa,uBAAuB,OAA+B;CACjE,MAAM,aAAa,GAAG,cAAc,sBAAsB,CAAC,WAAW,MAAM,IAAI,CAAC,KAAK;AAGtF,QADe,WAAW,SAAS,SAAS,GAAG,CAAC,WAAW,MAAM,IAAI,CAAC,KAAK,GAAG;;AAIhF,MAAa,qBAAqB,OAAmC;CAEnE,MAAM,WAAW,GAAG,iBAAiB,yBAAyB;AAE9D,QAAQ,SAAS,SAAS,IAAI,SAAS,GAAG,KAAK,MAAM,GAAG,GAAG,GAAG;;AAGhE,MAAa,sBAAsB,OAA4B;AAC7D,QAAO,GAAG,cAAc,mBAAmB,CAAC;;AAG9C,MAAa,qBAAqB,OAA4B;CAC5D,MAAM,WAAW,GAAG,cAAc,yBAAyB;AAC3D,QAAO,WAAW,CAAC,SAAS,KAAK,QAAQ,SAAS,GAAG,GAAG;;AAG1D,MAAa,4BAA4B,OAAqC;AAG5E,QADc,WADD,GAAG,cAAc,+BAA+B,EAC9B,WAAW,MAAM,IAAI,CAAC,KAAK,CAAW;;AAIvE,MAAa,qBAAqB,OAA4B;AAC5D,QAAO,GAAG,cAAc,gCAAgC,CAAC,KAAK,MAAM;;AAGtE,MAAa,oBAAoB,OAA4B;AAE3D,QAAO,sBADK,GAAG,cAAc,mBAAmB,CAAC,WAAW;;AAI9D,MAAa,qBAAqB,OAA4B;AAC5D,QAAO,GAAG,cAAc,8BAA8B,CAAC,KAAK,MAAM;;AAGpE,MAAa,uBAAuB,OAA4B;CAC9D,MAAM,MAAM,GAAG,cAAc,mBAAmB;CAChD,MAAM,SAAS,KAAK,WAAW;AAE/B,KAAI,QAAQ;EAGV,MAAM,WADc,OAAO,MAAM,IAAI,CAAC,KAAK,MAAM,EAAE,MAAM,CAAC,CAC7B,MAAM,MAAM,EAAE,SAAS,KAAK,CAAC;AAC1D,MAAI,SAEF,QAAO,SADK,SAAS,QAAQ,UAAU,GAAG,CAAC,MAAM;;CAMrD,MAAM,MAAM,KAAK,WAAW;AAC5B,QAAO,MAAM,SAAS,QAAQ"}
|
package/index.d.mts
CHANGED
|
@@ -4,27 +4,31 @@ import { CSFDCinema, CSFDCinemaGroupedFilmsByDate, CSFDCinemaMeta, CSFDCinemaMov
|
|
|
4
4
|
import { CSFDCreator, CSFDCreatorScreening } from "./dto/creator.mjs";
|
|
5
5
|
import { CSFDSearch, CSFDSearchCreator, CSFDSearchCreators, CSFDSearchMovie, CSFDSearchUser } from "./dto/search.mjs";
|
|
6
6
|
import { CSFDUserRatingConfig, CSFDUserRatings, Colors } from "./dto/user-ratings.mjs";
|
|
7
|
+
import { CSFDUserReviews, CSFDUserReviewsConfig } from "./dto/user-reviews.mjs";
|
|
7
8
|
import { CinemaScraper } from "./services/cinema.service.mjs";
|
|
8
9
|
import { CreatorScraper } from "./services/creator.service.mjs";
|
|
9
10
|
import { MovieScraper } from "./services/movie.service.mjs";
|
|
10
11
|
import { SearchScraper } from "./services/search.service.mjs";
|
|
11
12
|
import { UserRatingsScraper } from "./services/user-ratings.service.mjs";
|
|
13
|
+
import { UserReviewsScraper } from "./services/user-reviews.service.mjs";
|
|
12
14
|
|
|
13
15
|
//#region src/index.d.ts
|
|
14
16
|
declare class Csfd {
|
|
15
17
|
private userRatingsService;
|
|
18
|
+
private userReviewsService;
|
|
16
19
|
private movieService;
|
|
17
20
|
private creatorService;
|
|
18
21
|
private searchService;
|
|
19
22
|
private cinemaService;
|
|
20
23
|
private defaultOptionsRequest?;
|
|
21
|
-
constructor(userRatingsService: UserRatingsScraper, movieService: MovieScraper, creatorService: CreatorScraper, searchService: SearchScraper, cinemaService: CinemaScraper, defaultOptionsRequest?: RequestInit);
|
|
24
|
+
constructor(userRatingsService: UserRatingsScraper, userReviewsService: UserReviewsScraper, movieService: MovieScraper, creatorService: CreatorScraper, searchService: SearchScraper, cinemaService: CinemaScraper, defaultOptionsRequest?: RequestInit);
|
|
22
25
|
setOptions({
|
|
23
26
|
optionsRequest
|
|
24
27
|
}: {
|
|
25
28
|
optionsRequest: RequestInit;
|
|
26
29
|
}): void;
|
|
27
30
|
userRatings(user: string | number, config?: CSFDUserRatingConfig, optionsRequest?: RequestInit): Promise<CSFDUserRatings[]>;
|
|
31
|
+
userReviews(user: string | number, config?: CSFDUserReviewsConfig, optionsRequest?: RequestInit): Promise<CSFDUserReviews[]>;
|
|
28
32
|
movie(movie: number, optionsRequest?: RequestInit): Promise<CSFDMovie>;
|
|
29
33
|
creator(creator: number, optionsRequest?: RequestInit): Promise<CSFDCreator>;
|
|
30
34
|
search(text: string, optionsRequest?: RequestInit): Promise<CSFDSearch>;
|
package/index.d.ts
CHANGED
|
@@ -4,27 +4,31 @@ import { CSFDCinema, CSFDCinemaGroupedFilmsByDate, CSFDCinemaMeta, CSFDCinemaMov
|
|
|
4
4
|
import { CSFDCreator, CSFDCreatorScreening } from "./dto/creator.js";
|
|
5
5
|
import { CSFDSearch, CSFDSearchCreator, CSFDSearchCreators, CSFDSearchMovie, CSFDSearchUser } from "./dto/search.js";
|
|
6
6
|
import { CSFDUserRatingConfig, CSFDUserRatings, Colors } from "./dto/user-ratings.js";
|
|
7
|
+
import { CSFDUserReviews, CSFDUserReviewsConfig } from "./dto/user-reviews.js";
|
|
7
8
|
import { CinemaScraper } from "./services/cinema.service.js";
|
|
8
9
|
import { CreatorScraper } from "./services/creator.service.js";
|
|
9
10
|
import { MovieScraper } from "./services/movie.service.js";
|
|
10
11
|
import { SearchScraper } from "./services/search.service.js";
|
|
11
12
|
import { UserRatingsScraper } from "./services/user-ratings.service.js";
|
|
13
|
+
import { UserReviewsScraper } from "./services/user-reviews.service.js";
|
|
12
14
|
|
|
13
15
|
//#region src/index.d.ts
|
|
14
16
|
declare class Csfd {
|
|
15
17
|
private userRatingsService;
|
|
18
|
+
private userReviewsService;
|
|
16
19
|
private movieService;
|
|
17
20
|
private creatorService;
|
|
18
21
|
private searchService;
|
|
19
22
|
private cinemaService;
|
|
20
23
|
private defaultOptionsRequest?;
|
|
21
|
-
constructor(userRatingsService: UserRatingsScraper, movieService: MovieScraper, creatorService: CreatorScraper, searchService: SearchScraper, cinemaService: CinemaScraper, defaultOptionsRequest?: RequestInit);
|
|
24
|
+
constructor(userRatingsService: UserRatingsScraper, userReviewsService: UserReviewsScraper, movieService: MovieScraper, creatorService: CreatorScraper, searchService: SearchScraper, cinemaService: CinemaScraper, defaultOptionsRequest?: RequestInit);
|
|
22
25
|
setOptions({
|
|
23
26
|
optionsRequest
|
|
24
27
|
}: {
|
|
25
28
|
optionsRequest: RequestInit;
|
|
26
29
|
}): void;
|
|
27
30
|
userRatings(user: string | number, config?: CSFDUserRatingConfig, optionsRequest?: RequestInit): Promise<CSFDUserRatings[]>;
|
|
31
|
+
userReviews(user: string | number, config?: CSFDUserReviewsConfig, optionsRequest?: RequestInit): Promise<CSFDUserReviews[]>;
|
|
28
32
|
movie(movie: number, optionsRequest?: RequestInit): Promise<CSFDMovie>;
|
|
29
33
|
creator(creator: number, optionsRequest?: RequestInit): Promise<CSFDCreator>;
|
|
30
34
|
search(text: string, optionsRequest?: RequestInit): Promise<CSFDSearch>;
|