node-csfd-api 3.2.0 → 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/user-ratings.service.js +4 -2
- package/services/user-ratings.service.js.map +1 -1
- package/services/user-ratings.service.mjs +4 -2
- 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>;
|
package/index.js
CHANGED
|
@@ -3,11 +3,13 @@ const require_creator_service = require('./services/creator.service.js');
|
|
|
3
3
|
const require_movie_service = require('./services/movie.service.js');
|
|
4
4
|
const require_search_service = require('./services/search.service.js');
|
|
5
5
|
const require_user_ratings_service = require('./services/user-ratings.service.js');
|
|
6
|
+
const require_user_reviews_service = require('./services/user-reviews.service.js');
|
|
6
7
|
|
|
7
8
|
//#region src/index.ts
|
|
8
9
|
var Csfd = class {
|
|
9
|
-
constructor(userRatingsService, movieService, creatorService, searchService, cinemaService, defaultOptionsRequest) {
|
|
10
|
+
constructor(userRatingsService, userReviewsService, movieService, creatorService, searchService, cinemaService, defaultOptionsRequest) {
|
|
10
11
|
this.userRatingsService = userRatingsService;
|
|
12
|
+
this.userReviewsService = userReviewsService;
|
|
11
13
|
this.movieService = movieService;
|
|
12
14
|
this.creatorService = creatorService;
|
|
13
15
|
this.searchService = searchService;
|
|
@@ -21,6 +23,10 @@ var Csfd = class {
|
|
|
21
23
|
const opts = optionsRequest ?? this.defaultOptionsRequest;
|
|
22
24
|
return this.userRatingsService.userRatings(user, config, opts);
|
|
23
25
|
}
|
|
26
|
+
async userReviews(user, config, optionsRequest) {
|
|
27
|
+
const opts = optionsRequest ?? this.defaultOptionsRequest;
|
|
28
|
+
return this.userReviewsService.userReviews(user, config, opts);
|
|
29
|
+
}
|
|
24
30
|
async movie(movie, optionsRequest) {
|
|
25
31
|
const opts = optionsRequest ?? this.defaultOptionsRequest;
|
|
26
32
|
return this.movieService.movie(+movie, opts);
|
|
@@ -40,10 +46,11 @@ var Csfd = class {
|
|
|
40
46
|
};
|
|
41
47
|
const movieScraper = new require_movie_service.MovieScraper();
|
|
42
48
|
const userRatingsScraper = new require_user_ratings_service.UserRatingsScraper();
|
|
49
|
+
const userReviewsScraper = new require_user_reviews_service.UserReviewsScraper();
|
|
43
50
|
const cinemaScraper = new require_cinema_service.CinemaScraper();
|
|
44
51
|
const creatorScraper = new require_creator_service.CreatorScraper();
|
|
45
52
|
const searchScraper = new require_search_service.SearchScraper();
|
|
46
|
-
const csfd = new Csfd(userRatingsScraper, movieScraper, creatorScraper, searchScraper, cinemaScraper);
|
|
53
|
+
const csfd = new Csfd(userRatingsScraper, userReviewsScraper, movieScraper, creatorScraper, searchScraper, cinemaScraper);
|
|
47
54
|
|
|
48
55
|
//#endregion
|
|
49
56
|
exports.Csfd = Csfd;
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["userRatingsService: UserRatingsScraper","movieService: MovieScraper","creatorService: CreatorScraper","searchService: SearchScraper","cinemaService: CinemaScraper","MovieScraper","UserRatingsScraper","CinemaScraper","CreatorScraper","SearchScraper"],"sources":["../src/index.ts"],"sourcesContent":["import { CSFDCinema, CSFDCinemaPeriod } from './dto/cinema';\nimport { CSFDCreator } from './dto/creator';\nimport { CSFDMovie } from './dto/movie';\nimport { CSFDSearch } from './dto/search';\nimport { CSFDUserRatingConfig, CSFDUserRatings } from './dto/user-ratings';\nimport { CinemaScraper } from './services/cinema.service';\nimport { CreatorScraper } from './services/creator.service';\nimport { MovieScraper } from './services/movie.service';\nimport { SearchScraper } from './services/search.service';\nimport { UserRatingsScraper } from './services/user-ratings.service';\n\nexport class Csfd {\n private defaultOptionsRequest?: RequestInit;\n\n constructor(\n private userRatingsService: UserRatingsScraper,\n private movieService: MovieScraper,\n private creatorService: CreatorScraper,\n private searchService: SearchScraper,\n private cinemaService: CinemaScraper,\n defaultOptionsRequest?: RequestInit\n ) {\n this.defaultOptionsRequest = defaultOptionsRequest;\n }\n\n public setOptions({ optionsRequest }: { optionsRequest: RequestInit }): void {\n this.defaultOptionsRequest = optionsRequest;\n }\n\n public async userRatings(\n user: string | number,\n config?: CSFDUserRatingConfig,\n optionsRequest?: RequestInit\n ): Promise<CSFDUserRatings[]> {\n const opts = optionsRequest ?? this.defaultOptionsRequest;\n return this.userRatingsService.userRatings(user, config, opts);\n }\n\n public async movie(movie: number, optionsRequest?: RequestInit): Promise<CSFDMovie> {\n const opts = optionsRequest ?? this.defaultOptionsRequest;\n return this.movieService.movie(+movie, opts);\n }\n\n public async creator(creator: number, optionsRequest?: RequestInit): Promise<CSFDCreator> {\n const opts = optionsRequest ?? this.defaultOptionsRequest;\n return this.creatorService.creator(+creator, opts);\n }\n\n public async search(text: string, optionsRequest?: RequestInit): Promise<CSFDSearch> {\n const opts = optionsRequest ?? this.defaultOptionsRequest;\n return this.searchService.search(text, opts);\n }\n\n public async cinema(\n district: number | string,\n period: CSFDCinemaPeriod,\n optionsRequest?: RequestInit\n ): Promise<CSFDCinema[]> {\n const opts = optionsRequest ?? this.defaultOptionsRequest;\n return this.cinemaService.cinemas(+district, period, opts);\n }\n}\n\nconst movieScraper = new MovieScraper();\nconst userRatingsScraper = new UserRatingsScraper();\nconst cinemaScraper = new CinemaScraper();\nconst creatorScraper = new CreatorScraper();\nconst searchScraper = new SearchScraper();\n\nexport const csfd = new Csfd(\n userRatingsScraper,\n movieScraper,\n creatorScraper,\n searchScraper,\n cinemaScraper\n);\n\nexport type * from './dto';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["userRatingsService: UserRatingsScraper","userReviewsService: UserReviewsScraper","movieService: MovieScraper","creatorService: CreatorScraper","searchService: SearchScraper","cinemaService: CinemaScraper","MovieScraper","UserRatingsScraper","UserReviewsScraper","CinemaScraper","CreatorScraper","SearchScraper"],"sources":["../src/index.ts"],"sourcesContent":["import { CSFDCinema, CSFDCinemaPeriod } from './dto/cinema';\nimport { CSFDCreator } from './dto/creator';\nimport { CSFDMovie } from './dto/movie';\nimport { CSFDSearch } from './dto/search';\nimport { CSFDUserRatingConfig, CSFDUserRatings } from './dto/user-ratings';\nimport { CSFDUserReviews, CSFDUserReviewsConfig } from './dto/user-reviews';\nimport { CinemaScraper } from './services/cinema.service';\nimport { CreatorScraper } from './services/creator.service';\nimport { MovieScraper } from './services/movie.service';\nimport { SearchScraper } from './services/search.service';\nimport { UserRatingsScraper } from './services/user-ratings.service';\nimport { UserReviewsScraper } from './services/user-reviews.service';\n\nexport class Csfd {\n private defaultOptionsRequest?: RequestInit;\n\n constructor(\n private userRatingsService: UserRatingsScraper,\n private userReviewsService: UserReviewsScraper,\n private movieService: MovieScraper,\n private creatorService: CreatorScraper,\n private searchService: SearchScraper,\n private cinemaService: CinemaScraper,\n defaultOptionsRequest?: RequestInit\n ) {\n this.defaultOptionsRequest = defaultOptionsRequest;\n }\n\n public setOptions({ optionsRequest }: { optionsRequest: RequestInit }): void {\n this.defaultOptionsRequest = optionsRequest;\n }\n\n public async userRatings(\n user: string | number,\n config?: CSFDUserRatingConfig,\n optionsRequest?: RequestInit\n ): Promise<CSFDUserRatings[]> {\n const opts = optionsRequest ?? this.defaultOptionsRequest;\n return this.userRatingsService.userRatings(user, config, opts);\n }\n\n public async userReviews(\n user: string | number,\n config?: CSFDUserReviewsConfig,\n optionsRequest?: RequestInit\n ): Promise<CSFDUserReviews[]> {\n const opts = optionsRequest ?? this.defaultOptionsRequest;\n return this.userReviewsService.userReviews(user, config, opts);\n }\n\n public async movie(movie: number, optionsRequest?: RequestInit): Promise<CSFDMovie> {\n const opts = optionsRequest ?? this.defaultOptionsRequest;\n return this.movieService.movie(+movie, opts);\n }\n\n public async creator(creator: number, optionsRequest?: RequestInit): Promise<CSFDCreator> {\n const opts = optionsRequest ?? this.defaultOptionsRequest;\n return this.creatorService.creator(+creator, opts);\n }\n\n public async search(text: string, optionsRequest?: RequestInit): Promise<CSFDSearch> {\n const opts = optionsRequest ?? this.defaultOptionsRequest;\n return this.searchService.search(text, opts);\n }\n\n public async cinema(\n district: number | string,\n period: CSFDCinemaPeriod,\n optionsRequest?: RequestInit\n ): Promise<CSFDCinema[]> {\n const opts = optionsRequest ?? this.defaultOptionsRequest;\n return this.cinemaService.cinemas(+district, period, opts);\n }\n}\n\nconst movieScraper = new MovieScraper();\nconst userRatingsScraper = new UserRatingsScraper();\nconst userReviewsScraper = new UserReviewsScraper();\nconst cinemaScraper = new CinemaScraper();\nconst creatorScraper = new CreatorScraper();\nconst searchScraper = new SearchScraper();\n\nexport const csfd = new Csfd(\n userRatingsScraper,\n userReviewsScraper,\n movieScraper,\n creatorScraper,\n searchScraper,\n cinemaScraper\n);\n\nexport type * from './dto';\n"],"mappings":";;;;;;;;AAaA,IAAa,OAAb,MAAkB;CAGhB,YACE,AAAQA,oBACR,AAAQC,oBACR,AAAQC,cACR,AAAQC,gBACR,AAAQC,eACR,AAAQC,eACR,uBACA;EAPQ;EACA;EACA;EACA;EACA;EACA;AAGR,OAAK,wBAAwB;;CAG/B,AAAO,WAAW,EAAE,kBAAyD;AAC3E,OAAK,wBAAwB;;CAG/B,MAAa,YACX,MACA,QACA,gBAC4B;EAC5B,MAAM,OAAO,kBAAkB,KAAK;AACpC,SAAO,KAAK,mBAAmB,YAAY,MAAM,QAAQ,KAAK;;CAGhE,MAAa,YACX,MACA,QACA,gBAC4B;EAC5B,MAAM,OAAO,kBAAkB,KAAK;AACpC,SAAO,KAAK,mBAAmB,YAAY,MAAM,QAAQ,KAAK;;CAGhE,MAAa,MAAM,OAAe,gBAAkD;EAClF,MAAM,OAAO,kBAAkB,KAAK;AACpC,SAAO,KAAK,aAAa,MAAM,CAAC,OAAO,KAAK;;CAG9C,MAAa,QAAQ,SAAiB,gBAAoD;EACxF,MAAM,OAAO,kBAAkB,KAAK;AACpC,SAAO,KAAK,eAAe,QAAQ,CAAC,SAAS,KAAK;;CAGpD,MAAa,OAAO,MAAc,gBAAmD;EACnF,MAAM,OAAO,kBAAkB,KAAK;AACpC,SAAO,KAAK,cAAc,OAAO,MAAM,KAAK;;CAG9C,MAAa,OACX,UACA,QACA,gBACuB;EACvB,MAAM,OAAO,kBAAkB,KAAK;AACpC,SAAO,KAAK,cAAc,QAAQ,CAAC,UAAU,QAAQ,KAAK;;;AAI9D,MAAM,eAAe,IAAIC,oCAAc;AACvC,MAAM,qBAAqB,IAAIC,iDAAoB;AACnD,MAAM,qBAAqB,IAAIC,iDAAoB;AACnD,MAAM,gBAAgB,IAAIC,sCAAe;AACzC,MAAM,iBAAiB,IAAIC,wCAAgB;AAC3C,MAAM,gBAAgB,IAAIC,sCAAe;AAEzC,MAAa,OAAO,IAAI,KACtB,oBACA,oBACA,cACA,gBACA,eACA,cACD"}
|
package/index.mjs
CHANGED
|
@@ -3,11 +3,13 @@ import { CreatorScraper } from "./services/creator.service.mjs";
|
|
|
3
3
|
import { MovieScraper } from "./services/movie.service.mjs";
|
|
4
4
|
import { SearchScraper } from "./services/search.service.mjs";
|
|
5
5
|
import { UserRatingsScraper } from "./services/user-ratings.service.mjs";
|
|
6
|
+
import { UserReviewsScraper } from "./services/user-reviews.service.mjs";
|
|
6
7
|
|
|
7
8
|
//#region src/index.ts
|
|
8
9
|
var Csfd = class {
|
|
9
|
-
constructor(userRatingsService, movieService, creatorService, searchService, cinemaService, defaultOptionsRequest) {
|
|
10
|
+
constructor(userRatingsService, userReviewsService, movieService, creatorService, searchService, cinemaService, defaultOptionsRequest) {
|
|
10
11
|
this.userRatingsService = userRatingsService;
|
|
12
|
+
this.userReviewsService = userReviewsService;
|
|
11
13
|
this.movieService = movieService;
|
|
12
14
|
this.creatorService = creatorService;
|
|
13
15
|
this.searchService = searchService;
|
|
@@ -21,6 +23,10 @@ var Csfd = class {
|
|
|
21
23
|
const opts = optionsRequest ?? this.defaultOptionsRequest;
|
|
22
24
|
return this.userRatingsService.userRatings(user, config, opts);
|
|
23
25
|
}
|
|
26
|
+
async userReviews(user, config, optionsRequest) {
|
|
27
|
+
const opts = optionsRequest ?? this.defaultOptionsRequest;
|
|
28
|
+
return this.userReviewsService.userReviews(user, config, opts);
|
|
29
|
+
}
|
|
24
30
|
async movie(movie, optionsRequest) {
|
|
25
31
|
const opts = optionsRequest ?? this.defaultOptionsRequest;
|
|
26
32
|
return this.movieService.movie(+movie, opts);
|
|
@@ -40,10 +46,11 @@ var Csfd = class {
|
|
|
40
46
|
};
|
|
41
47
|
const movieScraper = new MovieScraper();
|
|
42
48
|
const userRatingsScraper = new UserRatingsScraper();
|
|
49
|
+
const userReviewsScraper = new UserReviewsScraper();
|
|
43
50
|
const cinemaScraper = new CinemaScraper();
|
|
44
51
|
const creatorScraper = new CreatorScraper();
|
|
45
52
|
const searchScraper = new SearchScraper();
|
|
46
|
-
const csfd = new Csfd(userRatingsScraper, movieScraper, creatorScraper, searchScraper, cinemaScraper);
|
|
53
|
+
const csfd = new Csfd(userRatingsScraper, userReviewsScraper, movieScraper, creatorScraper, searchScraper, cinemaScraper);
|
|
47
54
|
|
|
48
55
|
//#endregion
|
|
49
56
|
export { Csfd, csfd };
|
package/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["userRatingsService: UserRatingsScraper","movieService: MovieScraper","creatorService: CreatorScraper","searchService: SearchScraper","cinemaService: CinemaScraper"],"sources":["../src/index.ts"],"sourcesContent":["import { CSFDCinema, CSFDCinemaPeriod } from './dto/cinema';\nimport { CSFDCreator } from './dto/creator';\nimport { CSFDMovie } from './dto/movie';\nimport { CSFDSearch } from './dto/search';\nimport { CSFDUserRatingConfig, CSFDUserRatings } from './dto/user-ratings';\nimport { CinemaScraper } from './services/cinema.service';\nimport { CreatorScraper } from './services/creator.service';\nimport { MovieScraper } from './services/movie.service';\nimport { SearchScraper } from './services/search.service';\nimport { UserRatingsScraper } from './services/user-ratings.service';\n\nexport class Csfd {\n private defaultOptionsRequest?: RequestInit;\n\n constructor(\n private userRatingsService: UserRatingsScraper,\n private movieService: MovieScraper,\n private creatorService: CreatorScraper,\n private searchService: SearchScraper,\n private cinemaService: CinemaScraper,\n defaultOptionsRequest?: RequestInit\n ) {\n this.defaultOptionsRequest = defaultOptionsRequest;\n }\n\n public setOptions({ optionsRequest }: { optionsRequest: RequestInit }): void {\n this.defaultOptionsRequest = optionsRequest;\n }\n\n public async userRatings(\n user: string | number,\n config?: CSFDUserRatingConfig,\n optionsRequest?: RequestInit\n ): Promise<CSFDUserRatings[]> {\n const opts = optionsRequest ?? this.defaultOptionsRequest;\n return this.userRatingsService.userRatings(user, config, opts);\n }\n\n public async movie(movie: number, optionsRequest?: RequestInit): Promise<CSFDMovie> {\n const opts = optionsRequest ?? this.defaultOptionsRequest;\n return this.movieService.movie(+movie, opts);\n }\n\n public async creator(creator: number, optionsRequest?: RequestInit): Promise<CSFDCreator> {\n const opts = optionsRequest ?? this.defaultOptionsRequest;\n return this.creatorService.creator(+creator, opts);\n }\n\n public async search(text: string, optionsRequest?: RequestInit): Promise<CSFDSearch> {\n const opts = optionsRequest ?? this.defaultOptionsRequest;\n return this.searchService.search(text, opts);\n }\n\n public async cinema(\n district: number | string,\n period: CSFDCinemaPeriod,\n optionsRequest?: RequestInit\n ): Promise<CSFDCinema[]> {\n const opts = optionsRequest ?? this.defaultOptionsRequest;\n return this.cinemaService.cinemas(+district, period, opts);\n }\n}\n\nconst movieScraper = new MovieScraper();\nconst userRatingsScraper = new UserRatingsScraper();\nconst cinemaScraper = new CinemaScraper();\nconst creatorScraper = new CreatorScraper();\nconst searchScraper = new SearchScraper();\n\nexport const csfd = new Csfd(\n userRatingsScraper,\n movieScraper,\n creatorScraper,\n searchScraper,\n cinemaScraper\n);\n\nexport type * from './dto';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["userRatingsService: UserRatingsScraper","userReviewsService: UserReviewsScraper","movieService: MovieScraper","creatorService: CreatorScraper","searchService: SearchScraper","cinemaService: CinemaScraper"],"sources":["../src/index.ts"],"sourcesContent":["import { CSFDCinema, CSFDCinemaPeriod } from './dto/cinema';\nimport { CSFDCreator } from './dto/creator';\nimport { CSFDMovie } from './dto/movie';\nimport { CSFDSearch } from './dto/search';\nimport { CSFDUserRatingConfig, CSFDUserRatings } from './dto/user-ratings';\nimport { CSFDUserReviews, CSFDUserReviewsConfig } from './dto/user-reviews';\nimport { CinemaScraper } from './services/cinema.service';\nimport { CreatorScraper } from './services/creator.service';\nimport { MovieScraper } from './services/movie.service';\nimport { SearchScraper } from './services/search.service';\nimport { UserRatingsScraper } from './services/user-ratings.service';\nimport { UserReviewsScraper } from './services/user-reviews.service';\n\nexport class Csfd {\n private defaultOptionsRequest?: RequestInit;\n\n constructor(\n private userRatingsService: UserRatingsScraper,\n private userReviewsService: UserReviewsScraper,\n private movieService: MovieScraper,\n private creatorService: CreatorScraper,\n private searchService: SearchScraper,\n private cinemaService: CinemaScraper,\n defaultOptionsRequest?: RequestInit\n ) {\n this.defaultOptionsRequest = defaultOptionsRequest;\n }\n\n public setOptions({ optionsRequest }: { optionsRequest: RequestInit }): void {\n this.defaultOptionsRequest = optionsRequest;\n }\n\n public async userRatings(\n user: string | number,\n config?: CSFDUserRatingConfig,\n optionsRequest?: RequestInit\n ): Promise<CSFDUserRatings[]> {\n const opts = optionsRequest ?? this.defaultOptionsRequest;\n return this.userRatingsService.userRatings(user, config, opts);\n }\n\n public async userReviews(\n user: string | number,\n config?: CSFDUserReviewsConfig,\n optionsRequest?: RequestInit\n ): Promise<CSFDUserReviews[]> {\n const opts = optionsRequest ?? this.defaultOptionsRequest;\n return this.userReviewsService.userReviews(user, config, opts);\n }\n\n public async movie(movie: number, optionsRequest?: RequestInit): Promise<CSFDMovie> {\n const opts = optionsRequest ?? this.defaultOptionsRequest;\n return this.movieService.movie(+movie, opts);\n }\n\n public async creator(creator: number, optionsRequest?: RequestInit): Promise<CSFDCreator> {\n const opts = optionsRequest ?? this.defaultOptionsRequest;\n return this.creatorService.creator(+creator, opts);\n }\n\n public async search(text: string, optionsRequest?: RequestInit): Promise<CSFDSearch> {\n const opts = optionsRequest ?? this.defaultOptionsRequest;\n return this.searchService.search(text, opts);\n }\n\n public async cinema(\n district: number | string,\n period: CSFDCinemaPeriod,\n optionsRequest?: RequestInit\n ): Promise<CSFDCinema[]> {\n const opts = optionsRequest ?? this.defaultOptionsRequest;\n return this.cinemaService.cinemas(+district, period, opts);\n }\n}\n\nconst movieScraper = new MovieScraper();\nconst userRatingsScraper = new UserRatingsScraper();\nconst userReviewsScraper = new UserReviewsScraper();\nconst cinemaScraper = new CinemaScraper();\nconst creatorScraper = new CreatorScraper();\nconst searchScraper = new SearchScraper();\n\nexport const csfd = new Csfd(\n userRatingsScraper,\n userReviewsScraper,\n movieScraper,\n creatorScraper,\n searchScraper,\n cinemaScraper\n);\n\nexport type * from './dto';\n"],"mappings":";;;;;;;;AAaA,IAAa,OAAb,MAAkB;CAGhB,YACE,AAAQA,oBACR,AAAQC,oBACR,AAAQC,cACR,AAAQC,gBACR,AAAQC,eACR,AAAQC,eACR,uBACA;EAPQ;EACA;EACA;EACA;EACA;EACA;AAGR,OAAK,wBAAwB;;CAG/B,AAAO,WAAW,EAAE,kBAAyD;AAC3E,OAAK,wBAAwB;;CAG/B,MAAa,YACX,MACA,QACA,gBAC4B;EAC5B,MAAM,OAAO,kBAAkB,KAAK;AACpC,SAAO,KAAK,mBAAmB,YAAY,MAAM,QAAQ,KAAK;;CAGhE,MAAa,YACX,MACA,QACA,gBAC4B;EAC5B,MAAM,OAAO,kBAAkB,KAAK;AACpC,SAAO,KAAK,mBAAmB,YAAY,MAAM,QAAQ,KAAK;;CAGhE,MAAa,MAAM,OAAe,gBAAkD;EAClF,MAAM,OAAO,kBAAkB,KAAK;AACpC,SAAO,KAAK,aAAa,MAAM,CAAC,OAAO,KAAK;;CAG9C,MAAa,QAAQ,SAAiB,gBAAoD;EACxF,MAAM,OAAO,kBAAkB,KAAK;AACpC,SAAO,KAAK,eAAe,QAAQ,CAAC,SAAS,KAAK;;CAGpD,MAAa,OAAO,MAAc,gBAAmD;EACnF,MAAM,OAAO,kBAAkB,KAAK;AACpC,SAAO,KAAK,cAAc,OAAO,MAAM,KAAK;;CAG9C,MAAa,OACX,UACA,QACA,gBACuB;EACvB,MAAM,OAAO,kBAAkB,KAAK;AACpC,SAAO,KAAK,cAAc,QAAQ,CAAC,UAAU,QAAQ,KAAK;;;AAI9D,MAAM,eAAe,IAAI,cAAc;AACvC,MAAM,qBAAqB,IAAI,oBAAoB;AACnD,MAAM,qBAAqB,IAAI,oBAAoB;AACnD,MAAM,gBAAgB,IAAI,eAAe;AACzC,MAAM,iBAAiB,IAAI,gBAAgB;AAC3C,MAAM,gBAAgB,IAAI,eAAe;AAEzC,MAAa,OAAO,IAAI,KACtB,oBACA,oBACA,cACA,gBACA,eACA,cACD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
2
|
const require_index = require('../fetchers/index.js');
|
|
3
3
|
const require_vars = require('../vars.js');
|
|
4
|
+
const require_global_helper = require('../helpers/global.helper.js');
|
|
4
5
|
const require_user_ratings_helper = require('../helpers/user-ratings.helper.js');
|
|
5
6
|
let node_html_parser = require("node-html-parser");
|
|
6
7
|
node_html_parser = require_rolldown_runtime.__toESM(node_html_parser);
|
|
@@ -9,7 +10,8 @@ node_html_parser = require_rolldown_runtime.__toESM(node_html_parser);
|
|
|
9
10
|
var UserRatingsScraper = class {
|
|
10
11
|
async userRatings(user, config, optionsRequest) {
|
|
11
12
|
let allMovies = [];
|
|
12
|
-
const
|
|
13
|
+
const pageToFetch = config?.page || 1;
|
|
14
|
+
const url = require_vars.userRatingsUrl(user, pageToFetch > 1 ? pageToFetch : void 0);
|
|
13
15
|
const items = (0, node_html_parser.parse)(await require_index.fetchPage(url, { ...optionsRequest }));
|
|
14
16
|
const movies = items.querySelectorAll(".box-user-rating .table-container tbody tr");
|
|
15
17
|
const pagesNode = items.querySelector(".pagination");
|
|
@@ -22,7 +24,7 @@ var UserRatingsScraper = class {
|
|
|
22
24
|
console.log("Fetching page", i, "out of", pages, "...");
|
|
23
25
|
const movies$1 = (0, node_html_parser.parse)(await require_index.fetchPage(require_vars.userRatingsUrl(user, i), { ...optionsRequest })).querySelectorAll(".box-user-rating .table-container tbody tr");
|
|
24
26
|
allMovies = [...allMovies, ...this.getPage(config, movies$1)];
|
|
25
|
-
if (config.allPagesDelay) await
|
|
27
|
+
if (config.allPagesDelay) await require_global_helper.sleep(config.allPagesDelay);
|
|
26
28
|
}
|
|
27
29
|
return allMovies;
|
|
28
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-ratings.service.js","names":["allMovies: CSFDUserRatings[]","userRatingsUrl","fetchPage","movies","sleep","films: CSFDUserRatings[]","getUserRatingType","getUserRatingId","getUserRatingTitle","getUserRatingYear","getUserRatingUrl","getUserRatingColorRating","getUserRatingDate","getUserRating"],"sources":["../../src/services/user-ratings.service.ts"],"sourcesContent":["import { HTMLElement, parse } from 'node-html-parser';\nimport { CSFDColorRating, CSFDStars } from '../dto/global';\nimport { CSFDUserRatingConfig, CSFDUserRatings } from '../dto/user-ratings';\nimport { fetchPage } from '../fetchers';\nimport {\n getUserRating,\n getUserRatingColorRating,\n getUserRatingDate,\n getUserRatingId,\n getUserRatingTitle,\n getUserRatingType,\n getUserRatingUrl,\n getUserRatingYear
|
|
1
|
+
{"version":3,"file":"user-ratings.service.js","names":["allMovies: CSFDUserRatings[]","userRatingsUrl","fetchPage","movies","sleep","films: CSFDUserRatings[]","getUserRatingType","getUserRatingId","getUserRatingTitle","getUserRatingYear","getUserRatingUrl","getUserRatingColorRating","getUserRatingDate","getUserRating"],"sources":["../../src/services/user-ratings.service.ts"],"sourcesContent":["import { HTMLElement, parse } from 'node-html-parser';\nimport { CSFDColorRating, CSFDStars } from '../dto/global';\nimport { CSFDUserRatingConfig, CSFDUserRatings } from '../dto/user-ratings';\nimport { fetchPage } from '../fetchers';\nimport { sleep } from '../helpers/global.helper';\nimport {\n getUserRating,\n getUserRatingColorRating,\n getUserRatingDate,\n getUserRatingId,\n getUserRatingTitle,\n getUserRatingType,\n getUserRatingUrl,\n getUserRatingYear\n} from '../helpers/user-ratings.helper';\nimport { userRatingsUrl } from '../vars';\n\nexport class UserRatingsScraper {\n public async userRatings(\n user: string | number,\n config?: CSFDUserRatingConfig,\n optionsRequest?: RequestInit\n ): Promise<CSFDUserRatings[]> {\n let allMovies: CSFDUserRatings[] = [];\n const pageToFetch = config?.page || 1;\n const url = userRatingsUrl(user, pageToFetch > 1 ? pageToFetch : undefined);\n const response = await fetchPage(url, { ...optionsRequest });\n const items = parse(response);\n const movies = items.querySelectorAll('.box-user-rating .table-container tbody tr');\n\n // Get number of pages\n const pagesNode = items.querySelector('.pagination');\n const pages = +pagesNode?.childNodes[pagesNode.childNodes.length - 4].rawText || 1;\n\n allMovies = this.getPage(config, movies);\n\n if (config?.allPages) {\n console.log('User', user, url);\n console.log('Fetching all pages', pages);\n for (let i = 2; i <= pages; i++) {\n console.log('Fetching page', i, 'out of', pages, '...');\n const url = userRatingsUrl(user, i);\n const response = await fetchPage(url, { ...optionsRequest });\n\n const items = parse(response);\n const movies = items.querySelectorAll('.box-user-rating .table-container tbody tr');\n allMovies = [...allMovies, ...this.getPage(config, movies)];\n\n // Sleep\n if (config.allPagesDelay) {\n await sleep(config.allPagesDelay);\n }\n }\n return allMovies;\n }\n\n return allMovies;\n }\n\n private getPage(config: CSFDUserRatingConfig, movies: HTMLElement[]) {\n const films: CSFDUserRatings[] = [];\n if (config) {\n if (config.includesOnly?.length && config.excludes?.length) {\n console.warn(\n `node-csfd-api:\n You can not use both parameters 'includesOnly' and 'excludes'.\n Parameter 'includesOnly' will be used now:`,\n config.includesOnly\n );\n }\n }\n\n for (const el of movies) {\n const type = getUserRatingType(el);\n\n // Filtering includesOnly\n if (config?.includesOnly?.length) {\n if (config.includesOnly.some((include) => type === include)) {\n films.push(this.buildUserRatings(el));\n }\n // Filter excludes\n } else if (config?.excludes?.length) {\n if (!config.excludes.some((exclude) => type === exclude)) {\n films.push(this.buildUserRatings(el));\n }\n } else {\n // Without filtering\n films.push(this.buildUserRatings(el));\n }\n }\n return films;\n }\n\n private buildUserRatings(el: HTMLElement): CSFDUserRatings {\n return {\n id: getUserRatingId(el),\n title: getUserRatingTitle(el),\n year: getUserRatingYear(el),\n type: getUserRatingType(el),\n url: getUserRatingUrl(el),\n colorRating: getUserRatingColorRating(el) as CSFDColorRating,\n userDate: getUserRatingDate(el),\n userRating: getUserRating(el) as CSFDStars\n };\n }\n}\n"],"mappings":";;;;;;;;;AAiBA,IAAa,qBAAb,MAAgC;CAC9B,MAAa,YACX,MACA,QACA,gBAC4B;EAC5B,IAAIA,YAA+B,EAAE;EACrC,MAAM,cAAc,QAAQ,QAAQ;EACpC,MAAM,MAAMC,4BAAe,MAAM,cAAc,IAAI,cAAc,OAAU;EAE3E,MAAM,oCADW,MAAMC,wBAAU,KAAK,EAAE,GAAG,gBAAgB,CAAC,CAC/B;EAC7B,MAAM,SAAS,MAAM,iBAAiB,6CAA6C;EAGnF,MAAM,YAAY,MAAM,cAAc,cAAc;EACpD,MAAM,QAAQ,CAAC,WAAW,WAAW,UAAU,WAAW,SAAS,GAAG,WAAW;AAEjF,cAAY,KAAK,QAAQ,QAAQ,OAAO;AAExC,MAAI,QAAQ,UAAU;AACpB,WAAQ,IAAI,QAAQ,MAAM,IAAI;AAC9B,WAAQ,IAAI,sBAAsB,MAAM;AACxC,QAAK,IAAI,IAAI,GAAG,KAAK,OAAO,KAAK;AAC/B,YAAQ,IAAI,iBAAiB,GAAG,UAAU,OAAO,MAAM;IAKvD,MAAMC,uCAHW,MAAMD,wBADXD,4BAAe,MAAM,EAAE,EACG,EAAE,GAAG,gBAAgB,CAAC,CAE/B,CACR,iBAAiB,6CAA6C;AACnF,gBAAY,CAAC,GAAG,WAAW,GAAG,KAAK,QAAQ,QAAQE,SAAO,CAAC;AAG3D,QAAI,OAAO,cACT,OAAMC,4BAAM,OAAO,cAAc;;AAGrC,UAAO;;AAGT,SAAO;;CAGT,AAAQ,QAAQ,QAA8B,QAAuB;EACnE,MAAMC,QAA2B,EAAE;AACnC,MAAI,QACF;OAAI,OAAO,cAAc,UAAU,OAAO,UAAU,OAClD,SAAQ,KACN;;qDAGA,OAAO,aACR;;AAIL,OAAK,MAAM,MAAM,QAAQ;GACvB,MAAM,OAAOC,8CAAkB,GAAG;AAGlC,OAAI,QAAQ,cAAc,QACxB;QAAI,OAAO,aAAa,MAAM,YAAY,SAAS,QAAQ,CACzD,OAAM,KAAK,KAAK,iBAAiB,GAAG,CAAC;cAG9B,QAAQ,UAAU,QAC3B;QAAI,CAAC,OAAO,SAAS,MAAM,YAAY,SAAS,QAAQ,CACtD,OAAM,KAAK,KAAK,iBAAiB,GAAG,CAAC;SAIvC,OAAM,KAAK,KAAK,iBAAiB,GAAG,CAAC;;AAGzC,SAAO;;CAGT,AAAQ,iBAAiB,IAAkC;AACzD,SAAO;GACL,IAAIC,4CAAgB,GAAG;GACvB,OAAOC,+CAAmB,GAAG;GAC7B,MAAMC,8CAAkB,GAAG;GAC3B,MAAMH,8CAAkB,GAAG;GAC3B,KAAKI,6CAAiB,GAAG;GACzB,aAAaC,qDAAyB,GAAG;GACzC,UAAUC,8CAAkB,GAAG;GAC/B,YAAYC,0CAAc,GAAG;GAC9B"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { fetchPage } from "../fetchers/index.mjs";
|
|
2
2
|
import { userRatingsUrl } from "../vars.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { sleep } from "../helpers/global.helper.mjs";
|
|
4
|
+
import { getUserRating, getUserRatingColorRating, getUserRatingDate, getUserRatingId, getUserRatingTitle, getUserRatingType, getUserRatingUrl, getUserRatingYear } from "../helpers/user-ratings.helper.mjs";
|
|
4
5
|
import { parse } from "node-html-parser";
|
|
5
6
|
|
|
6
7
|
//#region src/services/user-ratings.service.ts
|
|
7
8
|
var UserRatingsScraper = class {
|
|
8
9
|
async userRatings(user, config, optionsRequest) {
|
|
9
10
|
let allMovies = [];
|
|
10
|
-
const
|
|
11
|
+
const pageToFetch = config?.page || 1;
|
|
12
|
+
const url = userRatingsUrl(user, pageToFetch > 1 ? pageToFetch : void 0);
|
|
11
13
|
const items = parse(await fetchPage(url, { ...optionsRequest }));
|
|
12
14
|
const movies = items.querySelectorAll(".box-user-rating .table-container tbody tr");
|
|
13
15
|
const pagesNode = items.querySelector(".pagination");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-ratings.service.mjs","names":["allMovies: CSFDUserRatings[]","movies","films: CSFDUserRatings[]"],"sources":["../../src/services/user-ratings.service.ts"],"sourcesContent":["import { HTMLElement, parse } from 'node-html-parser';\nimport { CSFDColorRating, CSFDStars } from '../dto/global';\nimport { CSFDUserRatingConfig, CSFDUserRatings } from '../dto/user-ratings';\nimport { fetchPage } from '../fetchers';\nimport {\n getUserRating,\n getUserRatingColorRating,\n getUserRatingDate,\n getUserRatingId,\n getUserRatingTitle,\n getUserRatingType,\n getUserRatingUrl,\n getUserRatingYear
|
|
1
|
+
{"version":3,"file":"user-ratings.service.mjs","names":["allMovies: CSFDUserRatings[]","movies","films: CSFDUserRatings[]"],"sources":["../../src/services/user-ratings.service.ts"],"sourcesContent":["import { HTMLElement, parse } from 'node-html-parser';\nimport { CSFDColorRating, CSFDStars } from '../dto/global';\nimport { CSFDUserRatingConfig, CSFDUserRatings } from '../dto/user-ratings';\nimport { fetchPage } from '../fetchers';\nimport { sleep } from '../helpers/global.helper';\nimport {\n getUserRating,\n getUserRatingColorRating,\n getUserRatingDate,\n getUserRatingId,\n getUserRatingTitle,\n getUserRatingType,\n getUserRatingUrl,\n getUserRatingYear\n} from '../helpers/user-ratings.helper';\nimport { userRatingsUrl } from '../vars';\n\nexport class UserRatingsScraper {\n public async userRatings(\n user: string | number,\n config?: CSFDUserRatingConfig,\n optionsRequest?: RequestInit\n ): Promise<CSFDUserRatings[]> {\n let allMovies: CSFDUserRatings[] = [];\n const pageToFetch = config?.page || 1;\n const url = userRatingsUrl(user, pageToFetch > 1 ? pageToFetch : undefined);\n const response = await fetchPage(url, { ...optionsRequest });\n const items = parse(response);\n const movies = items.querySelectorAll('.box-user-rating .table-container tbody tr');\n\n // Get number of pages\n const pagesNode = items.querySelector('.pagination');\n const pages = +pagesNode?.childNodes[pagesNode.childNodes.length - 4].rawText || 1;\n\n allMovies = this.getPage(config, movies);\n\n if (config?.allPages) {\n console.log('User', user, url);\n console.log('Fetching all pages', pages);\n for (let i = 2; i <= pages; i++) {\n console.log('Fetching page', i, 'out of', pages, '...');\n const url = userRatingsUrl(user, i);\n const response = await fetchPage(url, { ...optionsRequest });\n\n const items = parse(response);\n const movies = items.querySelectorAll('.box-user-rating .table-container tbody tr');\n allMovies = [...allMovies, ...this.getPage(config, movies)];\n\n // Sleep\n if (config.allPagesDelay) {\n await sleep(config.allPagesDelay);\n }\n }\n return allMovies;\n }\n\n return allMovies;\n }\n\n private getPage(config: CSFDUserRatingConfig, movies: HTMLElement[]) {\n const films: CSFDUserRatings[] = [];\n if (config) {\n if (config.includesOnly?.length && config.excludes?.length) {\n console.warn(\n `node-csfd-api:\n You can not use both parameters 'includesOnly' and 'excludes'.\n Parameter 'includesOnly' will be used now:`,\n config.includesOnly\n );\n }\n }\n\n for (const el of movies) {\n const type = getUserRatingType(el);\n\n // Filtering includesOnly\n if (config?.includesOnly?.length) {\n if (config.includesOnly.some((include) => type === include)) {\n films.push(this.buildUserRatings(el));\n }\n // Filter excludes\n } else if (config?.excludes?.length) {\n if (!config.excludes.some((exclude) => type === exclude)) {\n films.push(this.buildUserRatings(el));\n }\n } else {\n // Without filtering\n films.push(this.buildUserRatings(el));\n }\n }\n return films;\n }\n\n private buildUserRatings(el: HTMLElement): CSFDUserRatings {\n return {\n id: getUserRatingId(el),\n title: getUserRatingTitle(el),\n year: getUserRatingYear(el),\n type: getUserRatingType(el),\n url: getUserRatingUrl(el),\n colorRating: getUserRatingColorRating(el) as CSFDColorRating,\n userDate: getUserRatingDate(el),\n userRating: getUserRating(el) as CSFDStars\n };\n }\n}\n"],"mappings":";;;;;;;AAiBA,IAAa,qBAAb,MAAgC;CAC9B,MAAa,YACX,MACA,QACA,gBAC4B;EAC5B,IAAIA,YAA+B,EAAE;EACrC,MAAM,cAAc,QAAQ,QAAQ;EACpC,MAAM,MAAM,eAAe,MAAM,cAAc,IAAI,cAAc,OAAU;EAE3E,MAAM,QAAQ,MADG,MAAM,UAAU,KAAK,EAAE,GAAG,gBAAgB,CAAC,CAC/B;EAC7B,MAAM,SAAS,MAAM,iBAAiB,6CAA6C;EAGnF,MAAM,YAAY,MAAM,cAAc,cAAc;EACpD,MAAM,QAAQ,CAAC,WAAW,WAAW,UAAU,WAAW,SAAS,GAAG,WAAW;AAEjF,cAAY,KAAK,QAAQ,QAAQ,OAAO;AAExC,MAAI,QAAQ,UAAU;AACpB,WAAQ,IAAI,QAAQ,MAAM,IAAI;AAC9B,WAAQ,IAAI,sBAAsB,MAAM;AACxC,QAAK,IAAI,IAAI,GAAG,KAAK,OAAO,KAAK;AAC/B,YAAQ,IAAI,iBAAiB,GAAG,UAAU,OAAO,MAAM;IAKvD,MAAMC,WADQ,MAFG,MAAM,UADX,eAAe,MAAM,EAAE,EACG,EAAE,GAAG,gBAAgB,CAAC,CAE/B,CACR,iBAAiB,6CAA6C;AACnF,gBAAY,CAAC,GAAG,WAAW,GAAG,KAAK,QAAQ,QAAQA,SAAO,CAAC;AAG3D,QAAI,OAAO,cACT,OAAM,MAAM,OAAO,cAAc;;AAGrC,UAAO;;AAGT,SAAO;;CAGT,AAAQ,QAAQ,QAA8B,QAAuB;EACnE,MAAMC,QAA2B,EAAE;AACnC,MAAI,QACF;OAAI,OAAO,cAAc,UAAU,OAAO,UAAU,OAClD,SAAQ,KACN;;qDAGA,OAAO,aACR;;AAIL,OAAK,MAAM,MAAM,QAAQ;GACvB,MAAM,OAAO,kBAAkB,GAAG;AAGlC,OAAI,QAAQ,cAAc,QACxB;QAAI,OAAO,aAAa,MAAM,YAAY,SAAS,QAAQ,CACzD,OAAM,KAAK,KAAK,iBAAiB,GAAG,CAAC;cAG9B,QAAQ,UAAU,QAC3B;QAAI,CAAC,OAAO,SAAS,MAAM,YAAY,SAAS,QAAQ,CACtD,OAAM,KAAK,KAAK,iBAAiB,GAAG,CAAC;SAIvC,OAAM,KAAK,KAAK,iBAAiB,GAAG,CAAC;;AAGzC,SAAO;;CAGT,AAAQ,iBAAiB,IAAkC;AACzD,SAAO;GACL,IAAI,gBAAgB,GAAG;GACvB,OAAO,mBAAmB,GAAG;GAC7B,MAAM,kBAAkB,GAAG;GAC3B,MAAM,kBAAkB,GAAG;GAC3B,KAAK,iBAAiB,GAAG;GACzB,aAAa,yBAAyB,GAAG;GACzC,UAAU,kBAAkB,GAAG;GAC/B,YAAY,cAAc,GAAG;GAC9B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CSFDUserReviews, CSFDUserReviewsConfig } from "../dto/user-reviews.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/services/user-reviews.service.d.ts
|
|
4
|
+
declare class UserReviewsScraper {
|
|
5
|
+
userReviews(user: string | number, config?: CSFDUserReviewsConfig, optionsRequest?: RequestInit): Promise<CSFDUserReviews[]>;
|
|
6
|
+
private getPage;
|
|
7
|
+
private buildUserReviews;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { UserReviewsScraper };
|
|
11
|
+
//# sourceMappingURL=user-reviews.service.d.mts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CSFDUserReviews, CSFDUserReviewsConfig } from "../dto/user-reviews.js";
|
|
2
|
+
|
|
3
|
+
//#region src/services/user-reviews.service.d.ts
|
|
4
|
+
declare class UserReviewsScraper {
|
|
5
|
+
userReviews(user: string | number, config?: CSFDUserReviewsConfig, optionsRequest?: RequestInit): Promise<CSFDUserReviews[]>;
|
|
6
|
+
private getPage;
|
|
7
|
+
private buildUserReviews;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { UserReviewsScraper };
|
|
11
|
+
//# sourceMappingURL=user-reviews.service.d.ts.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_index = require('../fetchers/index.js');
|
|
3
|
+
const require_vars = require('../vars.js');
|
|
4
|
+
const require_global_helper = require('../helpers/global.helper.js');
|
|
5
|
+
const require_user_reviews_helper = require('../helpers/user-reviews.helper.js');
|
|
6
|
+
let node_html_parser = require("node-html-parser");
|
|
7
|
+
node_html_parser = require_rolldown_runtime.__toESM(node_html_parser);
|
|
8
|
+
|
|
9
|
+
//#region src/services/user-reviews.service.ts
|
|
10
|
+
var UserReviewsScraper = class {
|
|
11
|
+
async userReviews(user, config, optionsRequest) {
|
|
12
|
+
let allReviews = [];
|
|
13
|
+
const pageToFetch = config?.page || 1;
|
|
14
|
+
const url = require_vars.userReviewsUrl(user, pageToFetch > 1 ? pageToFetch : void 0);
|
|
15
|
+
const items = (0, node_html_parser.parse)(await require_index.fetchPage(url, { ...optionsRequest }));
|
|
16
|
+
const reviews = items.querySelectorAll(".user-reviews .article");
|
|
17
|
+
const pagesNode = items.querySelector(".pagination");
|
|
18
|
+
const pages = +pagesNode?.childNodes[pagesNode.childNodes.length - 4].rawText || 1;
|
|
19
|
+
allReviews = this.getPage(config, reviews);
|
|
20
|
+
if (config?.allPages) {
|
|
21
|
+
console.log("User", user, url);
|
|
22
|
+
console.log("Fetching all pages", pages);
|
|
23
|
+
for (let i = 2; i <= pages; i++) {
|
|
24
|
+
console.log("Fetching page", i, "out of", pages, "...");
|
|
25
|
+
const reviews$1 = (0, node_html_parser.parse)(await require_index.fetchPage(require_vars.userReviewsUrl(user, i), { ...optionsRequest })).querySelectorAll(".user-reviews .article");
|
|
26
|
+
allReviews = [...allReviews, ...this.getPage(config, reviews$1)];
|
|
27
|
+
if (config.allPagesDelay) await require_global_helper.sleep(config.allPagesDelay);
|
|
28
|
+
}
|
|
29
|
+
return allReviews;
|
|
30
|
+
}
|
|
31
|
+
return allReviews;
|
|
32
|
+
}
|
|
33
|
+
getPage(config, reviews) {
|
|
34
|
+
const films = [];
|
|
35
|
+
if (config) {
|
|
36
|
+
if (config.includesOnly?.length && config.excludes?.length) console.warn(`node-csfd-api:
|
|
37
|
+
You can not use both parameters 'includesOnly' and 'excludes'.
|
|
38
|
+
Parameter 'includesOnly' will be used now:`, config.includesOnly);
|
|
39
|
+
}
|
|
40
|
+
for (const el of reviews) {
|
|
41
|
+
const type = require_user_reviews_helper.getUserReviewType(el);
|
|
42
|
+
if (config?.includesOnly?.length) {
|
|
43
|
+
if (config.includesOnly.some((include) => type === include)) films.push(this.buildUserReviews(el));
|
|
44
|
+
} else if (config?.excludes?.length) {
|
|
45
|
+
if (!config.excludes.some((exclude) => type === exclude)) films.push(this.buildUserReviews(el));
|
|
46
|
+
} else films.push(this.buildUserReviews(el));
|
|
47
|
+
}
|
|
48
|
+
return films;
|
|
49
|
+
}
|
|
50
|
+
buildUserReviews(el) {
|
|
51
|
+
return {
|
|
52
|
+
id: require_user_reviews_helper.getUserReviewId(el),
|
|
53
|
+
title: require_user_reviews_helper.getUserReviewTitle(el),
|
|
54
|
+
year: require_user_reviews_helper.getUserReviewYear(el),
|
|
55
|
+
type: require_user_reviews_helper.getUserReviewType(el),
|
|
56
|
+
url: require_user_reviews_helper.getUserReviewUrl(el),
|
|
57
|
+
colorRating: require_user_reviews_helper.getUserReviewColorRating(el),
|
|
58
|
+
userDate: require_user_reviews_helper.getUserReviewDate(el),
|
|
59
|
+
userRating: require_user_reviews_helper.getUserReviewRating(el),
|
|
60
|
+
text: require_user_reviews_helper.getUserReviewText(el),
|
|
61
|
+
poster: require_user_reviews_helper.getUserReviewPoster(el)
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
//#endregion
|
|
67
|
+
exports.UserReviewsScraper = UserReviewsScraper;
|
|
68
|
+
//# sourceMappingURL=user-reviews.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-reviews.service.js","names":["allReviews: CSFDUserReviews[]","userReviewsUrl","fetchPage","reviews","sleep","films: CSFDUserReviews[]","getUserReviewType","getUserReviewId","getUserReviewTitle","getUserReviewYear","getUserReviewUrl","getUserReviewColorRating","getUserReviewDate","getUserReviewRating","getUserReviewText","getUserReviewPoster"],"sources":["../../src/services/user-reviews.service.ts"],"sourcesContent":["import { HTMLElement, parse } from 'node-html-parser';\nimport { CSFDColorRating, CSFDStars } from '../dto/global';\nimport { CSFDUserReviews, CSFDUserReviewsConfig } from '../dto/user-reviews';\nimport { fetchPage } from '../fetchers';\nimport { sleep } from '../helpers/global.helper';\nimport {\n getUserReviewColorRating,\n getUserReviewDate,\n getUserReviewId,\n getUserReviewPoster,\n getUserReviewRating,\n getUserReviewText,\n getUserReviewTitle,\n getUserReviewType,\n getUserReviewUrl,\n getUserReviewYear\n} from '../helpers/user-reviews.helper';\nimport { userReviewsUrl } from '../vars';\n\nexport class UserReviewsScraper {\n public async userReviews(\n user: string | number,\n config?: CSFDUserReviewsConfig,\n optionsRequest?: RequestInit\n ): Promise<CSFDUserReviews[]> {\n let allReviews: CSFDUserReviews[] = [];\n const pageToFetch = config?.page || 1;\n const url = userReviewsUrl(user, pageToFetch > 1 ? pageToFetch : undefined);\n const response = await fetchPage(url, { ...optionsRequest });\n const items = parse(response);\n const reviews = items.querySelectorAll('.user-reviews .article');\n\n // Get number of pages\n const pagesNode = items.querySelector('.pagination');\n const pages = +pagesNode?.childNodes[pagesNode.childNodes.length - 4].rawText || 1;\n\n allReviews = this.getPage(config, reviews);\n\n if (config?.allPages) {\n console.log('User', user, url);\n console.log('Fetching all pages', pages);\n for (let i = 2; i <= pages; i++) {\n console.log('Fetching page', i, 'out of', pages, '...');\n const url = userReviewsUrl(user, i);\n const response = await fetchPage(url, { ...optionsRequest });\n\n const items = parse(response);\n const reviews = items.querySelectorAll('.user-reviews .article');\n allReviews = [...allReviews, ...this.getPage(config, reviews)];\n\n // Sleep\n if (config.allPagesDelay) {\n await sleep(config.allPagesDelay);\n }\n }\n return allReviews;\n }\n\n return allReviews;\n }\n\n private getPage(config: CSFDUserReviewsConfig, reviews: HTMLElement[]) {\n const films: CSFDUserReviews[] = [];\n if (config) {\n if (config.includesOnly?.length && config.excludes?.length) {\n console.warn(\n `node-csfd-api:\n You can not use both parameters 'includesOnly' and 'excludes'.\n Parameter 'includesOnly' will be used now:`,\n config.includesOnly\n );\n }\n }\n\n for (const el of reviews) {\n const type = getUserReviewType(el);\n\n // Filtering includesOnly\n if (config?.includesOnly?.length) {\n if (config.includesOnly.some((include) => type === include)) {\n films.push(this.buildUserReviews(el));\n }\n // Filter excludes\n } else if (config?.excludes?.length) {\n if (!config.excludes.some((exclude) => type === exclude)) {\n films.push(this.buildUserReviews(el));\n }\n } else {\n // Without filtering\n films.push(this.buildUserReviews(el));\n }\n }\n return films;\n }\n\n private buildUserReviews(el: HTMLElement): CSFDUserReviews {\n return {\n id: getUserReviewId(el),\n title: getUserReviewTitle(el),\n year: getUserReviewYear(el),\n type: getUserReviewType(el),\n url: getUserReviewUrl(el),\n colorRating: getUserReviewColorRating(el) as CSFDColorRating,\n userDate: getUserReviewDate(el),\n userRating: getUserReviewRating(el) as CSFDStars,\n text: getUserReviewText(el),\n poster: getUserReviewPoster(el)\n };\n }\n}\n"],"mappings":";;;;;;;;;AAmBA,IAAa,qBAAb,MAAgC;CAC9B,MAAa,YACX,MACA,QACA,gBAC4B;EAC5B,IAAIA,aAAgC,EAAE;EACtC,MAAM,cAAc,QAAQ,QAAQ;EACpC,MAAM,MAAMC,4BAAe,MAAM,cAAc,IAAI,cAAc,OAAU;EAE3E,MAAM,oCADW,MAAMC,wBAAU,KAAK,EAAE,GAAG,gBAAgB,CAAC,CAC/B;EAC7B,MAAM,UAAU,MAAM,iBAAiB,yBAAyB;EAGhE,MAAM,YAAY,MAAM,cAAc,cAAc;EACpD,MAAM,QAAQ,CAAC,WAAW,WAAW,UAAU,WAAW,SAAS,GAAG,WAAW;AAEjF,eAAa,KAAK,QAAQ,QAAQ,QAAQ;AAE1C,MAAI,QAAQ,UAAU;AACpB,WAAQ,IAAI,QAAQ,MAAM,IAAI;AAC9B,WAAQ,IAAI,sBAAsB,MAAM;AACxC,QAAK,IAAI,IAAI,GAAG,KAAK,OAAO,KAAK;AAC/B,YAAQ,IAAI,iBAAiB,GAAG,UAAU,OAAO,MAAM;IAKvD,MAAMC,wCAHW,MAAMD,wBADXD,4BAAe,MAAM,EAAE,EACG,EAAE,GAAG,gBAAgB,CAAC,CAE/B,CACP,iBAAiB,yBAAyB;AAChE,iBAAa,CAAC,GAAG,YAAY,GAAG,KAAK,QAAQ,QAAQE,UAAQ,CAAC;AAG9D,QAAI,OAAO,cACT,OAAMC,4BAAM,OAAO,cAAc;;AAGrC,UAAO;;AAGT,SAAO;;CAGT,AAAQ,QAAQ,QAA+B,SAAwB;EACrE,MAAMC,QAA2B,EAAE;AACnC,MAAI,QACF;OAAI,OAAO,cAAc,UAAU,OAAO,UAAU,OAClD,SAAQ,KACN;;qDAGA,OAAO,aACR;;AAIL,OAAK,MAAM,MAAM,SAAS;GACxB,MAAM,OAAOC,8CAAkB,GAAG;AAGlC,OAAI,QAAQ,cAAc,QACxB;QAAI,OAAO,aAAa,MAAM,YAAY,SAAS,QAAQ,CACzD,OAAM,KAAK,KAAK,iBAAiB,GAAG,CAAC;cAG9B,QAAQ,UAAU,QAC3B;QAAI,CAAC,OAAO,SAAS,MAAM,YAAY,SAAS,QAAQ,CACtD,OAAM,KAAK,KAAK,iBAAiB,GAAG,CAAC;SAIvC,OAAM,KAAK,KAAK,iBAAiB,GAAG,CAAC;;AAGzC,SAAO;;CAGT,AAAQ,iBAAiB,IAAkC;AACzD,SAAO;GACL,IAAIC,4CAAgB,GAAG;GACvB,OAAOC,+CAAmB,GAAG;GAC7B,MAAMC,8CAAkB,GAAG;GAC3B,MAAMH,8CAAkB,GAAG;GAC3B,KAAKI,6CAAiB,GAAG;GACzB,aAAaC,qDAAyB,GAAG;GACzC,UAAUC,8CAAkB,GAAG;GAC/B,YAAYC,gDAAoB,GAAG;GACnC,MAAMC,8CAAkB,GAAG;GAC3B,QAAQC,gDAAoB,GAAG;GAChC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { fetchPage } from "../fetchers/index.mjs";
|
|
2
|
+
import { userReviewsUrl } from "../vars.mjs";
|
|
3
|
+
import { sleep } from "../helpers/global.helper.mjs";
|
|
4
|
+
import { getUserReviewColorRating, getUserReviewDate, getUserReviewId, getUserReviewPoster, getUserReviewRating, getUserReviewText, getUserReviewTitle, getUserReviewType, getUserReviewUrl, getUserReviewYear } from "../helpers/user-reviews.helper.mjs";
|
|
5
|
+
import { parse } from "node-html-parser";
|
|
6
|
+
|
|
7
|
+
//#region src/services/user-reviews.service.ts
|
|
8
|
+
var UserReviewsScraper = class {
|
|
9
|
+
async userReviews(user, config, optionsRequest) {
|
|
10
|
+
let allReviews = [];
|
|
11
|
+
const pageToFetch = config?.page || 1;
|
|
12
|
+
const url = userReviewsUrl(user, pageToFetch > 1 ? pageToFetch : void 0);
|
|
13
|
+
const items = parse(await fetchPage(url, { ...optionsRequest }));
|
|
14
|
+
const reviews = items.querySelectorAll(".user-reviews .article");
|
|
15
|
+
const pagesNode = items.querySelector(".pagination");
|
|
16
|
+
const pages = +pagesNode?.childNodes[pagesNode.childNodes.length - 4].rawText || 1;
|
|
17
|
+
allReviews = this.getPage(config, reviews);
|
|
18
|
+
if (config?.allPages) {
|
|
19
|
+
console.log("User", user, url);
|
|
20
|
+
console.log("Fetching all pages", pages);
|
|
21
|
+
for (let i = 2; i <= pages; i++) {
|
|
22
|
+
console.log("Fetching page", i, "out of", pages, "...");
|
|
23
|
+
const reviews$1 = parse(await fetchPage(userReviewsUrl(user, i), { ...optionsRequest })).querySelectorAll(".user-reviews .article");
|
|
24
|
+
allReviews = [...allReviews, ...this.getPage(config, reviews$1)];
|
|
25
|
+
if (config.allPagesDelay) await sleep(config.allPagesDelay);
|
|
26
|
+
}
|
|
27
|
+
return allReviews;
|
|
28
|
+
}
|
|
29
|
+
return allReviews;
|
|
30
|
+
}
|
|
31
|
+
getPage(config, reviews) {
|
|
32
|
+
const films = [];
|
|
33
|
+
if (config) {
|
|
34
|
+
if (config.includesOnly?.length && config.excludes?.length) console.warn(`node-csfd-api:
|
|
35
|
+
You can not use both parameters 'includesOnly' and 'excludes'.
|
|
36
|
+
Parameter 'includesOnly' will be used now:`, config.includesOnly);
|
|
37
|
+
}
|
|
38
|
+
for (const el of reviews) {
|
|
39
|
+
const type = getUserReviewType(el);
|
|
40
|
+
if (config?.includesOnly?.length) {
|
|
41
|
+
if (config.includesOnly.some((include) => type === include)) films.push(this.buildUserReviews(el));
|
|
42
|
+
} else if (config?.excludes?.length) {
|
|
43
|
+
if (!config.excludes.some((exclude) => type === exclude)) films.push(this.buildUserReviews(el));
|
|
44
|
+
} else films.push(this.buildUserReviews(el));
|
|
45
|
+
}
|
|
46
|
+
return films;
|
|
47
|
+
}
|
|
48
|
+
buildUserReviews(el) {
|
|
49
|
+
return {
|
|
50
|
+
id: getUserReviewId(el),
|
|
51
|
+
title: getUserReviewTitle(el),
|
|
52
|
+
year: getUserReviewYear(el),
|
|
53
|
+
type: getUserReviewType(el),
|
|
54
|
+
url: getUserReviewUrl(el),
|
|
55
|
+
colorRating: getUserReviewColorRating(el),
|
|
56
|
+
userDate: getUserReviewDate(el),
|
|
57
|
+
userRating: getUserReviewRating(el),
|
|
58
|
+
text: getUserReviewText(el),
|
|
59
|
+
poster: getUserReviewPoster(el)
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
export { UserReviewsScraper };
|
|
66
|
+
//# sourceMappingURL=user-reviews.service.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-reviews.service.mjs","names":["allReviews: CSFDUserReviews[]","reviews","films: CSFDUserReviews[]"],"sources":["../../src/services/user-reviews.service.ts"],"sourcesContent":["import { HTMLElement, parse } from 'node-html-parser';\nimport { CSFDColorRating, CSFDStars } from '../dto/global';\nimport { CSFDUserReviews, CSFDUserReviewsConfig } from '../dto/user-reviews';\nimport { fetchPage } from '../fetchers';\nimport { sleep } from '../helpers/global.helper';\nimport {\n getUserReviewColorRating,\n getUserReviewDate,\n getUserReviewId,\n getUserReviewPoster,\n getUserReviewRating,\n getUserReviewText,\n getUserReviewTitle,\n getUserReviewType,\n getUserReviewUrl,\n getUserReviewYear\n} from '../helpers/user-reviews.helper';\nimport { userReviewsUrl } from '../vars';\n\nexport class UserReviewsScraper {\n public async userReviews(\n user: string | number,\n config?: CSFDUserReviewsConfig,\n optionsRequest?: RequestInit\n ): Promise<CSFDUserReviews[]> {\n let allReviews: CSFDUserReviews[] = [];\n const pageToFetch = config?.page || 1;\n const url = userReviewsUrl(user, pageToFetch > 1 ? pageToFetch : undefined);\n const response = await fetchPage(url, { ...optionsRequest });\n const items = parse(response);\n const reviews = items.querySelectorAll('.user-reviews .article');\n\n // Get number of pages\n const pagesNode = items.querySelector('.pagination');\n const pages = +pagesNode?.childNodes[pagesNode.childNodes.length - 4].rawText || 1;\n\n allReviews = this.getPage(config, reviews);\n\n if (config?.allPages) {\n console.log('User', user, url);\n console.log('Fetching all pages', pages);\n for (let i = 2; i <= pages; i++) {\n console.log('Fetching page', i, 'out of', pages, '...');\n const url = userReviewsUrl(user, i);\n const response = await fetchPage(url, { ...optionsRequest });\n\n const items = parse(response);\n const reviews = items.querySelectorAll('.user-reviews .article');\n allReviews = [...allReviews, ...this.getPage(config, reviews)];\n\n // Sleep\n if (config.allPagesDelay) {\n await sleep(config.allPagesDelay);\n }\n }\n return allReviews;\n }\n\n return allReviews;\n }\n\n private getPage(config: CSFDUserReviewsConfig, reviews: HTMLElement[]) {\n const films: CSFDUserReviews[] = [];\n if (config) {\n if (config.includesOnly?.length && config.excludes?.length) {\n console.warn(\n `node-csfd-api:\n You can not use both parameters 'includesOnly' and 'excludes'.\n Parameter 'includesOnly' will be used now:`,\n config.includesOnly\n );\n }\n }\n\n for (const el of reviews) {\n const type = getUserReviewType(el);\n\n // Filtering includesOnly\n if (config?.includesOnly?.length) {\n if (config.includesOnly.some((include) => type === include)) {\n films.push(this.buildUserReviews(el));\n }\n // Filter excludes\n } else if (config?.excludes?.length) {\n if (!config.excludes.some((exclude) => type === exclude)) {\n films.push(this.buildUserReviews(el));\n }\n } else {\n // Without filtering\n films.push(this.buildUserReviews(el));\n }\n }\n return films;\n }\n\n private buildUserReviews(el: HTMLElement): CSFDUserReviews {\n return {\n id: getUserReviewId(el),\n title: getUserReviewTitle(el),\n year: getUserReviewYear(el),\n type: getUserReviewType(el),\n url: getUserReviewUrl(el),\n colorRating: getUserReviewColorRating(el) as CSFDColorRating,\n userDate: getUserReviewDate(el),\n userRating: getUserReviewRating(el) as CSFDStars,\n text: getUserReviewText(el),\n poster: getUserReviewPoster(el)\n };\n }\n}\n"],"mappings":";;;;;;;AAmBA,IAAa,qBAAb,MAAgC;CAC9B,MAAa,YACX,MACA,QACA,gBAC4B;EAC5B,IAAIA,aAAgC,EAAE;EACtC,MAAM,cAAc,QAAQ,QAAQ;EACpC,MAAM,MAAM,eAAe,MAAM,cAAc,IAAI,cAAc,OAAU;EAE3E,MAAM,QAAQ,MADG,MAAM,UAAU,KAAK,EAAE,GAAG,gBAAgB,CAAC,CAC/B;EAC7B,MAAM,UAAU,MAAM,iBAAiB,yBAAyB;EAGhE,MAAM,YAAY,MAAM,cAAc,cAAc;EACpD,MAAM,QAAQ,CAAC,WAAW,WAAW,UAAU,WAAW,SAAS,GAAG,WAAW;AAEjF,eAAa,KAAK,QAAQ,QAAQ,QAAQ;AAE1C,MAAI,QAAQ,UAAU;AACpB,WAAQ,IAAI,QAAQ,MAAM,IAAI;AAC9B,WAAQ,IAAI,sBAAsB,MAAM;AACxC,QAAK,IAAI,IAAI,GAAG,KAAK,OAAO,KAAK;AAC/B,YAAQ,IAAI,iBAAiB,GAAG,UAAU,OAAO,MAAM;IAKvD,MAAMC,YADQ,MAFG,MAAM,UADX,eAAe,MAAM,EAAE,EACG,EAAE,GAAG,gBAAgB,CAAC,CAE/B,CACP,iBAAiB,yBAAyB;AAChE,iBAAa,CAAC,GAAG,YAAY,GAAG,KAAK,QAAQ,QAAQA,UAAQ,CAAC;AAG9D,QAAI,OAAO,cACT,OAAM,MAAM,OAAO,cAAc;;AAGrC,UAAO;;AAGT,SAAO;;CAGT,AAAQ,QAAQ,QAA+B,SAAwB;EACrE,MAAMC,QAA2B,EAAE;AACnC,MAAI,QACF;OAAI,OAAO,cAAc,UAAU,OAAO,UAAU,OAClD,SAAQ,KACN;;qDAGA,OAAO,aACR;;AAIL,OAAK,MAAM,MAAM,SAAS;GACxB,MAAM,OAAO,kBAAkB,GAAG;AAGlC,OAAI,QAAQ,cAAc,QACxB;QAAI,OAAO,aAAa,MAAM,YAAY,SAAS,QAAQ,CACzD,OAAM,KAAK,KAAK,iBAAiB,GAAG,CAAC;cAG9B,QAAQ,UAAU,QAC3B;QAAI,CAAC,OAAO,SAAS,MAAM,YAAY,SAAS,QAAQ,CACtD,OAAM,KAAK,KAAK,iBAAiB,GAAG,CAAC;SAIvC,OAAM,KAAK,KAAK,iBAAiB,GAAG,CAAC;;AAGzC,SAAO;;CAGT,AAAQ,iBAAiB,IAAkC;AACzD,SAAO;GACL,IAAI,gBAAgB,GAAG;GACvB,OAAO,mBAAmB,GAAG;GAC7B,MAAM,kBAAkB,GAAG;GAC3B,MAAM,kBAAkB,GAAG;GAC3B,KAAK,iBAAiB,GAAG;GACzB,aAAa,yBAAyB,GAAG;GACzC,UAAU,kBAAkB,GAAG;GAC/B,YAAY,oBAAoB,GAAG;GACnC,MAAM,kBAAkB,GAAG;GAC3B,QAAQ,oBAAoB,GAAG;GAChC"}
|
package/vars.js
CHANGED
|
@@ -7,6 +7,7 @@ const cinemasUrl = (district, period) => {
|
|
|
7
7
|
return `https://www.csfd.cz/kino/?period=${period}&district=${district}`;
|
|
8
8
|
};
|
|
9
9
|
const searchUrl = (text) => `https://www.csfd.cz/hledat/?q=${encodeURIComponent(text)}`;
|
|
10
|
+
const userReviewsUrl = (user, page) => `https://www.csfd.cz/uzivatel/${encodeURIComponent(user)}/recenze/${page ? "?page=" + page : ""}`;
|
|
10
11
|
|
|
11
12
|
//#endregion
|
|
12
13
|
exports.cinemasUrl = cinemasUrl;
|
|
@@ -14,4 +15,5 @@ exports.creatorUrl = creatorUrl;
|
|
|
14
15
|
exports.movieUrl = movieUrl;
|
|
15
16
|
exports.searchUrl = searchUrl;
|
|
16
17
|
exports.userRatingsUrl = userRatingsUrl;
|
|
18
|
+
exports.userReviewsUrl = userReviewsUrl;
|
|
17
19
|
//# sourceMappingURL=vars.js.map
|
package/vars.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vars.js","names":[],"sources":["../src/vars.ts"],"sourcesContent":["import { CSFDCinemaPeriod } from './dto/cinema';\n\nexport const userRatingsUrl = (user: string | number, page?: number): string =>\n `https://www.csfd.cz/uzivatel/${encodeURIComponent(user)}/hodnoceni/${page ? '?page=' + page : ''\n }`;\n\nexport const movieUrl = (movie: number): string =>\n `https://www.csfd.cz/film/${encodeURIComponent(movie)}/prehled/`;\n\nexport const creatorUrl = (creator: number | string): string =>\n `https://www.csfd.cz/tvurce/${encodeURIComponent(creator)}`;\n\nexport const cinemasUrl = (district: number | string, period: CSFDCinemaPeriod): string => {\n return `https://www.csfd.cz/kino/?period=${period}&district=${district}`;\n};\n\nexport const searchUrl = (text: string): string =>\n `https://www.csfd.cz/hledat/?q=${encodeURIComponent(text)}`;\n"],"mappings":";;AAEA,MAAa,kBAAkB,MAAuB,SACpD,gCAAgC,mBAAmB,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"vars.js","names":[],"sources":["../src/vars.ts"],"sourcesContent":["import { CSFDCinemaPeriod } from './dto/cinema';\n\nexport const userRatingsUrl = (user: string | number, page?: number): string =>\n `https://www.csfd.cz/uzivatel/${encodeURIComponent(user)}/hodnoceni/${\n page ? '?page=' + page : ''\n }`;\n\nexport const movieUrl = (movie: number): string =>\n `https://www.csfd.cz/film/${encodeURIComponent(movie)}/prehled/`;\n\nexport const creatorUrl = (creator: number | string): string =>\n `https://www.csfd.cz/tvurce/${encodeURIComponent(creator)}`;\n\nexport const cinemasUrl = (district: number | string, period: CSFDCinemaPeriod): string => {\n return `https://www.csfd.cz/kino/?period=${period}&district=${district}`;\n};\n\nexport const searchUrl = (text: string): string =>\n `https://www.csfd.cz/hledat/?q=${encodeURIComponent(text)}`;\n\nexport const userReviewsUrl = (user: string | number, page?: number): string =>\n `https://www.csfd.cz/uzivatel/${encodeURIComponent(user)}/recenze/${page ? '?page=' + page : ''}`;\n"],"mappings":";;AAEA,MAAa,kBAAkB,MAAuB,SACpD,gCAAgC,mBAAmB,KAAK,CAAC,aACvD,OAAO,WAAW,OAAO;AAG7B,MAAa,YAAY,UACvB,4BAA4B,mBAAmB,MAAM,CAAC;AAExD,MAAa,cAAc,YACzB,8BAA8B,mBAAmB,QAAQ;AAE3D,MAAa,cAAc,UAA2B,WAAqC;AACzF,QAAO,oCAAoC,OAAO,YAAY;;AAGhE,MAAa,aAAa,SACxB,iCAAiC,mBAAmB,KAAK;AAE3D,MAAa,kBAAkB,MAAuB,SACpD,gCAAgC,mBAAmB,KAAK,CAAC,WAAW,OAAO,WAAW,OAAO"}
|
package/vars.mjs
CHANGED
|
@@ -6,7 +6,8 @@ const cinemasUrl = (district, period) => {
|
|
|
6
6
|
return `https://www.csfd.cz/kino/?period=${period}&district=${district}`;
|
|
7
7
|
};
|
|
8
8
|
const searchUrl = (text) => `https://www.csfd.cz/hledat/?q=${encodeURIComponent(text)}`;
|
|
9
|
+
const userReviewsUrl = (user, page) => `https://www.csfd.cz/uzivatel/${encodeURIComponent(user)}/recenze/${page ? "?page=" + page : ""}`;
|
|
9
10
|
|
|
10
11
|
//#endregion
|
|
11
|
-
export { cinemasUrl, creatorUrl, movieUrl, searchUrl, userRatingsUrl };
|
|
12
|
+
export { cinemasUrl, creatorUrl, movieUrl, searchUrl, userRatingsUrl, userReviewsUrl };
|
|
12
13
|
//# sourceMappingURL=vars.mjs.map
|
package/vars.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vars.mjs","names":[],"sources":["../src/vars.ts"],"sourcesContent":["import { CSFDCinemaPeriod } from './dto/cinema';\n\nexport const userRatingsUrl = (user: string | number, page?: number): string =>\n `https://www.csfd.cz/uzivatel/${encodeURIComponent(user)}/hodnoceni/${page ? '?page=' + page : ''\n }`;\n\nexport const movieUrl = (movie: number): string =>\n `https://www.csfd.cz/film/${encodeURIComponent(movie)}/prehled/`;\n\nexport const creatorUrl = (creator: number | string): string =>\n `https://www.csfd.cz/tvurce/${encodeURIComponent(creator)}`;\n\nexport const cinemasUrl = (district: number | string, period: CSFDCinemaPeriod): string => {\n return `https://www.csfd.cz/kino/?period=${period}&district=${district}`;\n};\n\nexport const searchUrl = (text: string): string =>\n `https://www.csfd.cz/hledat/?q=${encodeURIComponent(text)}`;\n"],"mappings":";AAEA,MAAa,kBAAkB,MAAuB,SACpD,gCAAgC,mBAAmB,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"vars.mjs","names":[],"sources":["../src/vars.ts"],"sourcesContent":["import { CSFDCinemaPeriod } from './dto/cinema';\n\nexport const userRatingsUrl = (user: string | number, page?: number): string =>\n `https://www.csfd.cz/uzivatel/${encodeURIComponent(user)}/hodnoceni/${\n page ? '?page=' + page : ''\n }`;\n\nexport const movieUrl = (movie: number): string =>\n `https://www.csfd.cz/film/${encodeURIComponent(movie)}/prehled/`;\n\nexport const creatorUrl = (creator: number | string): string =>\n `https://www.csfd.cz/tvurce/${encodeURIComponent(creator)}`;\n\nexport const cinemasUrl = (district: number | string, period: CSFDCinemaPeriod): string => {\n return `https://www.csfd.cz/kino/?period=${period}&district=${district}`;\n};\n\nexport const searchUrl = (text: string): string =>\n `https://www.csfd.cz/hledat/?q=${encodeURIComponent(text)}`;\n\nexport const userReviewsUrl = (user: string | number, page?: number): string =>\n `https://www.csfd.cz/uzivatel/${encodeURIComponent(user)}/recenze/${page ? '?page=' + page : ''}`;\n"],"mappings":";AAEA,MAAa,kBAAkB,MAAuB,SACpD,gCAAgC,mBAAmB,KAAK,CAAC,aACvD,OAAO,WAAW,OAAO;AAG7B,MAAa,YAAY,UACvB,4BAA4B,mBAAmB,MAAM,CAAC;AAExD,MAAa,cAAc,YACzB,8BAA8B,mBAAmB,QAAQ;AAE3D,MAAa,cAAc,UAA2B,WAAqC;AACzF,QAAO,oCAAoC,OAAO,YAAY;;AAGhE,MAAa,aAAa,SACxB,iCAAiC,mBAAmB,KAAK;AAE3D,MAAa,kBAAkB,MAAuB,SACpD,gCAAgC,mBAAmB,KAAK,CAAC,WAAW,OAAO,WAAW,OAAO"}
|