node-csfd-api 4.1.4 → 4.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dto/global.d.mts +10 -10
  2. package/dto/global.d.ts +10 -10
  3. package/dto/movie.d.mts +6 -6
  4. package/dto/movie.d.ts +6 -6
  5. package/dto/user-ratings.d.mts +6 -6
  6. package/dto/user-ratings.d.ts +6 -6
  7. package/dto/user-reviews.d.mts +6 -6
  8. package/dto/user-reviews.d.ts +6 -6
  9. package/helpers/creator.helper.js +4 -4
  10. package/helpers/creator.helper.js.map +1 -1
  11. package/helpers/creator.helper.mjs +4 -4
  12. package/helpers/creator.helper.mjs.map +1 -1
  13. package/helpers/movie.helper.js +3 -3
  14. package/helpers/movie.helper.js.map +1 -1
  15. package/helpers/movie.helper.mjs +3 -3
  16. package/helpers/movie.helper.mjs.map +1 -1
  17. package/helpers/search.helper.js +1 -1
  18. package/helpers/search.helper.js.map +1 -1
  19. package/helpers/search.helper.mjs +1 -1
  20. package/helpers/search.helper.mjs.map +1 -1
  21. package/helpers/user-ratings.helper.js +2 -2
  22. package/helpers/user-ratings.helper.js.map +1 -1
  23. package/helpers/user-ratings.helper.mjs +2 -2
  24. package/helpers/user-ratings.helper.mjs.map +1 -1
  25. package/helpers/user-reviews.helper.js +3 -3
  26. package/helpers/user-reviews.helper.js.map +1 -1
  27. package/helpers/user-reviews.helper.mjs +3 -3
  28. package/helpers/user-reviews.helper.mjs.map +1 -1
  29. package/index.js +1 -0
  30. package/index.js.map +1 -1
  31. package/package.json +1 -1
  32. package/services/user-ratings.service.js +3 -3
  33. package/services/user-ratings.service.js.map +1 -1
  34. package/services/user-ratings.service.mjs +3 -3
  35. package/services/user-ratings.service.mjs.map +1 -1
  36. package/services/user-reviews.service.js +3 -3
  37. package/services/user-reviews.service.js.map +1 -1
  38. package/services/user-reviews.service.mjs +3 -3
  39. package/services/user-reviews.service.mjs.map +1 -1
package/dto/global.d.mts CHANGED
@@ -6,16 +6,16 @@ interface CSFDScreening {
6
6
  url: string;
7
7
  type: CSFDFilmTypes;
8
8
  /**
9
- * Overall aggregated rating. (On the web usually represented by colors).
10
- *
11
- * 'unknown': unknown (gray color)
12
- *
13
- * 'good': 70% – 100 % (red color)
14
- *
15
- * 'average': 30% - 69% (blue color)
16
- *
17
- * 'bad': 0% - 29% (black color)
18
- */
9
+ * Overall aggregated rating. (On the web usually represented by colors).
10
+ *
11
+ * 'unknown': unknown (gray color)
12
+ *
13
+ * 'good': 70% – 100 % (red color)
14
+ *
15
+ * 'average': 30% - 69% (blue color)
16
+ *
17
+ * 'bad': 0% - 29% (black color)
18
+ */
19
19
  colorRating: CSFDColorRating;
20
20
  }
21
21
  type CSFDColorRating = 'bad' | 'average' | 'good' | 'unknown';
package/dto/global.d.ts CHANGED
@@ -6,16 +6,16 @@ interface CSFDScreening {
6
6
  url: string;
7
7
  type: CSFDFilmTypes;
8
8
  /**
9
- * Overall aggregated rating. (On the web usually represented by colors).
10
- *
11
- * 'unknown': unknown (gray color)
12
- *
13
- * 'good': 70% – 100 % (red color)
14
- *
15
- * 'average': 30% - 69% (blue color)
16
- *
17
- * 'bad': 0% - 29% (black color)
18
- */
9
+ * Overall aggregated rating. (On the web usually represented by colors).
10
+ *
11
+ * 'unknown': unknown (gray color)
12
+ *
13
+ * 'good': 70% – 100 % (red color)
14
+ *
15
+ * 'average': 30% - 69% (blue color)
16
+ *
17
+ * 'bad': 0% - 29% (black color)
18
+ */
19
19
  colorRating: CSFDColorRating;
20
20
  }
21
21
  type CSFDColorRating = 'bad' | 'average' | 'good' | 'unknown';
package/dto/movie.d.mts CHANGED
@@ -42,12 +42,12 @@ interface CSFDTitlesOther {
42
42
  }
43
43
  interface CSFDMovieCreator {
44
44
  /**
45
- * CSFD person ID.
46
- *
47
- * You can always assemble url from ID like this:
48
- *
49
- * `https://www.csfd.cz/tvurce/${id}`
50
- */
45
+ * CSFD person ID.
46
+ *
47
+ * You can always assemble url from ID like this:
48
+ *
49
+ * `https://www.csfd.cz/tvurce/${id}`
50
+ */
51
51
  id: number;
52
52
  name: string;
53
53
  url: string;
package/dto/movie.d.ts CHANGED
@@ -42,12 +42,12 @@ interface CSFDTitlesOther {
42
42
  }
43
43
  interface CSFDMovieCreator {
44
44
  /**
45
- * CSFD person ID.
46
- *
47
- * You can always assemble url from ID like this:
48
- *
49
- * `https://www.csfd.cz/tvurce/${id}`
50
- */
45
+ * CSFD person ID.
46
+ *
47
+ * You can always assemble url from ID like this:
48
+ *
49
+ * `https://www.csfd.cz/tvurce/${id}`
50
+ */
51
51
  id: number;
52
52
  name: string;
53
53
  url: string;
@@ -9,16 +9,16 @@ interface CSFDUserRatingConfig {
9
9
  includesOnly?: CSFDFilmTypes[];
10
10
  excludes?: CSFDFilmTypes[];
11
11
  /**
12
- * Fetch all ratings. (Warning: Use it wisely. Can be detected and banned. Consider using it together with `allPagesDelay` attribute)
13
- */
12
+ * Fetch all ratings. (Warning: Use it wisely. Can be detected and banned. Consider using it together with `allPagesDelay` attribute)
13
+ */
14
14
  allPages?: boolean;
15
15
  /**
16
- * Delay on each page request. In milliseconds
17
- */
16
+ * Delay on each page request. In milliseconds
17
+ */
18
18
  allPagesDelay?: number;
19
19
  /**
20
- * Specific page number to fetch (e.g., 2 for second page)
21
- */
20
+ * Specific page number to fetch (e.g., 2 for second page)
21
+ */
22
22
  page?: number;
23
23
  }
24
24
  type CSFDColors = 'lightgrey' | 'blue' | 'red' | 'grey';
@@ -9,16 +9,16 @@ interface CSFDUserRatingConfig {
9
9
  includesOnly?: CSFDFilmTypes[];
10
10
  excludes?: CSFDFilmTypes[];
11
11
  /**
12
- * Fetch all ratings. (Warning: Use it wisely. Can be detected and banned. Consider using it together with `allPagesDelay` attribute)
13
- */
12
+ * Fetch all ratings. (Warning: Use it wisely. Can be detected and banned. Consider using it together with `allPagesDelay` attribute)
13
+ */
14
14
  allPages?: boolean;
15
15
  /**
16
- * Delay on each page request. In milliseconds
17
- */
16
+ * Delay on each page request. In milliseconds
17
+ */
18
18
  allPagesDelay?: number;
19
19
  /**
20
- * Specific page number to fetch (e.g., 2 for second page)
21
- */
20
+ * Specific page number to fetch (e.g., 2 for second page)
21
+ */
22
22
  page?: number;
23
23
  }
24
24
  type CSFDColors = 'lightgrey' | 'blue' | 'red' | 'grey';
@@ -11,16 +11,16 @@ interface CSFDUserReviewsConfig {
11
11
  includesOnly?: CSFDFilmTypes[];
12
12
  excludes?: CSFDFilmTypes[];
13
13
  /**
14
- * Fetch all reviews. (Warning: Use it wisely. Can be detected and banned. Consider using it together with `allPagesDelay` attribute)
15
- */
14
+ * Fetch all reviews. (Warning: Use it wisely. Can be detected and banned. Consider using it together with `allPagesDelay` attribute)
15
+ */
16
16
  allPages?: boolean;
17
17
  /**
18
- * Delay on each page request. In milliseconds
19
- */
18
+ * Delay on each page request. In milliseconds
19
+ */
20
20
  allPagesDelay?: number;
21
21
  /**
22
- * Specific page number to fetch (e.g., 2 for second page)
23
- */
22
+ * Specific page number to fetch (e.g., 2 for second page)
23
+ */
24
24
  page?: number;
25
25
  }
26
26
  //#endregion
@@ -11,16 +11,16 @@ interface CSFDUserReviewsConfig {
11
11
  includesOnly?: CSFDFilmTypes[];
12
12
  excludes?: CSFDFilmTypes[];
13
13
  /**
14
- * Fetch all reviews. (Warning: Use it wisely. Can be detected and banned. Consider using it together with `allPagesDelay` attribute)
15
- */
14
+ * Fetch all reviews. (Warning: Use it wisely. Can be detected and banned. Consider using it together with `allPagesDelay` attribute)
15
+ */
16
16
  allPages?: boolean;
17
17
  /**
18
- * Delay on each page request. In milliseconds
19
- */
18
+ * Delay on each page request. In milliseconds
19
+ */
20
20
  allPagesDelay?: number;
21
21
  /**
22
- * Specific page number to fetch (e.g., 2 for second page)
23
- */
22
+ * Specific page number to fetch (e.g., 2 for second page)
23
+ */
24
24
  page?: number;
25
25
  }
26
26
  //#endregion
@@ -13,10 +13,10 @@ const getCreatorName = (el) => {
13
13
  return (el?.querySelector("h1"))?.innerText?.trim() ?? null;
14
14
  };
15
15
  const getCreatorBirthdayInfo = (el) => {
16
- const infoBlock = el.querySelector("h1 + p");
16
+ const infoBlock = el.querySelector(".creator-profile-details p");
17
17
  const text = infoBlock?.innerHTML.trim();
18
- const birthPlaceRow = infoBlock?.querySelector(".info-place")?.innerHTML.trim();
19
- const ageRow = infoBlock?.querySelector(".info")?.innerHTML.trim();
18
+ const birthPlaceRow = infoBlock?.querySelector(".info-place")?.innerText.trim();
19
+ const ageRow = infoBlock?.querySelector(".info")?.innerText.trim();
20
20
  let birthday = "";
21
21
  if (text) {
22
22
  const birthdayRow = text.split("\n").find((x) => x.includes("nar."));
@@ -44,7 +44,7 @@ const parseAge = (text) => {
44
44
  };
45
45
  const parseBirthPlace = (text) => text.trim().replace(/<br>/g, "").trim();
46
46
  const getCreatorFilms = (el) => {
47
- const filmNodes = el?.querySelectorAll(".box")?.[0]?.querySelectorAll("table tr") ?? [];
47
+ const filmNodes = el?.querySelectorAll(".updated-box")?.[0]?.querySelectorAll("table tr") ?? [];
48
48
  let yearCache = null;
49
49
  return filmNodes.map((filmNode) => {
50
50
  const id = getCreatorId(filmNode.querySelector("td.name .film-title-name")?.attributes?.href);
@@ -1 +1 @@
1
- {"version":3,"file":"creator.helper.js","names":["parseColor","parseIdFromUrl","addProtocol"],"sources":["../../src/helpers/creator.helper.ts"],"sourcesContent":["import { HTMLElement } from 'node-html-parser';\nimport { CSFDCreatorScreening } from '../dto/creator';\nimport { CSFDColorRating } from '../dto/global';\nimport { CSFDColors } from '../dto/user-ratings';\nimport { addProtocol, parseColor, parseIdFromUrl } from './global.helper';\n\nconst getCreatorColorRating = (el: HTMLElement | null): CSFDColorRating => {\n const classes: string[] = el?.classNames.split(' ') ?? [];\n const last = classes[classes.length - 1] as CSFDColors | undefined;\n return parseColor(last);\n};\n\nexport const getCreatorId = (url: string | null | undefined): number | null => {\n return url ? parseIdFromUrl(url) : null;\n};\n\nexport const getCreatorName = (el: HTMLElement | null): string | null => {\n const h1 = el?.querySelector('h1');\n return h1?.innerText?.trim() ?? null;\n};\n\nexport const getCreatorBirthdayInfo = (\n el: HTMLElement | null\n): { birthday: string; age: number; birthPlace: string } => {\n const infoBlock = el.querySelector('h1 + p');\n const text = infoBlock?.innerHTML.trim();\n\n const birthPlaceRow = infoBlock?.querySelector('.info-place')?.innerHTML.trim();\n const ageRow = infoBlock?.querySelector('.info')?.innerHTML.trim();\n\n let birthday: string = '';\n\n if (text) {\n const parts = text.split('\\n');\n const birthdayRow = parts.find((x) => x.includes('nar.'));\n birthday = birthdayRow ? parseBirthday(birthdayRow) : '';\n }\n\n const age = ageRow ? +parseAge(ageRow) : null;\n const birthPlace = birthPlaceRow ? parseBirthPlace(birthPlaceRow) : '';\n\n return { birthday, age, birthPlace };\n};\n\nexport const getCreatorBio = (el: HTMLElement | null): string | null => {\n const p = el?.querySelector('.article-content p');\n const first = p?.text?.trim().split('\\n')[0]?.trim();\n return first || null;\n};\n\nexport const getCreatorPhoto = (el: HTMLElement | null): string | null => {\n const src = el?.querySelector('img')?.getAttribute('src');\n return src ? addProtocol(src) : null;\n};\n\nconst parseBirthday = (text: string): string => text.replace(/nar\\./g, '').trim();\n\nconst parseAge = (text: string): number | null => {\n const digits = text.replace(/[^\\d]/g, '');\n return digits ? Number(digits) : null;\n};\n\nconst parseBirthPlace = (text: string): string =>\n text.trim().replace(/<br>/g, '').trim();\n\n\nexport const getCreatorFilms = (el: HTMLElement | null): CSFDCreatorScreening[] => {\n const filmNodes = el?.querySelectorAll('.box')?.[0]?.querySelectorAll('table tr') ?? [];\n let yearCache: number | null = null;\n const films = filmNodes.map((filmNode) => {\n const id = getCreatorId(filmNode.querySelector('td.name .film-title-name')?.attributes?.href);\n const title = filmNode.querySelector('.name')?.text?.trim();\n const yearText = filmNode.querySelector('.year')?.text?.trim();\n const year = yearText ? +yearText : null;\n const colorRating = getCreatorColorRating(filmNode.querySelector('.name .icon'));\n\n // Cache year from previous film because there is a gap between movies with same year\n if (typeof year === 'number' && !isNaN(year)) {\n yearCache = +year;\n }\n\n const finalYear = year ?? yearCache;\n if (id != null && title && finalYear != null) {\n return { id, title, year: finalYear, colorRating };\n }\n return null;\n });\n // Remove empty objects\n const filmsUnique = films.filter(Boolean) as CSFDCreatorScreening[];\n return filmsUnique;\n};\n"],"mappings":";;;AAMA,MAAM,yBAAyB,OAA4C;CACzE,MAAM,UAAoB,IAAI,WAAW,MAAM,IAAI,IAAI,EAAE;CACzD,MAAM,OAAO,QAAQ,QAAQ,SAAS;AACtC,QAAOA,iCAAW,KAAK;;AAGzB,MAAa,gBAAgB,QAAkD;AAC7E,QAAO,MAAMC,qCAAe,IAAI,GAAG;;AAGrC,MAAa,kBAAkB,OAA0C;AAEvE,SADW,IAAI,cAAc,KAAK,GACvB,WAAW,MAAM,IAAI;;AAGlC,MAAa,0BACX,OAC0D;CAC1D,MAAM,YAAY,GAAG,cAAc,SAAS;CAC5C,MAAM,OAAO,WAAW,UAAU,MAAM;CAExC,MAAM,gBAAgB,WAAW,cAAc,cAAc,EAAE,UAAU,MAAM;CAC/E,MAAM,SAAS,WAAW,cAAc,QAAQ,EAAE,UAAU,MAAM;CAElE,IAAI,WAAmB;AAEvB,KAAI,MAAM;EAER,MAAM,cADQ,KAAK,MAAM,KAAK,CACJ,MAAM,MAAM,EAAE,SAAS,OAAO,CAAC;AACzD,aAAW,cAAc,cAAc,YAAY,GAAG;;CAGxD,MAAM,MAAM,SAAS,CAAC,SAAS,OAAO,GAAG;CACzC,MAAM,aAAa,gBAAgB,gBAAgB,cAAc,GAAG;AAEpE,QAAO;EAAE;EAAU;EAAK;EAAY;;AAGtC,MAAa,iBAAiB,OAA0C;AAGtE,SAFU,IAAI,cAAc,qBAAqB,GAChC,MAAM,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,IACpC;;AAGlB,MAAa,mBAAmB,OAA0C;CACxE,MAAM,MAAM,IAAI,cAAc,MAAM,EAAE,aAAa,MAAM;AACzD,QAAO,MAAMC,kCAAY,IAAI,GAAG;;AAGlC,MAAM,iBAAiB,SAAyB,KAAK,QAAQ,UAAU,GAAG,CAAC,MAAM;AAEjF,MAAM,YAAY,SAAgC;CAChD,MAAM,SAAS,KAAK,QAAQ,UAAU,GAAG;AACzC,QAAO,SAAS,OAAO,OAAO,GAAG;;AAGnC,MAAM,mBAAmB,SACvB,KAAK,MAAM,CAAC,QAAQ,SAAS,GAAG,CAAC,MAAM;AAGzC,MAAa,mBAAmB,OAAmD;CACjF,MAAM,YAAY,IAAI,iBAAiB,OAAO,GAAG,IAAI,iBAAiB,WAAW,IAAI,EAAE;CACvF,IAAI,YAA2B;AAqB/B,QApBc,UAAU,KAAK,aAAa;EACxC,MAAM,KAAK,aAAa,SAAS,cAAc,2BAA2B,EAAE,YAAY,KAAK;EAC7F,MAAM,QAAQ,SAAS,cAAc,QAAQ,EAAE,MAAM,MAAM;EAC3D,MAAM,WAAW,SAAS,cAAc,QAAQ,EAAE,MAAM,MAAM;EAC9D,MAAM,OAAO,WAAW,CAAC,WAAW;EACpC,MAAM,cAAc,sBAAsB,SAAS,cAAc,cAAc,CAAC;AAGhF,MAAI,OAAO,SAAS,YAAY,CAAC,MAAM,KAAK,CAC1C,aAAY,CAAC;EAGf,MAAM,YAAY,QAAQ;AAC1B,MAAI,MAAM,QAAQ,SAAS,aAAa,KACtC,QAAO;GAAE;GAAI;GAAO,MAAM;GAAW;GAAa;AAEpD,SAAO;GACP,CAEwB,OAAO,QAAQ"}
1
+ {"version":3,"file":"creator.helper.js","names":["parseColor","parseIdFromUrl","addProtocol"],"sources":["../../src/helpers/creator.helper.ts"],"sourcesContent":["import { HTMLElement } from 'node-html-parser';\nimport { CSFDCreatorScreening } from '../dto/creator';\nimport { CSFDColorRating } from '../dto/global';\nimport { CSFDColors } from '../dto/user-ratings';\nimport { addProtocol, parseColor, parseIdFromUrl } from './global.helper';\n\nconst getCreatorColorRating = (el: HTMLElement | null): CSFDColorRating => {\n const classes: string[] = el?.classNames.split(' ') ?? [];\n const last = classes[classes.length - 1] as CSFDColors | undefined;\n return parseColor(last);\n};\n\nexport const getCreatorId = (url: string | null | undefined): number | null => {\n return url ? parseIdFromUrl(url) : null;\n};\n\nexport const getCreatorName = (el: HTMLElement | null): string | null => {\n const h1 = el?.querySelector('h1');\n return h1?.innerText?.trim() ?? null;\n};\n\nexport const getCreatorBirthdayInfo = (\n el: HTMLElement | null\n): { birthday: string; age: number; birthPlace: string } => {\n const infoBlock = el.querySelector('.creator-profile-details p');\n const text = infoBlock?.innerHTML.trim();\n const birthPlaceRow = infoBlock?.querySelector('.info-place')?.innerText.trim();\n const ageRow = infoBlock?.querySelector('.info')?.innerText.trim();\n\n let birthday: string = '';\n\n if (text) {\n const parts = text.split('\\n');\n const birthdayRow = parts.find((x) => x.includes('nar.'));\n birthday = birthdayRow ? parseBirthday(birthdayRow) : '';\n }\n\n const age = ageRow ? +parseAge(ageRow) : null;\n const birthPlace = birthPlaceRow ? parseBirthPlace(birthPlaceRow) : '';\n return { birthday, age, birthPlace };\n};\n\nexport const getCreatorBio = (el: HTMLElement | null): string | null => {\n const p = el?.querySelector('.article-content p');\n const first = p?.text?.trim().split('\\n')[0]?.trim();\n return first || null;\n};\n\nexport const getCreatorPhoto = (el: HTMLElement | null): string | null => {\n const src = el?.querySelector('img')?.getAttribute('src');\n return src ? addProtocol(src) : null;\n};\n\nconst parseBirthday = (text: string): string => text.replace(/nar\\./g, '').trim();\n\nconst parseAge = (text: string): number | null => {\n const digits = text.replace(/[^\\d]/g, '');\n return digits ? Number(digits) : null;\n};\n\nconst parseBirthPlace = (text: string): string => text.trim().replace(/<br>/g, '').trim();\n\nexport const getCreatorFilms = (el: HTMLElement | null): CSFDCreatorScreening[] => {\n const filmNodes = el?.querySelectorAll('.updated-box')?.[0]?.querySelectorAll('table tr') ?? [];\n let yearCache: number | null = null;\n\n const films = filmNodes.map((filmNode) => {\n const id = getCreatorId(filmNode.querySelector('td.name .film-title-name')?.attributes?.href);\n const title = filmNode.querySelector('.name')?.text?.trim();\n const yearText = filmNode.querySelector('.year')?.text?.trim();\n const year = yearText ? +yearText : null;\n const colorRating = getCreatorColorRating(filmNode.querySelector('.name .icon'));\n\n // Cache year from previous film because there is a gap between movies with same year\n if (typeof year === 'number' && !isNaN(year)) {\n yearCache = +year;\n }\n\n const finalYear = year ?? yearCache;\n if (id != null && title && finalYear != null) {\n return { id, title, year: finalYear, colorRating };\n }\n return null;\n });\n // Remove empty objects\n const filmsUnique = films.filter(Boolean) as CSFDCreatorScreening[];\n return filmsUnique;\n};\n"],"mappings":";;;AAMA,MAAM,yBAAyB,OAA4C;CACzE,MAAM,UAAoB,IAAI,WAAW,MAAM,IAAI,IAAI,EAAE;CACzD,MAAM,OAAO,QAAQ,QAAQ,SAAS;AACtC,QAAOA,iCAAW,KAAK;;AAGzB,MAAa,gBAAgB,QAAkD;AAC7E,QAAO,MAAMC,qCAAe,IAAI,GAAG;;AAGrC,MAAa,kBAAkB,OAA0C;AAEvE,SADW,IAAI,cAAc,KAAK,GACvB,WAAW,MAAM,IAAI;;AAGlC,MAAa,0BACX,OAC0D;CAC1D,MAAM,YAAY,GAAG,cAAc,6BAA6B;CAChE,MAAM,OAAO,WAAW,UAAU,MAAM;CACxC,MAAM,gBAAgB,WAAW,cAAc,cAAc,EAAE,UAAU,MAAM;CAC/E,MAAM,SAAS,WAAW,cAAc,QAAQ,EAAE,UAAU,MAAM;CAElE,IAAI,WAAmB;AAEvB,KAAI,MAAM;EAER,MAAM,cADQ,KAAK,MAAM,KAAK,CACJ,MAAM,MAAM,EAAE,SAAS,OAAO,CAAC;AACzD,aAAW,cAAc,cAAc,YAAY,GAAG;;CAGxD,MAAM,MAAM,SAAS,CAAC,SAAS,OAAO,GAAG;CACzC,MAAM,aAAa,gBAAgB,gBAAgB,cAAc,GAAG;AACpE,QAAO;EAAE;EAAU;EAAK;EAAY;;AAGtC,MAAa,iBAAiB,OAA0C;AAGtE,SAFU,IAAI,cAAc,qBAAqB,GAChC,MAAM,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,IACpC;;AAGlB,MAAa,mBAAmB,OAA0C;CACxE,MAAM,MAAM,IAAI,cAAc,MAAM,EAAE,aAAa,MAAM;AACzD,QAAO,MAAMC,kCAAY,IAAI,GAAG;;AAGlC,MAAM,iBAAiB,SAAyB,KAAK,QAAQ,UAAU,GAAG,CAAC,MAAM;AAEjF,MAAM,YAAY,SAAgC;CAChD,MAAM,SAAS,KAAK,QAAQ,UAAU,GAAG;AACzC,QAAO,SAAS,OAAO,OAAO,GAAG;;AAGnC,MAAM,mBAAmB,SAAyB,KAAK,MAAM,CAAC,QAAQ,SAAS,GAAG,CAAC,MAAM;AAEzF,MAAa,mBAAmB,OAAmD;CACjF,MAAM,YAAY,IAAI,iBAAiB,eAAe,GAAG,IAAI,iBAAiB,WAAW,IAAI,EAAE;CAC/F,IAAI,YAA2B;AAsB/B,QApBc,UAAU,KAAK,aAAa;EACxC,MAAM,KAAK,aAAa,SAAS,cAAc,2BAA2B,EAAE,YAAY,KAAK;EAC7F,MAAM,QAAQ,SAAS,cAAc,QAAQ,EAAE,MAAM,MAAM;EAC3D,MAAM,WAAW,SAAS,cAAc,QAAQ,EAAE,MAAM,MAAM;EAC9D,MAAM,OAAO,WAAW,CAAC,WAAW;EACpC,MAAM,cAAc,sBAAsB,SAAS,cAAc,cAAc,CAAC;AAGhF,MAAI,OAAO,SAAS,YAAY,CAAC,MAAM,KAAK,CAC1C,aAAY,CAAC;EAGf,MAAM,YAAY,QAAQ;AAC1B,MAAI,MAAM,QAAQ,SAAS,aAAa,KACtC,QAAO;GAAE;GAAI;GAAO,MAAM;GAAW;GAAa;AAEpD,SAAO;GACP,CAEwB,OAAO,QAAQ"}
@@ -13,10 +13,10 @@ const getCreatorName = (el) => {
13
13
  return (el?.querySelector("h1"))?.innerText?.trim() ?? null;
14
14
  };
15
15
  const getCreatorBirthdayInfo = (el) => {
16
- const infoBlock = el.querySelector("h1 + p");
16
+ const infoBlock = el.querySelector(".creator-profile-details p");
17
17
  const text = infoBlock?.innerHTML.trim();
18
- const birthPlaceRow = infoBlock?.querySelector(".info-place")?.innerHTML.trim();
19
- const ageRow = infoBlock?.querySelector(".info")?.innerHTML.trim();
18
+ const birthPlaceRow = infoBlock?.querySelector(".info-place")?.innerText.trim();
19
+ const ageRow = infoBlock?.querySelector(".info")?.innerText.trim();
20
20
  let birthday = "";
21
21
  if (text) {
22
22
  const birthdayRow = text.split("\n").find((x) => x.includes("nar."));
@@ -44,7 +44,7 @@ const parseAge = (text) => {
44
44
  };
45
45
  const parseBirthPlace = (text) => text.trim().replace(/<br>/g, "").trim();
46
46
  const getCreatorFilms = (el) => {
47
- const filmNodes = el?.querySelectorAll(".box")?.[0]?.querySelectorAll("table tr") ?? [];
47
+ const filmNodes = el?.querySelectorAll(".updated-box")?.[0]?.querySelectorAll("table tr") ?? [];
48
48
  let yearCache = null;
49
49
  return filmNodes.map((filmNode) => {
50
50
  const id = getCreatorId(filmNode.querySelector("td.name .film-title-name")?.attributes?.href);
@@ -1 +1 @@
1
- {"version":3,"file":"creator.helper.mjs","names":[],"sources":["../../src/helpers/creator.helper.ts"],"sourcesContent":["import { HTMLElement } from 'node-html-parser';\nimport { CSFDCreatorScreening } from '../dto/creator';\nimport { CSFDColorRating } from '../dto/global';\nimport { CSFDColors } from '../dto/user-ratings';\nimport { addProtocol, parseColor, parseIdFromUrl } from './global.helper';\n\nconst getCreatorColorRating = (el: HTMLElement | null): CSFDColorRating => {\n const classes: string[] = el?.classNames.split(' ') ?? [];\n const last = classes[classes.length - 1] as CSFDColors | undefined;\n return parseColor(last);\n};\n\nexport const getCreatorId = (url: string | null | undefined): number | null => {\n return url ? parseIdFromUrl(url) : null;\n};\n\nexport const getCreatorName = (el: HTMLElement | null): string | null => {\n const h1 = el?.querySelector('h1');\n return h1?.innerText?.trim() ?? null;\n};\n\nexport const getCreatorBirthdayInfo = (\n el: HTMLElement | null\n): { birthday: string; age: number; birthPlace: string } => {\n const infoBlock = el.querySelector('h1 + p');\n const text = infoBlock?.innerHTML.trim();\n\n const birthPlaceRow = infoBlock?.querySelector('.info-place')?.innerHTML.trim();\n const ageRow = infoBlock?.querySelector('.info')?.innerHTML.trim();\n\n let birthday: string = '';\n\n if (text) {\n const parts = text.split('\\n');\n const birthdayRow = parts.find((x) => x.includes('nar.'));\n birthday = birthdayRow ? parseBirthday(birthdayRow) : '';\n }\n\n const age = ageRow ? +parseAge(ageRow) : null;\n const birthPlace = birthPlaceRow ? parseBirthPlace(birthPlaceRow) : '';\n\n return { birthday, age, birthPlace };\n};\n\nexport const getCreatorBio = (el: HTMLElement | null): string | null => {\n const p = el?.querySelector('.article-content p');\n const first = p?.text?.trim().split('\\n')[0]?.trim();\n return first || null;\n};\n\nexport const getCreatorPhoto = (el: HTMLElement | null): string | null => {\n const src = el?.querySelector('img')?.getAttribute('src');\n return src ? addProtocol(src) : null;\n};\n\nconst parseBirthday = (text: string): string => text.replace(/nar\\./g, '').trim();\n\nconst parseAge = (text: string): number | null => {\n const digits = text.replace(/[^\\d]/g, '');\n return digits ? Number(digits) : null;\n};\n\nconst parseBirthPlace = (text: string): string =>\n text.trim().replace(/<br>/g, '').trim();\n\n\nexport const getCreatorFilms = (el: HTMLElement | null): CSFDCreatorScreening[] => {\n const filmNodes = el?.querySelectorAll('.box')?.[0]?.querySelectorAll('table tr') ?? [];\n let yearCache: number | null = null;\n const films = filmNodes.map((filmNode) => {\n const id = getCreatorId(filmNode.querySelector('td.name .film-title-name')?.attributes?.href);\n const title = filmNode.querySelector('.name')?.text?.trim();\n const yearText = filmNode.querySelector('.year')?.text?.trim();\n const year = yearText ? +yearText : null;\n const colorRating = getCreatorColorRating(filmNode.querySelector('.name .icon'));\n\n // Cache year from previous film because there is a gap between movies with same year\n if (typeof year === 'number' && !isNaN(year)) {\n yearCache = +year;\n }\n\n const finalYear = year ?? yearCache;\n if (id != null && title && finalYear != null) {\n return { id, title, year: finalYear, colorRating };\n }\n return null;\n });\n // Remove empty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K,QAAQ,UAAU,GAAG;AACzC,QAAO,SAAS,OAAO,OAAO,GAAG;;AAGnC,MAAM,mBAAmB,SACvB,KAAK,MAAM,CAAC,QAAQ,SAAS,GAAG,CAAC,MAAM;AAGzC,MAAa,mBAAmB,OAAmD;CACjF,MAAM,YAAY,IAAI,iBAAiB,OAAO,GAAG,IAAI,iBAAiB,WAAW,IAAI,EAAE;CACvF,IAAI,YAA2B;AAqB/B,QApBc,UAAU,KAAK,aAAa;EACxC,MAAM,KAAK,aAAa,SAAS,cAAc,2BAA2B,EAAE,YAAY,KAAK;EAC7F,MAAM,QAAQ,SAAS,cAAc,QAAQ,EAAE,MAAM,MAAM;EAC3D,MAAM,WAAW,SAAS,cAAc,QAAQ,EAAE,MAAM,MAAM;EAC9D,MAAM,OAAO,WAAW,CAAC,WAAW;EACpC,MAAM,cAAc,sBAAsB,SAAS,cAAc,cAAc,CAAC;AAGhF,MAAI,OAAO,SAAS,YAAY,CAAC,MAAM,KAAK,CAC1C,aAAY,CAAC;EAGf,MAAM,YAAY,QAAQ;AAC1B,MAAI,MAAM,QAAQ,SAAS,aAAa,KACtC,QAAO;GAAE;GAAI;GAAO,MAAM;GAAW;GAAa;AAEpD,SAAO;GACP,CAEwB,OAAO,QAAQ"}
1
+ {"version":3,"file":"creator.helper.mjs","names":[],"sources":["../../src/helpers/creator.helper.ts"],"sourcesContent":["import { HTMLElement } from 'node-html-parser';\nimport { CSFDCreatorScreening } from '../dto/creator';\nimport { CSFDColorRating } from '../dto/global';\nimport { CSFDColors } from '../dto/user-ratings';\nimport { addProtocol, parseColor, parseIdFromUrl } from './global.helper';\n\nconst getCreatorColorRating = (el: HTMLElement | null): CSFDColorRating => {\n const classes: string[] = el?.classNames.split(' ') ?? [];\n const last = classes[classes.length - 1] as CSFDColors | undefined;\n return parseColor(last);\n};\n\nexport const getCreatorId = (url: string | null | undefined): number | null => {\n return url ? parseIdFromUrl(url) : null;\n};\n\nexport const getCreatorName = (el: HTMLElement | null): string | null => {\n const h1 = el?.querySelector('h1');\n return h1?.innerText?.trim() ?? null;\n};\n\nexport const getCreatorBirthdayInfo = (\n el: HTMLElement | null\n): { birthday: string; age: number; birthPlace: string } => {\n const infoBlock = el.querySelector('.creator-profile-details p');\n const text = infoBlock?.innerHTML.trim();\n const birthPlaceRow = infoBlock?.querySelector('.info-place')?.innerText.trim();\n const ageRow = infoBlock?.querySelector('.info')?.innerText.trim();\n\n let birthday: string = '';\n\n if (text) {\n const parts = text.split('\\n');\n const birthdayRow = parts.find((x) => x.includes('nar.'));\n birthday = birthdayRow ? parseBirthday(birthdayRow) : '';\n }\n\n const age = ageRow ? +parseAge(ageRow) : null;\n const birthPlace = birthPlaceRow ? parseBirthPlace(birthPlaceRow) : '';\n return { birthday, age, birthPlace };\n};\n\nexport const getCreatorBio = (el: HTMLElement | null): string | null => {\n const p = el?.querySelector('.article-content p');\n const first = p?.text?.trim().split('\\n')[0]?.trim();\n return first || null;\n};\n\nexport const getCreatorPhoto = (el: HTMLElement | null): string | null => {\n const src = el?.querySelector('img')?.getAttribute('src');\n return src ? addProtocol(src) : null;\n};\n\nconst parseBirthday = (text: string): string => text.replace(/nar\\./g, '').trim();\n\nconst parseAge = (text: string): number | null => {\n const digits = text.replace(/[^\\d]/g, '');\n return digits ? Number(digits) : null;\n};\n\nconst parseBirthPlace = (text: string): string => text.trim().replace(/<br>/g, '').trim();\n\nexport const getCreatorFilms = (el: HTMLElement | null): CSFDCreatorScreening[] => {\n const filmNodes = el?.querySelectorAll('.updated-box')?.[0]?.querySelectorAll('table tr') ?? [];\n let yearCache: number | null = null;\n\n const films = filmNodes.map((filmNode) => {\n const id = getCreatorId(filmNode.querySelector('td.name .film-title-name')?.attributes?.href);\n const title = filmNode.querySelector('.name')?.text?.trim();\n const yearText = filmNode.querySelector('.year')?.text?.trim();\n const year = yearText ? +yearText : null;\n const colorRating = getCreatorColorRating(filmNode.querySelector('.name .icon'));\n\n // Cache year from previous film because there is a gap between movies with same year\n if (typeof year === 'number' && !isNaN(year)) {\n yearCache = +year;\n }\n\n const finalYear = year ?? yearCache;\n if (id != null && title && finalYear != null) {\n return { id, title, year: finalYear, colorRating };\n }\n return null;\n });\n // Remove empty objects\n const filmsUnique = films.filter(Boolean) as CSFDCreatorScreening[];\n return filmsUnique;\n};\n"],"mappings":";;;AAMA,MAAM,yBAAyB,OAA4C;CACzE,MAAM,UAAoB,IAAI,WAAW,MAAM,IAAI,IAAI,EAAE;CACzD,MAAM,OAAO,QAAQ,QAAQ,SAAS;AACtC,QAAO,WAAW,KAAK;;AAGzB,MAAa,gBAAgB,QAAkD;AAC7E,QAAO,MAAM,eAAe,IAAI,GAAG;;AAGrC,MAAa,kBAAkB,OAA0C;AAEvE,SADW,IAAI,cAAc,KAAK,GACvB,WAAW,MAAM,IAAI;;AAGlC,MAAa,0BACX,OAC0D;CAC1D,MAAM,YAAY,GAAG,cAAc,6BAA6B;CAChE,MAAM,OAAO,WAAW,UAAU,MAAM;CACxC,MAAM,gBAAgB,WAAW,cAAc,cAAc,EAAE,UAAU,MAAM;CAC/E,MAAM,SAAS,WAAW,cAAc,QAAQ,EAAE,UAAU,MAAM;CAElE,IAAI,WAAmB;AAEvB,KAAI,MAAM;EAER,MAAM,cADQ,KAAK,MAAM,KAAK,CACJ,MAAM,MAAM,EAAE,SAAS,OAAO,CAAC;AACzD,aAAW,cAAc,cAAc,YAAY,GAAG;;CAGxD,MAAM,MAAM,SAAS,CAAC,SAAS,OAAO,GAAG;CACzC,MAAM,aAAa,gBAAgB,gBAAgB,cAAc,GAAG;AACpE,QAAO;EAAE;EAAU;EAAK;EAAY;;AAGtC,MAAa,iBAAiB,OAA0C;AAGtE,SAFU,IAAI,cAAc,qBAAqB,GAChC,MAAM,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,IACpC;;AAGlB,MAAa,mBAAmB,OAA0C;CACxE,MAAM,MAAM,IAAI,cAAc,MAAM,EAAE,aAAa,MAAM;AACzD,QAAO,MAAM,YAAY,IAAI,GAAG;;AAGlC,MAAM,iBAAiB,SAAyB,KAAK,QAAQ,UAAU,GAAG,CAAC,MAAM;AAEjF,MAAM,YAAY,SAAgC;CAChD,MAAM,SAAS,KAAK,QAAQ,UAAU,GAAG;AACzC,QAAO,SAAS,OAAO,OAAO,GAAG;;AAGnC,MAAM,mBAAmB,SAAyB,KAAK,MAAM,CAAC,QAAQ,SAAS,GAAG,CAAC,MAAM;AAEzF,MAAa,mBAAmB,OAAmD;CACjF,MAAM,YAAY,IAAI,iBAAiB,eAAe,GAAG,IAAI,iBAAiB,WAAW,IAAI,EAAE;CAC/F,IAAI,YAA2B;AAsB/B,QApBc,UAAU,KAAK,aAAa;EACxC,MAAM,KAAK,aAAa,SAAS,cAAc,2BAA2B,EAAE,YAAY,KAAK;EAC7F,MAAM,QAAQ,SAAS,cAAc,QAAQ,EAAE,MAAM,MAAM;EAC3D,MAAM,WAAW,SAAS,cAAc,QAAQ,EAAE,MAAM,MAAM;EAC9D,MAAM,OAAO,WAAW,CAAC,WAAW;EACpC,MAAM,cAAc,sBAAsB,SAAS,cAAc,cAAc,CAAC;AAGhF,MAAI,OAAO,SAAS,YAAY,CAAC,MAAM,KAAK,CAC1C,aAAY,CAAC;EAGf,MAAM,YAAY,QAAQ;AAC1B,MAAI,MAAM,QAAQ,SAAS,aAAa,KACtC,QAAO;GAAE;GAAI;GAAO,MAAM;GAAW;GAAa;AAEpD,SAAO;GACP,CAEwB,OAAO,QAAQ"}
@@ -105,9 +105,9 @@ const getMovieDuration = (jsonLdRaw, el) => {
105
105
  const getMovieTitlesOther = (el) => {
106
106
  const namesNode = el.querySelectorAll(".film-names li");
107
107
  if (!namesNode.length) return [];
108
- return namesNode.map((el$1) => {
109
- const country = el$1.querySelector("img.flag").attributes.alt;
110
- const title = el$1.textContent.trim().split("\n")[0];
108
+ return namesNode.map((el) => {
109
+ const country = el.querySelector("img.flag").attributes.alt;
110
+ const title = el.textContent.trim().split("\n")[0];
111
111
  if (country && title) return {
112
112
  country,
113
113
  title
@@ -1 +1 @@
1
- {"version":3,"file":"movie.helper.js","names":["getColor","parseISO8601Duration","el","addProtocol","parseIdFromUrl"],"sources":["../../src/helpers/movie.helper.ts"],"sourcesContent":["import { HTMLElement } from 'node-html-parser';\nimport { CSFDColorRating } from '../dto/global';\nimport {\n CSFDBoxContent,\n CSFDCreatorGroups,\n CSFDCreatorGroupsEnglish,\n CSFDCreatorGroupsSlovak,\n CSFDGenres,\n CSFDMovieCreator,\n CSFDMovieListItem,\n CSFDPremiere,\n CSFDTitlesOther,\n CSFDVod,\n CSFDVodService\n} from '../dto/movie';\nimport { addProtocol, getColor, parseISO8601Duration, parseIdFromUrl } from './global.helper';\n\n/**\n * Maps language-specific movie creator group labels.\n * @param language - The language code (e.g., 'en', 'cs')\n * @param key - The key of the creator group (e.g., 'directors', 'writers')\n * @returns The localized label for the creator group\n */\nexport const getLocalizedCreatorLabel = (\n language: string | undefined,\n key: 'directors' | 'writers' | 'cinematography' | 'music' | 'actors' | 'basedOn' | 'producers' | 'filmEditing' | 'costumeDesign' | 'productionDesign' | 'casting' | 'sound' | 'makeup'\n): CSFDCreatorGroups | CSFDCreatorGroupsEnglish | CSFDCreatorGroupsSlovak => {\n const labels: Record<string, Record<string, CSFDCreatorGroups | CSFDCreatorGroupsEnglish | CSFDCreatorGroupsSlovak>> = {\n en: {\n directors: 'Directed by',\n writers: 'Screenplay',\n cinematography: 'Cinematography',\n music: 'Composer',\n actors: 'Cast',\n basedOn: 'Based on',\n producers: 'Produced by',\n filmEditing: 'Editing',\n costumeDesign: 'Costumes',\n productionDesign: 'Production design',\n casting: 'Casting',\n sound: 'Sound',\n makeup: 'Make-up'\n },\n cs: {\n directors: 'Režie',\n writers: 'Scénář',\n cinematography: 'Kamera',\n music: 'Hudba',\n actors: 'Hrají',\n basedOn: 'Předloha',\n producers: 'Produkce',\n filmEditing: 'Střih',\n costumeDesign: 'Kostýmy',\n productionDesign: 'Scénografie',\n casting: 'Casting',\n sound: 'Zvuk',\n makeup: 'Masky'\n },\n sk: {\n directors: 'Réžia',\n writers: 'Scenár',\n cinematography: 'Kamera',\n music: 'Hudba',\n actors: 'Hrajú',\n basedOn: 'Predloha',\n producers: 'Produkcia',\n filmEditing: 'Strih',\n costumeDesign: 'Kostýmy',\n productionDesign: 'Scénografia',\n casting: 'Casting',\n sound: 'Zvuk',\n makeup: 'Masky'\n }\n };\n\n const lang = language || 'cs'; // Default to Czech\n return (labels[lang] || labels['cs'])[key];\n};\n\nexport const getMovieId = (el: HTMLElement): number => {\n const url = el.querySelector('.tabs .tab-nav-list a').attributes.href;\n return parseIdFromUrl(url);\n};\n\nexport const getMovieTitle = (el: HTMLElement): string => {\n return el.querySelector('h1').innerText.split(`(`)[0].trim();\n};\n\nexport const getMovieGenres = (el: HTMLElement): CSFDGenres[] => {\n const genresRaw = el.querySelector('.genres').textContent;\n return genresRaw.split(' / ') as CSFDGenres[];\n};\n\nexport const getMovieOrigins = (el: HTMLElement): string[] => {\n const originsRaw = el.querySelector('.origin').textContent;\n const origins = originsRaw.split(',')[0];\n return origins.split(' / ');\n};\n\nexport const getMovieColorRating = (bodyClasses: string[]): CSFDColorRating => {\n return getColor(bodyClasses[1]);\n};\n\nexport const getMovieRating = (el: HTMLElement): number => {\n const ratingRaw = el.querySelector('.film-rating-average').textContent;\n const rating = ratingRaw?.replace(/%/g, '').trim();\n const ratingInt = parseInt(rating);\n\n if (Number.isInteger(ratingInt)) {\n return ratingInt;\n } else {\n return null;\n }\n};\n\nexport const getMovieRatingCount = (el: HTMLElement): number => {\n const ratingCountRaw = el.querySelector('.box-rating-container .counter')?.textContent;\n const ratingCount = +ratingCountRaw?.replace(/[(\\s)]/g, '');\n if (Number.isInteger(ratingCount)) {\n return ratingCount;\n } else {\n return null;\n }\n};\n\nexport const getMovieYear = (el: string): number => {\n try {\n const jsonLd = JSON.parse(el);\n return +jsonLd.dateCreated;\n } catch (error) {\n console.error('node-csfd-api: Error parsing JSON-LD', error);\n return null;\n }\n};\n\nexport const getMovieDuration = (jsonLdRaw: string, el: HTMLElement): number => {\n let duration = null;\n try {\n const jsonLd = JSON.parse(jsonLdRaw);\n duration = jsonLd.duration;\n return parseISO8601Duration(duration);\n } catch (error) {\n const origin = el.querySelector('.origin').innerText;\n const timeString = origin.split(',');\n if (timeString.length > 2) {\n // Get last time elelment\n const timeString2 = timeString.pop().trim();\n // Clean it\n const timeRaw = timeString2.split('(')[0].trim();\n // Split by minutes and hours\n const hoursMinsRaw = timeRaw.split('min')[0];\n const hoursMins = hoursMinsRaw.split('h');\n // Resolve hours + minutes format\n duration = hoursMins.length > 1 ? +hoursMins[0] * 60 + +hoursMins[1] : +hoursMins[0];\n return duration;\n } else {\n return null;\n }\n }\n};\n\nexport const getMovieTitlesOther = (el: HTMLElement): CSFDTitlesOther[] => {\n const namesNode = el.querySelectorAll('.film-names li');\n\n if (!namesNode.length) {\n return [];\n }\n\n const titlesOther = namesNode.map((el) => {\n const country = el.querySelector('img.flag').attributes.alt;\n const title = el.textContent.trim().split('\\n')[0];\n\n if (country && title) {\n return {\n country,\n title\n };\n } else {\n return null;\n }\n });\n\n return titlesOther.filter((x) => x);\n};\n\nexport const getMoviePoster = (el: HTMLElement | null): string => {\n const poster = el.querySelector('.film-posters img');\n // Resolve empty image\n if (poster) {\n if (poster.classNames?.includes('empty-image')) {\n return null;\n } else {\n // Full sized image (not thumb)\n const imageThumb = poster.attributes.src.split('?')[0];\n const image = imageThumb.replace(/\\/w140\\//, '/w1080/');\n return addProtocol(image);\n }\n } else {\n return null;\n }\n};\n\nexport const getMovieRandomPhoto = (el: HTMLElement | null): string => {\n const imageNode = el.querySelector('.gallery-item picture img');\n const image = imageNode?.attributes?.src;\n if (image) {\n return image.replace(/\\/w663\\//, '/w1326/');\n } else {\n return null;\n }\n};\n\nexport const getMovieTrivia = (el: HTMLElement | null): string[] => {\n const triviaNodes = el.querySelectorAll('.article-trivia ul li');\n if (triviaNodes?.length) {\n return triviaNodes.map((node) => node.textContent.trim().replace(/(\\r\\n|\\n|\\r|\\t)/gm, ''));\n } else {\n return null;\n }\n};\n\nexport const getMovieDescriptions = (el: HTMLElement): string[] => {\n return el\n .querySelectorAll('.body--plots .plot-full p, .body--plots .plots .plots-item p')\n .map((movie) => movie.textContent?.trim().replace(/(\\r\\n|\\n|\\r|\\t)/gm, ''));\n};\n\nconst parseMoviePeople = (el: HTMLElement): CSFDMovieCreator[] => {\n const people = el.querySelectorAll('a');\n return (\n people\n // Filter out \"more\" links\n .filter((x) => x.classNames.length === 0)\n .map((person) => {\n return {\n id: parseIdFromUrl(person.attributes.href),\n name: person.innerText.trim(),\n url: `https://www.csfd.cz${person.attributes.href}`\n };\n })\n );\n};\n\nexport const getMovieGroup = (el: HTMLElement, group: CSFDCreatorGroups | CSFDCreatorGroupsEnglish | CSFDCreatorGroupsSlovak): CSFDMovieCreator[] => {\n const creators = el.querySelectorAll('.creators h4');\n const element = creators.filter((elem) => elem.textContent.trim().includes(group))[0];\n if (element?.parentNode) {\n return parseMoviePeople(element.parentNode as HTMLElement);\n } else {\n return [];\n }\n};\n\nexport const getMovieType = (el: HTMLElement): string => {\n const type = el.querySelector('.film-header-name .type');\n return type?.innerText?.replace(/[{()}]/g, '') || 'film';\n};\n\nexport const getMovieVods = (el: HTMLElement | null): CSFDVod[] => {\n let vods: CSFDVod[] = [];\n if (el) {\n const buttons = el.querySelectorAll('.box-buttons .button');\n const buttonsVod = buttons.filter((x) => !x.classNames.includes('button-social'));\n vods = buttonsVod.map((btn) => {\n return {\n title: btn.textContent.trim() as CSFDVodService,\n url: btn.attributes.href\n };\n });\n }\n return vods.length ? vods : [];\n};\n\n// Get box content\nconst getBoxContent = (el: HTMLElement, box: string): HTMLElement => {\n const headers = el.querySelectorAll('section.box .box-header');\n return headers.find((header) => header.querySelector('h3')?.textContent.trim().includes(box))\n ?.parentNode;\n};\n\nexport const getMovieBoxMovies = (el: HTMLElement, boxName: CSFDBoxContent): CSFDMovieListItem[] => {\n const movieListItem: CSFDMovieListItem[] = [];\n const box = getBoxContent(el, boxName);\n const movieTitleNodes = box?.querySelectorAll('.article-header .film-title-name');\n if (movieTitleNodes?.length) {\n for (const item of movieTitleNodes) {\n movieListItem.push({\n id: parseIdFromUrl(item.attributes.href),\n title: item.textContent.trim(),\n url: `https://www.csfd.cz${item.attributes.href}`\n });\n }\n }\n return movieListItem;\n};\n\nexport const getMoviePremieres = (el: HTMLElement): CSFDPremiere[] => {\n const premiereNodes = el.querySelectorAll('.box-premieres li');\n const premiere: CSFDPremiere[] = [];\n for (const premiereNode of premiereNodes) {\n const title = premiereNode.querySelector('p + span').attributes.title;\n\n if (title) {\n const [date, ...company] = title?.split(' ');\n\n premiere.push({\n country: premiereNode.querySelector('.flag')?.attributes.title || null,\n format: premiereNode.querySelector('p').textContent.trim()?.split(' od')[0],\n date,\n company: company.join(' ')\n });\n }\n }\n return premiere;\n};\n\nexport const getMovieTags = (el: HTMLElement): string[] => {\n const tagsRaw = el.querySelectorAll('.box-content a[href*=\"/tag/\"]');\n return tagsRaw.map((tag) => tag.textContent);\n};\n"],"mappings":";;;;;;;;;AAuBA,MAAa,4BACX,UACA,QAC2E;CAC3E,MAAM,SAAiH;EACrH,IAAI;GACF,WAAW;GACX,SAAS;GACT,gBAAgB;GAChB,OAAO;GACP,QAAQ;GACR,SAAS;GACT,WAAW;GACX,aAAa;GACb,eAAe;GACf,kBAAkB;GAClB,SAAS;GACT,OAAO;GACP,QAAQ;GACT;EACD,IAAI;GACF,WAAW;GACX,SAAS;GACT,gBAAgB;GAChB,OAAO;GACP,QAAQ;GACR,SAAS;GACT,WAAW;GACX,aAAa;GACb,eAAe;GACf,kBAAkB;GAClB,SAAS;GACT,OAAO;GACP,QAAQ;GACT;EACD,IAAI;GACF,WAAW;GACX,SAAS;GACT,gBAAgB;GAChB,OAAO;GACP,QAAQ;GACR,SAAS;GACT,WAAW;GACX,aAAa;GACb,eAAe;GACf,kBAAkB;GAClB,SAAS;GACT,OAAO;GACP,QAAQ;GACT;EACF;AAGD,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AAW;EAC5C,CAAC;AAGN,QAAO;;AAGT,MAAa,qBAAqB,OAAoC;CACpE,MAAM,gBAAgB,GAAG,iBAAiB,oBAAoB;CAC9D,MAAM,WAA2B,EAAE;AACnC,MAAK,MAAM,gBAAgB,eAAe;EACxC,MAAM,QAAQ,aAAa,cAAc,WAAW,CAAC,WAAW;AAEhE,MAAI,OAAO;GACT,MAAM,CAAC,MAAM,GAAG,WAAW,OAAO,MAAM,IAAI;AAE5C,YAAS,KAAK;IACZ,SAAS,aAAa,cAAc,QAAQ,EAAE,WAAW,SAAS;IAClE,QAAQ,aAAa,cAAc,IAAI,CAAC,YAAY,MAAM,EAAE,MAAM,MAAM,CAAC;IACzE;IACA,SAAS,QAAQ,KAAK,IAAI;IAC3B,CAAC;;;AAGN,QAAO;;AAGT,MAAa,gBAAgB,OAA8B;AAEzD,QADgB,GAAG,iBAAiB,kCAAgC,CACrD,KAAK,QAAQ,IAAI,YAAY"}
1
+ {"version":3,"file":"movie.helper.js","names":["getColor","parseISO8601Duration","addProtocol","parseIdFromUrl"],"sources":["../../src/helpers/movie.helper.ts"],"sourcesContent":["import { HTMLElement } from 'node-html-parser';\nimport { CSFDColorRating } from '../dto/global';\nimport {\n CSFDBoxContent,\n CSFDCreatorGroups,\n CSFDCreatorGroupsEnglish,\n CSFDCreatorGroupsSlovak,\n CSFDGenres,\n CSFDMovieCreator,\n CSFDMovieListItem,\n CSFDPremiere,\n CSFDTitlesOther,\n CSFDVod,\n CSFDVodService\n} from '../dto/movie';\nimport { addProtocol, getColor, parseISO8601Duration, parseIdFromUrl } from './global.helper';\n\n/**\n * Maps language-specific movie creator group labels.\n * @param language - The language code (e.g., 'en', 'cs')\n * @param key - The key of the creator group (e.g., 'directors', 'writers')\n * @returns The localized label for the creator group\n */\nexport const getLocalizedCreatorLabel = (\n language: string | undefined,\n key: 'directors' | 'writers' | 'cinematography' | 'music' | 'actors' | 'basedOn' | 'producers' | 'filmEditing' | 'costumeDesign' | 'productionDesign' | 'casting' | 'sound' | 'makeup'\n): CSFDCreatorGroups | CSFDCreatorGroupsEnglish | CSFDCreatorGroupsSlovak => {\n const labels: Record<string, Record<string, CSFDCreatorGroups | CSFDCreatorGroupsEnglish | CSFDCreatorGroupsSlovak>> = {\n en: {\n directors: 'Directed by',\n writers: 'Screenplay',\n cinematography: 'Cinematography',\n music: 'Composer',\n actors: 'Cast',\n basedOn: 'Based on',\n producers: 'Produced by',\n filmEditing: 'Editing',\n costumeDesign: 'Costumes',\n productionDesign: 'Production design',\n casting: 'Casting',\n sound: 'Sound',\n makeup: 'Make-up'\n },\n cs: {\n directors: 'Režie',\n writers: 'Scénář',\n cinematography: 'Kamera',\n music: 'Hudba',\n actors: 'Hrají',\n basedOn: 'Předloha',\n producers: 'Produkce',\n filmEditing: 'Střih',\n costumeDesign: 'Kostýmy',\n productionDesign: 'Scénografie',\n casting: 'Casting',\n sound: 'Zvuk',\n makeup: 'Masky'\n },\n sk: {\n directors: 'Réžia',\n writers: 'Scenár',\n cinematography: 'Kamera',\n music: 'Hudba',\n actors: 'Hrajú',\n basedOn: 'Predloha',\n producers: 'Produkcia',\n filmEditing: 'Strih',\n costumeDesign: 'Kostýmy',\n productionDesign: 'Scénografia',\n casting: 'Casting',\n sound: 'Zvuk',\n makeup: 'Masky'\n }\n };\n\n const lang = language || 'cs'; // Default to Czech\n return (labels[lang] || labels['cs'])[key];\n};\n\nexport const getMovieId = (el: HTMLElement): number => {\n const url = el.querySelector('.tabs .tab-nav-list a').attributes.href;\n return parseIdFromUrl(url);\n};\n\nexport const getMovieTitle = (el: HTMLElement): string => {\n return el.querySelector('h1').innerText.split(`(`)[0].trim();\n};\n\nexport const getMovieGenres = (el: HTMLElement): CSFDGenres[] => {\n const genresRaw = el.querySelector('.genres').textContent;\n return genresRaw.split(' / ') as CSFDGenres[];\n};\n\nexport const getMovieOrigins = (el: HTMLElement): string[] => {\n const originsRaw = el.querySelector('.origin').textContent;\n const origins = originsRaw.split(',')[0];\n return origins.split(' / ');\n};\n\nexport const getMovieColorRating = (bodyClasses: string[]): CSFDColorRating => {\n return getColor(bodyClasses[1]);\n};\n\nexport const getMovieRating = (el: HTMLElement): number => {\n const ratingRaw = el.querySelector('.film-rating-average').textContent;\n const rating = ratingRaw?.replace(/%/g, '').trim();\n const ratingInt = parseInt(rating);\n\n if (Number.isInteger(ratingInt)) {\n return ratingInt;\n } else {\n return null;\n }\n};\n\nexport const getMovieRatingCount = (el: HTMLElement): number => {\n const ratingCountRaw = el.querySelector('.box-rating-container .counter')?.textContent;\n const ratingCount = +ratingCountRaw?.replace(/[(\\s)]/g, '');\n if (Number.isInteger(ratingCount)) {\n return ratingCount;\n } else {\n return null;\n }\n};\n\nexport const getMovieYear = (el: string): number => {\n try {\n const jsonLd = JSON.parse(el);\n return +jsonLd.dateCreated;\n } catch (error) {\n console.error('node-csfd-api: Error parsing JSON-LD', error);\n return null;\n }\n};\n\nexport const getMovieDuration = (jsonLdRaw: string, el: HTMLElement): number => {\n let duration = null;\n try {\n const jsonLd = JSON.parse(jsonLdRaw);\n duration = jsonLd.duration;\n return parseISO8601Duration(duration);\n } catch (error) {\n const origin = el.querySelector('.origin').innerText;\n const timeString = origin.split(',');\n if (timeString.length > 2) {\n // Get last time elelment\n const timeString2 = timeString.pop().trim();\n // Clean it\n const timeRaw = timeString2.split('(')[0].trim();\n // Split by minutes and hours\n const hoursMinsRaw = timeRaw.split('min')[0];\n const hoursMins = hoursMinsRaw.split('h');\n // Resolve hours + minutes format\n duration = hoursMins.length > 1 ? +hoursMins[0] * 60 + +hoursMins[1] : +hoursMins[0];\n return duration;\n } else {\n return null;\n }\n }\n};\n\nexport const getMovieTitlesOther = (el: HTMLElement): CSFDTitlesOther[] => {\n const namesNode = el.querySelectorAll('.film-names li');\n\n if (!namesNode.length) {\n return [];\n }\n\n const titlesOther = namesNode.map((el) => {\n const country = el.querySelector('img.flag').attributes.alt;\n const title = el.textContent.trim().split('\\n')[0];\n\n if (country && title) {\n return {\n country,\n title\n };\n } else {\n return null;\n }\n });\n\n return titlesOther.filter((x) => x);\n};\n\nexport const getMoviePoster = (el: HTMLElement | null): string => {\n const poster = el.querySelector('.film-posters img');\n // Resolve empty image\n if (poster) {\n if (poster.classNames?.includes('empty-image')) {\n return null;\n } else {\n // Full sized image (not thumb)\n const imageThumb = poster.attributes.src.split('?')[0];\n const image = imageThumb.replace(/\\/w140\\//, '/w1080/');\n return addProtocol(image);\n }\n } else {\n return null;\n }\n};\n\nexport const getMovieRandomPhoto = (el: HTMLElement | null): string => {\n const imageNode = el.querySelector('.gallery-item picture img');\n const image = imageNode?.attributes?.src;\n if (image) {\n return image.replace(/\\/w663\\//, '/w1326/');\n } else {\n return null;\n }\n};\n\nexport const getMovieTrivia = (el: HTMLElement | null): string[] => {\n const triviaNodes = el.querySelectorAll('.article-trivia ul li');\n if (triviaNodes?.length) {\n return triviaNodes.map((node) => node.textContent.trim().replace(/(\\r\\n|\\n|\\r|\\t)/gm, ''));\n } else {\n return null;\n }\n};\n\nexport const getMovieDescriptions = (el: HTMLElement): string[] => {\n return el\n .querySelectorAll('.body--plots .plot-full p, .body--plots .plots .plots-item p')\n .map((movie) => movie.textContent?.trim().replace(/(\\r\\n|\\n|\\r|\\t)/gm, ''));\n};\n\nconst parseMoviePeople = (el: HTMLElement): CSFDMovieCreator[] => {\n const people = el.querySelectorAll('a');\n return (\n people\n // Filter out \"more\" links\n .filter((x) => x.classNames.length === 0)\n .map((person) => {\n return {\n id: parseIdFromUrl(person.attributes.href),\n name: person.innerText.trim(),\n url: `https://www.csfd.cz${person.attributes.href}`\n };\n })\n );\n};\n\nexport const getMovieGroup = (el: HTMLElement, group: CSFDCreatorGroups | CSFDCreatorGroupsEnglish | CSFDCreatorGroupsSlovak): CSFDMovieCreator[] => {\n const creators = el.querySelectorAll('.creators h4');\n const element = creators.filter((elem) => elem.textContent.trim().includes(group))[0];\n if (element?.parentNode) {\n return parseMoviePeople(element.parentNode as HTMLElement);\n } else {\n return [];\n }\n};\n\nexport const getMovieType = (el: HTMLElement): string => {\n const type = el.querySelector('.film-header-name .type');\n return type?.innerText?.replace(/[{()}]/g, '') || 'film';\n};\n\nexport const getMovieVods = (el: HTMLElement | null): CSFDVod[] => {\n let vods: CSFDVod[] = [];\n if (el) {\n const buttons = el.querySelectorAll('.box-buttons .button');\n const buttonsVod = buttons.filter((x) => !x.classNames.includes('button-social'));\n vods = buttonsVod.map((btn) => {\n return {\n title: btn.textContent.trim() as CSFDVodService,\n url: btn.attributes.href\n };\n });\n }\n return vods.length ? vods : [];\n};\n\n// Get box content\nconst getBoxContent = (el: HTMLElement, box: string): HTMLElement => {\n const headers = el.querySelectorAll('section.box .box-header');\n return headers.find((header) => header.querySelector('h3')?.textContent.trim().includes(box))\n ?.parentNode;\n};\n\nexport const getMovieBoxMovies = (el: HTMLElement, boxName: CSFDBoxContent): CSFDMovieListItem[] => {\n const movieListItem: CSFDMovieListItem[] = [];\n const box = getBoxContent(el, boxName);\n const movieTitleNodes = box?.querySelectorAll('.article-header .film-title-name');\n if (movieTitleNodes?.length) {\n for (const item of movieTitleNodes) {\n movieListItem.push({\n id: parseIdFromUrl(item.attributes.href),\n title: item.textContent.trim(),\n url: `https://www.csfd.cz${item.attributes.href}`\n });\n }\n }\n return movieListItem;\n};\n\nexport const getMoviePremieres = (el: HTMLElement): CSFDPremiere[] => {\n const premiereNodes = el.querySelectorAll('.box-premieres li');\n const premiere: CSFDPremiere[] = [];\n for (const premiereNode of premiereNodes) {\n const title = premiereNode.querySelector('p + span').attributes.title;\n\n if (title) {\n const [date, ...company] = title?.split(' ');\n\n premiere.push({\n country: premiereNode.querySelector('.flag')?.attributes.title || null,\n format: premiereNode.querySelector('p').textContent.trim()?.split(' od')[0],\n date,\n company: company.join(' ')\n });\n }\n }\n return premiere;\n};\n\nexport const getMovieTags = (el: HTMLElement): string[] => {\n const tagsRaw = el.querySelectorAll('.box-content a[href*=\"/tag/\"]');\n return tagsRaw.map((tag) => tag.textContent);\n};\n"],"mappings":";;;;;;;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const namesNode = el.querySelectorAll(".film-names li");
107
107
  if (!namesNode.length) return [];
108
- return namesNode.map((el$1) => {
109
- const country = el$1.querySelector("img.flag").attributes.alt;
110
- const title = el$1.textContent.trim().split("\n")[0];
108
+ return namesNode.map((el) => {
109
+ const country = el.querySelector("img.flag").attributes.alt;
110
+ const title = el.textContent.trim().split("\n")[0];
111
111
  if (country && title) return {
112
112
  country,
113
113
  title
@@ -1 +1 @@
1
- {"version":3,"file":"movie.helper.mjs","names":["el"],"sources":["../../src/helpers/movie.helper.ts"],"sourcesContent":["import { HTMLElement } from 'node-html-parser';\nimport { CSFDColorRating } from '../dto/global';\nimport {\n CSFDBoxContent,\n CSFDCreatorGroups,\n CSFDCreatorGroupsEnglish,\n CSFDCreatorGroupsSlovak,\n CSFDGenres,\n CSFDMovieCreator,\n CSFDMovieListItem,\n CSFDPremiere,\n CSFDTitlesOther,\n CSFDVod,\n CSFDVodService\n} from '../dto/movie';\nimport { addProtocol, getColor, parseISO8601Duration, parseIdFromUrl } from './global.helper';\n\n/**\n * Maps language-specific movie creator group labels.\n * @param language - The language code (e.g., 'en', 'cs')\n * @param key - The key of the creator group (e.g., 'directors', 'writers')\n * @returns The localized label for the creator group\n */\nexport const getLocalizedCreatorLabel = (\n language: string | undefined,\n key: 'directors' | 'writers' | 'cinematography' | 'music' | 'actors' | 'basedOn' | 'producers' | 'filmEditing' | 'costumeDesign' | 'productionDesign' | 'casting' | 'sound' | 'makeup'\n): CSFDCreatorGroups | CSFDCreatorGroupsEnglish | CSFDCreatorGroupsSlovak => {\n const labels: Record<string, Record<string, CSFDCreatorGroups | CSFDCreatorGroupsEnglish | CSFDCreatorGroupsSlovak>> = {\n en: {\n directors: 'Directed by',\n writers: 'Screenplay',\n cinematography: 'Cinematography',\n music: 'Composer',\n actors: 'Cast',\n basedOn: 'Based on',\n producers: 'Produced by',\n filmEditing: 'Editing',\n costumeDesign: 'Costumes',\n productionDesign: 'Production design',\n casting: 'Casting',\n sound: 'Sound',\n makeup: 'Make-up'\n },\n cs: {\n directors: 'Režie',\n writers: 'Scénář',\n cinematography: 'Kamera',\n music: 'Hudba',\n actors: 'Hrají',\n basedOn: 'Předloha',\n producers: 'Produkce',\n filmEditing: 'Střih',\n costumeDesign: 'Kostýmy',\n productionDesign: 'Scénografie',\n casting: 'Casting',\n sound: 'Zvuk',\n makeup: 'Masky'\n },\n sk: {\n directors: 'Réžia',\n writers: 'Scenár',\n cinematography: 'Kamera',\n music: 'Hudba',\n actors: 'Hrajú',\n basedOn: 'Predloha',\n producers: 'Produkcia',\n filmEditing: 'Strih',\n costumeDesign: 'Kostýmy',\n productionDesign: 'Scénografia',\n casting: 'Casting',\n sound: 'Zvuk',\n makeup: 'Masky'\n }\n };\n\n const lang = language || 'cs'; // Default to Czech\n return (labels[lang] || labels['cs'])[key];\n};\n\nexport const getMovieId = (el: HTMLElement): number => {\n const url = el.querySelector('.tabs .tab-nav-list a').attributes.href;\n return parseIdFromUrl(url);\n};\n\nexport const getMovieTitle = (el: HTMLElement): string => {\n return el.querySelector('h1').innerText.split(`(`)[0].trim();\n};\n\nexport const getMovieGenres = (el: HTMLElement): CSFDGenres[] => {\n const genresRaw = el.querySelector('.genres').textContent;\n return genresRaw.split(' / ') as CSFDGenres[];\n};\n\nexport const getMovieOrigins = (el: HTMLElement): string[] => {\n const originsRaw = el.querySelector('.origin').textContent;\n const origins = originsRaw.split(',')[0];\n return origins.split(' / ');\n};\n\nexport const getMovieColorRating = (bodyClasses: string[]): CSFDColorRating => {\n return getColor(bodyClasses[1]);\n};\n\nexport const getMovieRating = (el: HTMLElement): number => {\n const ratingRaw = el.querySelector('.film-rating-average').textContent;\n const rating = ratingRaw?.replace(/%/g, '').trim();\n const ratingInt = parseInt(rating);\n\n if (Number.isInteger(ratingInt)) {\n return ratingInt;\n } else {\n return null;\n }\n};\n\nexport const getMovieRatingCount = (el: HTMLElement): number => {\n const ratingCountRaw = el.querySelector('.box-rating-container .counter')?.textContent;\n const ratingCount = +ratingCountRaw?.replace(/[(\\s)]/g, '');\n if (Number.isInteger(ratingCount)) {\n return ratingCount;\n } else {\n return null;\n }\n};\n\nexport const getMovieYear = (el: string): number => {\n try {\n const jsonLd = JSON.parse(el);\n return +jsonLd.dateCreated;\n } catch (error) {\n console.error('node-csfd-api: Error parsing JSON-LD', error);\n return null;\n }\n};\n\nexport const getMovieDuration = (jsonLdRaw: string, el: HTMLElement): number => {\n let duration = null;\n try {\n const jsonLd = JSON.parse(jsonLdRaw);\n duration = jsonLd.duration;\n return parseISO8601Duration(duration);\n } catch (error) {\n const origin = el.querySelector('.origin').innerText;\n const timeString = origin.split(',');\n if (timeString.length > 2) {\n // Get last time elelment\n const timeString2 = timeString.pop().trim();\n // Clean it\n const timeRaw = timeString2.split('(')[0].trim();\n // Split by minutes and hours\n const hoursMinsRaw = timeRaw.split('min')[0];\n const hoursMins = hoursMinsRaw.split('h');\n // Resolve hours + minutes format\n duration = hoursMins.length > 1 ? +hoursMins[0] * 60 + +hoursMins[1] : +hoursMins[0];\n return duration;\n } else {\n return null;\n }\n }\n};\n\nexport const getMovieTitlesOther = (el: HTMLElement): CSFDTitlesOther[] => {\n const namesNode = el.querySelectorAll('.film-names li');\n\n if (!namesNode.length) {\n return [];\n }\n\n const titlesOther = namesNode.map((el) => {\n const country = el.querySelector('img.flag').attributes.alt;\n const title = el.textContent.trim().split('\\n')[0];\n\n if (country && title) {\n return {\n country,\n title\n };\n } else {\n return null;\n }\n });\n\n return titlesOther.filter((x) => x);\n};\n\nexport const getMoviePoster = (el: HTMLElement | null): string => {\n const poster = el.querySelector('.film-posters img');\n // Resolve empty image\n if (poster) {\n if (poster.classNames?.includes('empty-image')) {\n return null;\n } else {\n // Full sized image (not thumb)\n const imageThumb = poster.attributes.src.split('?')[0];\n const image = imageThumb.replace(/\\/w140\\//, '/w1080/');\n return addProtocol(image);\n }\n } else {\n return null;\n }\n};\n\nexport const getMovieRandomPhoto = (el: HTMLElement | null): string => {\n const imageNode = el.querySelector('.gallery-item picture img');\n const image = imageNode?.attributes?.src;\n if (image) {\n return image.replace(/\\/w663\\//, '/w1326/');\n } else {\n return null;\n }\n};\n\nexport const getMovieTrivia = (el: HTMLElement | null): string[] => {\n const triviaNodes = el.querySelectorAll('.article-trivia ul li');\n if (triviaNodes?.length) {\n return triviaNodes.map((node) => node.textContent.trim().replace(/(\\r\\n|\\n|\\r|\\t)/gm, ''));\n } else {\n return null;\n }\n};\n\nexport const getMovieDescriptions = (el: HTMLElement): string[] => {\n return el\n .querySelectorAll('.body--plots .plot-full p, .body--plots .plots .plots-item p')\n .map((movie) => movie.textContent?.trim().replace(/(\\r\\n|\\n|\\r|\\t)/gm, ''));\n};\n\nconst parseMoviePeople = (el: HTMLElement): CSFDMovieCreator[] => {\n const people = el.querySelectorAll('a');\n return (\n people\n // Filter out \"more\" links\n .filter((x) => x.classNames.length === 0)\n .map((person) => {\n return {\n id: parseIdFromUrl(person.attributes.href),\n name: person.innerText.trim(),\n url: `https://www.csfd.cz${person.attributes.href}`\n };\n })\n );\n};\n\nexport const getMovieGroup = (el: HTMLElement, group: CSFDCreatorGroups | CSFDCreatorGroupsEnglish | CSFDCreatorGroupsSlovak): CSFDMovieCreator[] => {\n const creators = el.querySelectorAll('.creators h4');\n const element = creators.filter((elem) => elem.textContent.trim().includes(group))[0];\n if (element?.parentNode) {\n return parseMoviePeople(element.parentNode as HTMLElement);\n } else {\n return [];\n }\n};\n\nexport const getMovieType = (el: HTMLElement): string => {\n const type = el.querySelector('.film-header-name .type');\n return type?.innerText?.replace(/[{()}]/g, '') || 'film';\n};\n\nexport const getMovieVods = (el: HTMLElement | null): CSFDVod[] => {\n let vods: CSFDVod[] = [];\n if (el) {\n const buttons = el.querySelectorAll('.box-buttons .button');\n const buttonsVod = buttons.filter((x) => !x.classNames.includes('button-social'));\n vods = buttonsVod.map((btn) => {\n return {\n title: btn.textContent.trim() as CSFDVodService,\n url: btn.attributes.href\n };\n });\n }\n return vods.length ? vods : [];\n};\n\n// Get box content\nconst getBoxContent = (el: HTMLElement, box: string): HTMLElement => {\n const headers = el.querySelectorAll('section.box .box-header');\n return headers.find((header) => header.querySelector('h3')?.textContent.trim().includes(box))\n ?.parentNode;\n};\n\nexport const getMovieBoxMovies = (el: HTMLElement, boxName: CSFDBoxContent): CSFDMovieListItem[] => {\n const movieListItem: CSFDMovieListItem[] = [];\n const box = getBoxContent(el, boxName);\n const movieTitleNodes = box?.querySelectorAll('.article-header .film-title-name');\n if (movieTitleNodes?.length) {\n for (const item of movieTitleNodes) {\n movieListItem.push({\n id: parseIdFromUrl(item.attributes.href),\n title: item.textContent.trim(),\n url: `https://www.csfd.cz${item.attributes.href}`\n });\n }\n }\n return movieListItem;\n};\n\nexport const getMoviePremieres = (el: HTMLElement): CSFDPremiere[] => {\n const premiereNodes = el.querySelectorAll('.box-premieres li');\n const premiere: CSFDPremiere[] = [];\n for (const premiereNode of premiereNodes) {\n const title = premiereNode.querySelector('p + span').attributes.title;\n\n if (title) {\n const [date, ...company] = title?.split(' ');\n\n premiere.push({\n country: premiereNode.querySelector('.flag')?.attributes.title || null,\n format: premiereNode.querySelector('p').textContent.trim()?.split(' od')[0],\n date,\n company: company.join(' ')\n });\n }\n }\n return premiere;\n};\n\nexport const getMovieTags = (el: HTMLElement): string[] => {\n const tagsRaw = el.querySelectorAll('.box-content a[href*=\"/tag/\"]');\n return tagsRaw.map((tag) => tag.textContent);\n};\n"],"mappings":";;;;;;;;;AAuBA,MAAa,4BACX,UACA,QAC2E;CAC3E,MAAM,SAAiH;EACrH,IAAI;GACF,WAAW;GACX,SAAS;GACT,gBAAgB;GAChB,OAAO;GACP,QAAQ;GACR,SAAS;GACT,WAAW;GACX,aAAa;GACb,eAAe;GACf,kBAAkB;GAClB,SAAS;GACT,OAAO;GACP,QAAQ;GACT;EACD,IAAI;GACF,WAAW;GACX,SAAS;GACT,gBAAgB;GAChB,OAAO;GACP,QAAQ;GACR,SAAS;GACT,WAAW;GACX,aAAa;GACb,eAAe;GACf,kBAAkB;GA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M,cAAc,IAAI,QAAQ,EACT,iBAAiB,mCAAmC;AACjF,KAAI,iBAAiB,OACnB,MAAK,MAAM,QAAQ,gBACjB,eAAc,KAAK;EACjB,IAAI,eAAe,KAAK,WAAW,KAAK;EACxC,OAAO,KAAK,YAAY,MAAM;EAC9B,KAAK,sBAAsB,KAAK,WAAW;EAC5C,CAAC;AAGN,QAAO;;AAGT,MAAa,qBAAqB,OAAoC;CACpE,MAAM,gBAAgB,GAAG,iBAAiB,oBAAoB;CAC9D,MAAM,WAA2B,EAAE;AACnC,MAAK,MAAM,gBAAgB,eAAe;EACxC,MAAM,QAAQ,aAAa,cAAc,WAAW,CAAC,WAAW;AAEhE,MAAI,OAAO;GACT,MAAM,CAAC,MAAM,GAAG,WAAW,OAAO,MAAM,IAAI;AAE5C,YAAS,KAAK;IACZ,SAAS,aAAa,cAAc,QAAQ,EAAE,WAAW,SAAS;IAClE,QAAQ,aAAa,cAAc,IAAI,CAAC,YAAY,MAAM,EAAE,MAAM,MAAM,CAAC;IACzE;IACA,SAAS,QAAQ,KAAK,IAAI;IAC3B,CAAC;;;AAGN,QAAO;;AAGT,MAAa,gBAAgB,OAA8B;AAEzD,QADgB,GAAG,iBAAiB,kCAAgC,CACrD,KAAK,QAAQ,IAAI,YAAY"}
1
+ {"version":3,"file":"movie.helper.mjs","names":[],"sources":["../../src/helpers/movie.helper.ts"],"sourcesContent":["import { HTMLElement } from 'node-html-parser';\nimport { CSFDColorRating } from '../dto/global';\nimport {\n CSFDBoxContent,\n CSFDCreatorGroups,\n CSFDCreatorGroupsEnglish,\n CSFDCreatorGroupsSlovak,\n CSFDGenres,\n CSFDMovieCreator,\n CSFDMovieListItem,\n CSFDPremiere,\n CSFDTitlesOther,\n CSFDVod,\n CSFDVodService\n} from '../dto/movie';\nimport { addProtocol, getColor, parseISO8601Duration, parseIdFromUrl } from './global.helper';\n\n/**\n * Maps language-specific movie creator group labels.\n * @param language - The language code (e.g., 'en', 'cs')\n * @param key - The key of the creator group (e.g., 'directors', 'writers')\n * @returns The localized label for the creator group\n */\nexport const getLocalizedCreatorLabel = (\n language: string | undefined,\n key: 'directors' | 'writers' | 'cinematography' | 'music' | 'actors' | 'basedOn' | 'producers' | 'filmEditing' | 'costumeDesign' | 'productionDesign' | 'casting' | 'sound' | 'makeup'\n): CSFDCreatorGroups | CSFDCreatorGroupsEnglish | CSFDCreatorGroupsSlovak => {\n const labels: Record<string, Record<string, CSFDCreatorGroups | CSFDCreatorGroupsEnglish | CSFDCreatorGroupsSlovak>> = {\n en: {\n directors: 'Directed by',\n writers: 'Screenplay',\n cinematography: 'Cinematography',\n music: 'Composer',\n actors: 'Cast',\n basedOn: 'Based on',\n producers: 'Produced by',\n filmEditing: 'Editing',\n costumeDesign: 'Costumes',\n productionDesign: 'Production design',\n casting: 'Casting',\n sound: 'Sound',\n makeup: 'Make-up'\n },\n cs: {\n directors: 'Režie',\n writers: 'Scénář',\n cinematography: 'Kamera',\n music: 'Hudba',\n actors: 'Hrají',\n basedOn: 'Předloha',\n producers: 'Produkce',\n filmEditing: 'Střih',\n costumeDesign: 'Kostýmy',\n productionDesign: 'Scénografie',\n casting: 'Casting',\n sound: 'Zvuk',\n makeup: 'Masky'\n },\n sk: {\n directors: 'Réžia',\n writers: 'Scenár',\n cinematography: 'Kamera',\n music: 'Hudba',\n actors: 'Hrajú',\n basedOn: 'Predloha',\n producers: 'Produkcia',\n filmEditing: 'Strih',\n costumeDesign: 'Kostýmy',\n productionDesign: 'Scénografia',\n casting: 'Casting',\n sound: 'Zvuk',\n makeup: 'Masky'\n }\n };\n\n const lang = language || 'cs'; // Default to Czech\n return (labels[lang] || labels['cs'])[key];\n};\n\nexport const getMovieId = (el: HTMLElement): number => {\n const url = el.querySelector('.tabs .tab-nav-list a').attributes.href;\n return parseIdFromUrl(url);\n};\n\nexport const getMovieTitle = (el: HTMLElement): string => {\n return el.querySelector('h1').innerText.split(`(`)[0].trim();\n};\n\nexport const getMovieGenres = (el: HTMLElement): CSFDGenres[] => {\n const genresRaw = el.querySelector('.genres').textContent;\n return genresRaw.split(' / ') as CSFDGenres[];\n};\n\nexport const getMovieOrigins = (el: HTMLElement): string[] => {\n const originsRaw = el.querySelector('.origin').textContent;\n const origins = originsRaw.split(',')[0];\n return origins.split(' / ');\n};\n\nexport const getMovieColorRating = (bodyClasses: string[]): CSFDColorRating => {\n return getColor(bodyClasses[1]);\n};\n\nexport const getMovieRating = (el: HTMLElement): number => {\n const ratingRaw = el.querySelector('.film-rating-average').textContent;\n const rating = ratingRaw?.replace(/%/g, '').trim();\n const ratingInt = parseInt(rating);\n\n if (Number.isInteger(ratingInt)) {\n return ratingInt;\n } else {\n return null;\n }\n};\n\nexport const getMovieRatingCount = (el: HTMLElement): number => {\n const ratingCountRaw = el.querySelector('.box-rating-container .counter')?.textContent;\n const ratingCount = +ratingCountRaw?.replace(/[(\\s)]/g, '');\n if (Number.isInteger(ratingCount)) {\n return ratingCount;\n } else {\n return null;\n }\n};\n\nexport const getMovieYear = (el: string): number => {\n try {\n const jsonLd = JSON.parse(el);\n return +jsonLd.dateCreated;\n } catch (error) {\n console.error('node-csfd-api: Error parsing JSON-LD', error);\n return null;\n }\n};\n\nexport const getMovieDuration = (jsonLdRaw: string, el: HTMLElement): number => {\n let duration = null;\n try {\n const jsonLd = JSON.parse(jsonLdRaw);\n duration = jsonLd.duration;\n return parseISO8601Duration(duration);\n } catch (error) {\n const origin = el.querySelector('.origin').innerText;\n const timeString = origin.split(',');\n if (timeString.length > 2) {\n // Get last time elelment\n const timeString2 = timeString.pop().trim();\n // Clean it\n const timeRaw = timeString2.split('(')[0].trim();\n // Split by minutes and hours\n const hoursMinsRaw = timeRaw.split('min')[0];\n const hoursMins = hoursMinsRaw.split('h');\n // Resolve hours + minutes format\n duration = hoursMins.length > 1 ? +hoursMins[0] * 60 + +hoursMins[1] : +hoursMins[0];\n return duration;\n } else {\n return null;\n }\n }\n};\n\nexport const getMovieTitlesOther = (el: HTMLElement): CSFDTitlesOther[] => {\n const namesNode = el.querySelectorAll('.film-names li');\n\n if (!namesNode.length) {\n return [];\n }\n\n const titlesOther = namesNode.map((el) => {\n const country = el.querySelector('img.flag').attributes.alt;\n const title = el.textContent.trim().split('\\n')[0];\n\n if (country && title) {\n return {\n country,\n title\n };\n } else {\n return null;\n }\n });\n\n return titlesOther.filter((x) => x);\n};\n\nexport const getMoviePoster = (el: HTMLElement | null): string => {\n const poster = el.querySelector('.film-posters img');\n // Resolve empty image\n if (poster) {\n if (poster.classNames?.includes('empty-image')) {\n return null;\n } else {\n // Full sized image (not thumb)\n const imageThumb = poster.attributes.src.split('?')[0];\n const image = imageThumb.replace(/\\/w140\\//, '/w1080/');\n return addProtocol(image);\n }\n } else {\n return null;\n }\n};\n\nexport const getMovieRandomPhoto = (el: HTMLElement | null): string => {\n const imageNode = el.querySelector('.gallery-item picture img');\n const image = imageNode?.attributes?.src;\n if (image) {\n return image.replace(/\\/w663\\//, '/w1326/');\n } else {\n return null;\n }\n};\n\nexport const getMovieTrivia = (el: HTMLElement | null): string[] => {\n const triviaNodes = el.querySelectorAll('.article-trivia ul li');\n if (triviaNodes?.length) {\n return triviaNodes.map((node) => node.textContent.trim().replace(/(\\r\\n|\\n|\\r|\\t)/gm, ''));\n } else {\n return null;\n }\n};\n\nexport const getMovieDescriptions = (el: HTMLElement): string[] => {\n return el\n .querySelectorAll('.body--plots .plot-full p, .body--plots .plots .plots-item p')\n .map((movie) => movie.textContent?.trim().replace(/(\\r\\n|\\n|\\r|\\t)/gm, ''));\n};\n\nconst parseMoviePeople = (el: HTMLElement): CSFDMovieCreator[] => {\n const people = el.querySelectorAll('a');\n return (\n people\n // Filter out \"more\" links\n .filter((x) => x.classNames.length === 0)\n .map((person) => {\n return {\n id: parseIdFromUrl(person.attributes.href),\n name: person.innerText.trim(),\n url: `https://www.csfd.cz${person.attributes.href}`\n };\n })\n );\n};\n\nexport const getMovieGroup = (el: HTMLElement, group: CSFDCreatorGroups | CSFDCreatorGroupsEnglish | CSFDCreatorGroupsSlovak): CSFDMovieCreator[] => {\n const creators = el.querySelectorAll('.creators h4');\n const element = creators.filter((elem) => elem.textContent.trim().includes(group))[0];\n if (element?.parentNode) {\n return parseMoviePeople(element.parentNode as HTMLElement);\n } else {\n return [];\n }\n};\n\nexport const getMovieType = (el: HTMLElement): string => {\n const type = el.querySelector('.film-header-name .type');\n return type?.innerText?.replace(/[{()}]/g, '') || 'film';\n};\n\nexport const getMovieVods = (el: HTMLElement | null): CSFDVod[] => {\n let vods: CSFDVod[] = [];\n if (el) {\n const buttons = el.querySelectorAll('.box-buttons .button');\n const buttonsVod = buttons.filter((x) => !x.classNames.includes('button-social'));\n vods = buttonsVod.map((btn) => {\n return {\n title: btn.textContent.trim() as CSFDVodService,\n url: btn.attributes.href\n };\n });\n }\n return vods.length ? vods : [];\n};\n\n// Get box content\nconst getBoxContent = (el: HTMLElement, box: string): HTMLElement => {\n const headers = el.querySelectorAll('section.box .box-header');\n return headers.find((header) => header.querySelector('h3')?.textContent.trim().includes(box))\n ?.parentNode;\n};\n\nexport const getMovieBoxMovies = (el: HTMLElement, boxName: CSFDBoxContent): CSFDMovieListItem[] => {\n const movieListItem: CSFDMovieListItem[] = [];\n const box = getBoxContent(el, boxName);\n const movieTitleNodes = box?.querySelectorAll('.article-header .film-title-name');\n if (movieTitleNodes?.length) {\n for (const item of movieTitleNodes) {\n movieListItem.push({\n id: parseIdFromUrl(item.attributes.href),\n title: item.textContent.trim(),\n url: `https://www.csfd.cz${item.attributes.href}`\n });\n }\n }\n return movieListItem;\n};\n\nexport const getMoviePremieres = (el: HTMLElement): CSFDPremiere[] => {\n const premiereNodes = el.querySelectorAll('.box-premieres li');\n const premiere: CSFDPremiere[] = [];\n for (const premiereNode of premiereNodes) {\n const title = premiereNode.querySelector('p + span').attributes.title;\n\n if (title) {\n const [date, ...company] = title?.split(' ');\n\n premiere.push({\n country: premiereNode.querySelector('.flag')?.attributes.title || null,\n format: premiereNode.querySelector('p').textContent.trim()?.split(' od')[0],\n date,\n company: company.join(' ')\n });\n }\n }\n return premiere;\n};\n\nexport const getMovieTags = (el: HTMLElement): string[] => {\n const tagsRaw = el.querySelectorAll('.box-content a[href*=\"/tag/\"]');\n return tagsRaw.map((tag) => tag.textContent);\n};\n"],"mappings":";;;;;;;;;AAuBA,MAAa,4BACX,UACA,QAC2E;CAC3E,MAAM,SAAiH;EACrH,IAAI;GACF,WAAW;GACX,SAAS;GACT,gBAAgB;GAChB,OAAO;GACP,QAAQ;GACR,SAAS;GACT,WAAW;GACX,aAAa;GACb,eAAe;GACf,kBAAkB;GAClB,SAAS;GACT,OAAO;GACP,QAAQ;GACT;EACD,IAAI;GACF,WAAW;GACX,SAAS;GACT,gBAAgB;GAChB,OAAO;GACP,QAAQ;GACR,SAAS;GACT,WAAW;GACX,aAAa;GACb,eAAe;GACf,kBAAkB;GAClB,SAAS;GACT,OAAO;GACP,QAAQ;GACT;EACD,IAAI;GACF,WAAW;GACX,SAAS;GACT,gBAAgB;GAChB,OAAO;GACP,QAAQ;GACR,SAAS;GACT,WAAW;GACX,aAAa;GACb,eAAe;GACf,kBAAkB;GAClB,SAAS;GACT,OAAO;GACP,QAAQ;GACT;EACF;AAGD,SAAQ,OADK,YAAY,SACD,OAAO,OAAO;;AAQxC,MAAa,iBAAiB,OAA4B;AACxD,QAAO,GAAG,cAAc,KAAK,CAAC,UAAU,MAAM,IAAI,CAAC,GAAG,MAAM;;AAG9D,MAAa,kBAAkB,OAAkC;AAE/D,QADkB,GAAG,cAAc,UAAU,CAAC,YAC7B,MAAM,MAAM;;AAG/B,MAAa,mBAAmB,OAA8B;AAG5D,QAFmB,GAAG,cAAc,UAAU,CAAC,YACpB,MAAM,IAAI,CAAC,GACvB,MAAM,MAAM;;AAG7B,MAAa,uBAAuB,gBAA2C;AAC7E,QAAO,SAAS,YAAY,GAAG;;AAGjC,MAAa,kBAAkB,OAA4B;CAEzD,MAAM,SADY,GAAG,cAAc,uBAAuB,CAAC,aACjC,QAAQ,MAAM,GAAG,C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OAA8B;AAEzD,QADgB,GAAG,iBAAiB,kCAAgC,CACrD,KAAK,QAAQ,IAAI,YAAY"}
@@ -29,7 +29,7 @@ const parseSearchPeople = (el, type) => {
29
29
  let who;
30
30
  if (type === "directors") who = "Režie:";
31
31
  if (type === "actors") who = "Hrají:";
32
- const peopleNode = Array.from(el && el.querySelectorAll(".article-content p")).find((el$1) => el$1.textContent.includes(who));
32
+ const peopleNode = Array.from(el && el.querySelectorAll(".article-content p")).find((el) => el.textContent.includes(who));
33
33
  if (peopleNode) return Array.from(peopleNode.querySelectorAll("a")).map((person) => {
34
34
  return {
35
35
  id: require_global_helper.parseIdFromUrl(person.attributes.href),
@@ -1 +1 @@
1
- {"version":3,"file":"search.helper.js","names":["parseColor","addProtocol","el","parseIdFromUrl"],"sources":["../../src/helpers/search.helper.ts"],"sourcesContent":["import { HTMLElement } from 'node-html-parser';\nimport { CSFDColorRating, CSFDFilmTypes } from '../dto/global';\nimport { CSFDMovieCreator } from '../dto/movie';\nimport { CSFDColors } from '../dto/user-ratings';\nimport { addProtocol, parseColor, parseIdFromUrl } from './global.helper';\n\ntype Creator = 'Režie:' | 'Hrají:';\n\nexport const getSearchType = (el: HTMLElement): CSFDFilmTypes => {\n const type = el.querySelectorAll('.film-title-info .info')[1];\n return (type?.innerText?.replace(/[{()}]/g, '')?.trim() || 'film') as CSFDFilmTypes;\n};\n\nexport const getSearchTitle = (el: HTMLElement): string => {\n return el.querySelector('.film-title-name').text;\n};\n\nexport const getSearchYear = (el: HTMLElement): number => {\n return +el.querySelectorAll('.film-title-info .info')[0]?.innerText.replace(/[{()}]/g, '');\n};\n\nexport const getSearchUrl = (el: HTMLElement): string => {\n return el.querySelector('.film-title-name').attributes.href;\n};\n\nexport const getSearchColorRating = (el: HTMLElement): CSFDColorRating => {\n return parseColor(\n el.querySelector('.article-header i.icon').classNames.split(' ').pop() as CSFDColors\n );\n};\n\nexport const getSearchPoster = (el: HTMLElement): string => {\n const image = el.querySelector('img').attributes.src;\n return addProtocol(image);\n};\n\nexport const getSearchOrigins = (el: HTMLElement): string[] => {\n const originsRaw = el.querySelector('.article-content p .info')?.text;\n if (!originsRaw) return [];\n const originsAll = originsRaw?.split(', ')?.[0];\n return originsAll?.split('/').map((country) => country.trim());\n};\n\nexport const parseSearchPeople = (el: HTMLElement, type: 'directors' | 'actors'): CSFDMovieCreator[] => {\n let who: Creator;\n if (type === 'directors') who = 'Režie:';\n if (type === 'actors') who = 'Hrají:';\n\n const peopleNode = Array.from(el && el.querySelectorAll('.article-content p')).find((el) =>\n el.textContent.includes(who)\n );\n\n if (peopleNode) {\n const people = Array.from(peopleNode.querySelectorAll('a')) as unknown as HTMLElement[];\n\n return people.map((person) => {\n return {\n id: parseIdFromUrl(person.attributes.href),\n name: person.innerText.trim(),\n url: `https://www.csfd.cz${person.attributes.href}`\n };\n });\n } else {\n return [];\n }\n};\n"],"mappings":";;;AAQA,MAAa,iBAAiB,OAAmC;AAE/D,QADa,GAAG,iBAAiB,yBAAyB,CAAC,IAC7C,WAAW,QAAQ,WAAW,GAAG,EAAE,MAAM,IAAI;;AAG7D,MAAa,kBAAkB,OAA4B;AACzD,QAAO,GAAG,cAAc,mBAAmB,CAAC;;AAG9C,MAAa,iBAAiB,OAA4B;AACxD,QAAO,CAAC,GAAG,iBAAiB,yBAAyB,CAAC,IAAI,UAAU,QAAQ,WAAW,GAAG;;AAG5F,MAAa,gBAAgB,OAA4B;AACvD,QAAO,GAAG,cAAc,mBAAmB,CAAC,WAAW;;AAGzD,MAAa,wBAAwB,OAAqC;AACxE,QAAOA,iCACL,GAAG,cAAc,yBAAyB,CAAC,WAAW,MAAM,IAAI,CAAC,KAAK,CACvE;;AAGH,MAAa,mBAAmB,OAA4B;CAC1D,MAAM,QAAQ,GAAG,cAAc,MAAM,CAAC,WAAW;AACjD,QAAOC,kCAAY,MAAM;;AAG3B,MAAa,oBAAoB,OAA8B;CAC7D,MAAM,aAAa,GAAG,cAAc,2BAA2B,EAAE;AACjE,KAAI,CAAC,WAAY,QAAO,EAAE;AAE1B,SADmB,YAAY,MAAM,KAAK,GAAG,KAC1B,MAAM,IAAI,CAAC,KAAK,YAAY,QAAQ,MAAM,CAAC;;AAGhE,MAAa,qBAAqB,IAAiB,SAAqD;CACtG,IAAI;AACJ,KAAI,SAAS,YAAa,OAAM;AAChC,KAAI,SAAS,SAAU,OAAM;CAE7B,MAAM,aAAa,MAAM,KAAK,MAAM,GAAG,iBAAiB,qBAAqB,CAAC,CAAC,MAAM,SACnFC,KAAG,YAAY,SAAS,IAAI,CAC7B;AAED,KAAI,WAGF,QAFe,MAAM,KAAK,WAAW,iBAAiB,IAAI,CAAC,CAE7C,KAAK,WAAW;AAC5B,SAAO;GACL,IAAIC,qCAAe,OAAO,WAAW,KAAK;GAC1C,MAAM,OAAO,UAAU,MAAM;GAC7B,KAAK,sBAAsB,OAAO,WAAW;GAC9C;GACD;KAEF,QAAO,EAAE"}
1
+ {"version":3,"file":"search.helper.js","names":["parseColor","addProtocol","parseIdFromUrl"],"sources":["../../src/helpers/search.helper.ts"],"sourcesContent":["import { HTMLElement } from 'node-html-parser';\nimport { CSFDColorRating, CSFDFilmTypes } from '../dto/global';\nimport { CSFDMovieCreator } from '../dto/movie';\nimport { CSFDColors } from '../dto/user-ratings';\nimport { addProtocol, parseColor, parseIdFromUrl } from './global.helper';\n\ntype Creator = 'Režie:' | 'Hrají:';\n\nexport const getSearchType = (el: HTMLElement): CSFDFilmTypes => {\n const type = el.querySelectorAll('.film-title-info .info')[1];\n return (type?.innerText?.replace(/[{()}]/g, '')?.trim() || 'film') as CSFDFilmTypes;\n};\n\nexport const getSearchTitle = (el: HTMLElement): string => {\n return el.querySelector('.film-title-name').text;\n};\n\nexport const getSearchYear = (el: HTMLElement): number => {\n return +el.querySelectorAll('.film-title-info .info')[0]?.innerText.replace(/[{()}]/g, '');\n};\n\nexport const getSearchUrl = (el: HTMLElement): string => {\n return el.querySelector('.film-title-name').attributes.href;\n};\n\nexport const getSearchColorRating = (el: HTMLElement): CSFDColorRating => {\n return parseColor(\n el.querySelector('.article-header i.icon').classNames.split(' ').pop() as CSFDColors\n );\n};\n\nexport const getSearchPoster = (el: HTMLElement): string => {\n const image = el.querySelector('img').attributes.src;\n return addProtocol(image);\n};\n\nexport const getSearchOrigins = (el: HTMLElement): string[] => {\n const originsRaw = el.querySelector('.article-content p .info')?.text;\n if (!originsRaw) return [];\n const originsAll = originsRaw?.split(', ')?.[0];\n return originsAll?.split('/').map((country) => country.trim());\n};\n\nexport const parseSearchPeople = (el: HTMLElement, type: 'directors' | 'actors'): CSFDMovieCreator[] => {\n let who: Creator;\n if (type === 'directors') who = 'Režie:';\n if (type === 'actors') who = 'Hrají:';\n\n const peopleNode = Array.from(el && el.querySelectorAll('.article-content p')).find((el) =>\n el.textContent.includes(who)\n );\n\n if (peopleNode) {\n const people = Array.from(peopleNode.querySelectorAll('a')) as unknown as HTMLElement[];\n\n return people.map((person) => {\n return {\n id: parseIdFromUrl(person.attributes.href),\n name: person.innerText.trim(),\n url: `https://www.csfd.cz${person.attributes.href}`\n };\n });\n } else {\n return [];\n }\n};\n"],"mappings":";;;AAQA,MAAa,iBAAiB,OAAmC;AAE/D,QADa,GAAG,iBAAiB,yBAAyB,CAAC,IAC7C,WAAW,QAAQ,WAAW,GAAG,EAAE,MAAM,IAAI;;AAG7D,MAAa,kBAAkB,OAA4B;AACzD,QAAO,GAAG,cAAc,mBAAmB,CAAC;;AAG9C,MAAa,iBAAiB,OAA4B;AACxD,QAAO,CAAC,GAAG,iBAAiB,yBAAyB,CAAC,IAAI,UAAU,QAAQ,WAAW,GAAG;;AAG5F,MAAa,gBAAgB,OAA4B;AACvD,QAAO,GAAG,cAAc,mBAAmB,CAAC,WAAW;;AAGzD,MAAa,wBAAwB,OAAqC;AACxE,QAAOA,iCACL,GAAG,cAAc,yBAAyB,CAAC,WAAW,MAAM,IAAI,CAAC,KAAK,CACvE;;AAGH,MAAa,mBAAmB,OAA4B;CAC1D,MAAM,QAAQ,GAAG,cAAc,MAAM,CAAC,WAAW;AACjD,QAAOC,kCAAY,MAAM;;AAG3B,MAAa,oBAAoB,OAA8B;CAC7D,MAAM,aAAa,GAAG,cAAc,2BAA2B,EAAE;AACjE,KAAI,CAAC,WAAY,QAAO,EAAE;AAE1B,SADmB,YAAY,MAAM,KAAK,GAAG,KAC1B,MAAM,IAAI,CAAC,KAAK,YAAY,QAAQ,MAAM,CAAC;;AAGhE,MAAa,qBAAqB,IAAiB,SAAqD;CACtG,IAAI;AACJ,KAAI,SAAS,YAAa,OAAM;AAChC,KAAI,SAAS,SAAU,OAAM;CAE7B,MAAM,aAAa,MAAM,KAAK,MAAM,GAAG,iBAAiB,qBAAqB,CAAC,CAAC,MAAM,OACnF,GAAG,YAAY,SAAS,IAAI,CAC7B;AAED,KAAI,WAGF,QAFe,MAAM,KAAK,WAAW,iBAAiB,IAAI,CAAC,CAE7C,KAAK,WAAW;AAC5B,SAAO;GACL,IAAIC,qCAAe,OAAO,WAAW,KAAK;GAC1C,MAAM,OAAO,UAAU,MAAM;GAC7B,KAAK,sBAAsB,OAAO,WAAW;GAC9C;GACD;KAEF,QAAO,EAAE"}
@@ -29,7 +29,7 @@ const parseSearchPeople = (el, type) => {
29
29
  let who;
30
30
  if (type === "directors") who = "Režie:";
31
31
  if (type === "actors") who = "Hrají:";
32
- const peopleNode = Array.from(el && el.querySelectorAll(".article-content p")).find((el$1) => el$1.textContent.includes(who));
32
+ const peopleNode = Array.from(el && el.querySelectorAll(".article-content p")).find((el) => el.textContent.includes(who));
33
33
  if (peopleNode) return Array.from(peopleNode.querySelectorAll("a")).map((person) => {
34
34
  return {
35
35
  id: parseIdFromUrl(person.attributes.href),
@@ -1 +1 @@
1
- {"version":3,"file":"search.helper.mjs","names":["el"],"sources":["../../src/helpers/search.helper.ts"],"sourcesContent":["import { HTMLElement } from 'node-html-parser';\nimport { CSFDColorRating, CSFDFilmTypes } from '../dto/global';\nimport { CSFDMovieCreator } from '../dto/movie';\nimport { CSFDColors } from '../dto/user-ratings';\nimport { addProtocol, parseColor, parseIdFromUrl } from './global.helper';\n\ntype Creator = 'Režie:' | 'Hrají:';\n\nexport const getSearchType = (el: HTMLElement): CSFDFilmTypes => {\n const type = el.querySelectorAll('.film-title-info .info')[1];\n return (type?.innerText?.replace(/[{()}]/g, '')?.trim() || 'film') as CSFDFilmTypes;\n};\n\nexport const getSearchTitle = (el: HTMLElement): string => {\n return el.querySelector('.film-title-name').text;\n};\n\nexport const getSearchYear = (el: HTMLElement): number => {\n return +el.querySelectorAll('.film-title-info .info')[0]?.innerText.replace(/[{()}]/g, '');\n};\n\nexport const getSearchUrl = (el: HTMLElement): string => {\n return el.querySelector('.film-title-name').attributes.href;\n};\n\nexport const getSearchColorRating = (el: HTMLElement): CSFDColorRating => {\n return parseColor(\n el.querySelector('.article-header i.icon').classNames.split(' ').pop() as CSFDColors\n );\n};\n\nexport const getSearchPoster = (el: HTMLElement): string => {\n const image = el.querySelector('img').attributes.src;\n return addProtocol(image);\n};\n\nexport const getSearchOrigins = (el: HTMLElement): string[] => {\n const originsRaw = el.querySelector('.article-content p .info')?.text;\n if (!originsRaw) return [];\n const originsAll = originsRaw?.split(', ')?.[0];\n return originsAll?.split('/').map((country) => country.trim());\n};\n\nexport const parseSearchPeople = (el: HTMLElement, type: 'directors' | 'actors'): CSFDMovieCreator[] => {\n let who: Creator;\n if (type === 'directors') who = 'Režie:';\n if (type === 'actors') who = 'Hrají:';\n\n const peopleNode = Array.from(el && el.querySelectorAll('.article-content p')).find((el) =>\n el.textContent.includes(who)\n );\n\n if (peopleNode) {\n const people = Array.from(peopleNode.querySelectorAll('a')) as unknown as HTMLElement[];\n\n return people.map((person) => {\n return {\n id: parseIdFromUrl(person.attributes.href),\n name: person.innerText.trim(),\n url: `https://www.csfd.cz${person.attributes.href}`\n };\n });\n } else {\n return [];\n }\n};\n"],"mappings":";;;AAQA,MAAa,iBAAiB,OAAmC;AAE/D,QADa,GAAG,iBAAiB,yBAAyB,CAAC,IAC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cesContent":["import { HTMLElement } from 'node-html-parser';\nimport { CSFDColorRating, CSFDFilmTypes } from '../dto/global';\nimport { CSFDMovieCreator } from '../dto/movie';\nimport { CSFDColors } from '../dto/user-ratings';\nimport { addProtocol, parseColor, parseIdFromUrl } from './global.helper';\n\ntype Creator = 'Režie:' | 'Hrají:';\n\nexport const getSearchType = (el: HTMLElement): CSFDFilmTypes => {\n const type = el.querySelectorAll('.film-title-info .info')[1];\n return (type?.innerText?.replace(/[{()}]/g, '')?.trim() || 'film') as CSFDFilmTypes;\n};\n\nexport const getSearchTitle = (el: HTMLElement): string => {\n return el.querySelector('.film-title-name').text;\n};\n\nexport const getSearchYear = (el: HTMLElement): number => {\n return +el.querySelectorAll('.film-title-info .info')[0]?.innerText.replace(/[{()}]/g, '');\n};\n\nexport const getSearchUrl = (el: HTMLElement): string => {\n return el.querySelector('.film-title-name').attributes.href;\n};\n\nexport const getSearchColorRating = (el: HTMLElement): CSFDColorRating => {\n return parseColor(\n el.querySelector('.article-header i.icon').classNames.split(' ').pop() as CSFDColors\n );\n};\n\nexport const getSearchPoster = (el: HTMLElement): string => {\n const image = el.querySelector('img').attributes.src;\n return addProtocol(image);\n};\n\nexport const getSearchOrigins = (el: HTMLElement): string[] => {\n const originsRaw = el.querySelector('.article-content p .info')?.text;\n if (!originsRaw) return [];\n const originsAll = originsRaw?.split(', ')?.[0];\n return originsAll?.split('/').map((country) => country.trim());\n};\n\nexport const parseSearchPeople = (el: HTMLElement, type: 'directors' | 'actors'): CSFDMovieCreator[] => {\n let who: Creator;\n if (type === 'directors') who = 'Režie:';\n if (type === 'actors') who = 'Hrají:';\n\n const peopleNode = Array.from(el && el.querySelectorAll('.article-content p')).find((el) =>\n el.textContent.includes(who)\n );\n\n if (peopleNode) {\n const people = Array.from(peopleNode.querySelectorAll('a')) as unknown as HTMLElement[];\n\n return people.map((person) => {\n return {\n id: parseIdFromUrl(person.attributes.href),\n name: person.innerText.trim(),\n url: `https://www.csfd.cz${person.attributes.href}`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AsB,OAAO,WAAW;GAC9C;GACD;KAEF,QAAO,EAAE"}
@@ -11,13 +11,13 @@ const getUserRating = (el) => {
11
11
  };
12
12
  const getUserRatingType = (el) => {
13
13
  const typeText = el.querySelectorAll("td.name .film-title-info .info");
14
- return typeText.length > 1 ? typeText[1].text.slice(1, -1) : "film";
14
+ return typeText.length > 1 ? typeText[1].text : "film";
15
15
  };
16
16
  const getUserRatingTitle = (el) => {
17
17
  return el.querySelector("td.name .film-title-name").text;
18
18
  };
19
19
  const getUserRatingYear = (el) => {
20
- return +el.querySelectorAll("td.name .film-title-info .info")[0]?.text.slice(1, -1) || null;
20
+ return +el.querySelectorAll("td.name .film-title-info .info")[0]?.text || null;
21
21
  };
22
22
  const getUserRatingColorRating = (el) => {
23
23
  return require_global_helper.parseColor(el.querySelector("td.name .icon").classNames.split(" ").pop());
@@ -1 +1 @@
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 { CSFDColors } 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 CSFDColors);\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,CAAe;;AAIvG,MAAa,qBAAqB,OAA4B;AAC5D,QAAO,GAAG,cAAc,eAAe,CAAC,KAAK,MAAM;;AAGrD,MAAa,oBAAoB,OAA4B;AAE3D,QAAO,sBADK,GAAG,cAAc,2BAA2B,CAAC,WAAW"}
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 { CSFDColors } 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 : '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 || null;\n};\n\nexport const getUserRatingColorRating = (el: HTMLElement): CSFDColorRating => {\n const color = parseColor(\n el.querySelector('td.name .icon').classNames.split(' ').pop() as CSFDColors\n );\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,OAAO;;AAGnD,MAAa,sBAAsB,OAA4B;AAC7D,QAAO,GAAG,cAAc,2BAA2B,CAAC;;AAGtD,MAAa,qBAAqB,OAA4B;AAC5D,QAAO,CAAC,GAAG,iBAAiB,iCAAiC,CAAC,IAAI,QAAQ;;AAG5E,MAAa,4BAA4B,OAAqC;AAI5E,QAHcC,iCACZ,GAAG,cAAc,gBAAgB,CAAC,WAAW,MAAM,IAAI,CAAC,KAAK,CAC9D;;AAIH,MAAa,qBAAqB,OAA4B;AAC5D,QAAO,GAAG,cAAc,eAAe,CAAC,KAAK,MAAM;;AAGrD,MAAa,oBAAoB,OAA4B;AAE3D,QAAO,sBADK,GAAG,cAAc,2BAA2B,CAAC,WAAW"}
@@ -11,13 +11,13 @@ const getUserRating = (el) => {
11
11
  };
12
12
  const getUserRatingType = (el) => {
13
13
  const typeText = el.querySelectorAll("td.name .film-title-info .info");
14
- return typeText.length > 1 ? typeText[1].text.slice(1, -1) : "film";
14
+ return typeText.length > 1 ? typeText[1].text : "film";
15
15
  };
16
16
  const getUserRatingTitle = (el) => {
17
17
  return el.querySelector("td.name .film-title-name").text;
18
18
  };
19
19
  const getUserRatingYear = (el) => {
20
- return +el.querySelectorAll("td.name .film-title-info .info")[0]?.text.slice(1, -1) || null;
20
+ return +el.querySelectorAll("td.name .film-title-info .info")[0]?.text || null;
21
21
  };
22
22
  const getUserRatingColorRating = (el) => {
23
23
  return parseColor(el.querySelector("td.name .icon").classNames.split(" ").pop());
@@ -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 { CSFDColors } 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 CSFDColors);\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,CAAe;;AAIvG,MAAa,qBAAqB,OAA4B;AAC5D,QAAO,GAAG,cAAc,eAAe,CAAC,KAAK,MAAM;;AAGrD,MAAa,oBAAoB,OAA4B;AAE3D,QAAO,sBADK,GAAG,cAAc,2BAA2B,CAAC,WAAW"}
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 { CSFDColors } 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 : '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 || null;\n};\n\nexport const getUserRatingColorRating = (el: HTMLElement): CSFDColorRating => {\n const color = parseColor(\n el.querySelector('td.name .icon').classNames.split(' ').pop() as CSFDColors\n );\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,OAAO;;AAGnD,MAAa,sBAAsB,OAA4B;AAC7D,QAAO,GAAG,cAAc,2BAA2B,CAAC;;AAGtD,MAAa,qBAAqB,OAA4B;AAC5D,QAAO,CAAC,GAAG,iBAAiB,iCAAiC,CAAC,IAAI,QAAQ;;AAG5E,MAAa,4BAA4B,OAAqC;AAI5E,QAHc,WACZ,GAAG,cAAc,gBAAgB,CAAC,WAAW,MAAM,IAAI,CAAC,KAAK,CAC9D;;AAIH,MAAa,qBAAqB,OAA4B;AAC5D,QAAO,GAAG,cAAc,eAAe,CAAC,KAAK,MAAM;;AAGrD,MAAa,oBAAoB,OAA4B;AAE3D,QAAO,sBADK,GAAG,cAAc,2BAA2B,CAAC,WAAW"}
@@ -21,16 +21,16 @@ const getUserReviewYear = (el) => {
21
21
  return infoSpan ? +infoSpan.text.replace(/[()]/g, "") : null;
22
22
  };
23
23
  const getUserReviewColorRating = (el) => {
24
- return require_global_helper.parseColor(el.querySelector(".film-title-nooverflow .icon")?.classNames.split(" ").pop());
24
+ return require_global_helper.parseColor(el.querySelector(".film-title-inline i.icon")?.classNames.split(" ").pop());
25
25
  };
26
26
  const getUserReviewDate = (el) => {
27
- return el.querySelector(".header-right-info .info time").text.trim();
27
+ return el.querySelector(".article-header-date-content .info time").text.trim();
28
28
  };
29
29
  const getUserReviewUrl = (el) => {
30
30
  return `https://www.csfd.cz${el.querySelector(".film-title-name").attributes.href}`;
31
31
  };
32
32
  const getUserReviewText = (el) => {
33
- return el.querySelector(".user-reviews-text .comment").text.trim();
33
+ return el.querySelector(".comment").text.trim();
34
34
  };
35
35
  const getUserReviewPoster = (el) => {
36
36
  const img = el.querySelector(".article-img img");
@@ -1 +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 { CSFDColors } 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 CSFDColors);\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,CAAe;;AAI3E,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"}
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 { CSFDColors } 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-inline i.icon');\n const color = parseColor(icon?.classNames.split(' ').pop() as CSFDColors);\n return color;\n};\n\nexport const getUserReviewDate = (el: HTMLElement): string => {\n return el.querySelector('.article-header-date-content .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('.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();\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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"}
@@ -21,16 +21,16 @@ const getUserReviewYear = (el) => {
21
21
  return infoSpan ? +infoSpan.text.replace(/[()]/g, "") : null;
22
22
  };
23
23
  const getUserReviewColorRating = (el) => {
24
- return parseColor(el.querySelector(".film-title-nooverflow .icon")?.classNames.split(" ").pop());
24
+ return parseColor(el.querySelector(".film-title-inline i.icon")?.classNames.split(" ").pop());
25
25
  };
26
26
  const getUserReviewDate = (el) => {
27
- return el.querySelector(".header-right-info .info time").text.trim();
27
+ return el.querySelector(".article-header-date-content .info time").text.trim();
28
28
  };
29
29
  const getUserReviewUrl = (el) => {
30
30
  return `https://www.csfd.cz${el.querySelector(".film-title-name").attributes.href}`;
31
31
  };
32
32
  const getUserReviewText = (el) => {
33
- return el.querySelector(".user-reviews-text .comment").text.trim();
33
+ return el.querySelector(".comment").text.trim();
34
34
  };
35
35
  const getUserReviewPoster = (el) => {
36
36
  const img = el.querySelector(".article-img img");
@@ -1 +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 { CSFDColors } 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 CSFDColors);\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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"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 { CSFDColors } 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-inline i.icon');\n const color = parseColor(icon?.classNames.split(' ').pop() as CSFDColors);\n return color;\n};\n\nexport const getUserReviewDate = (el: HTMLElement): string => {\n return el.querySelector('.article-header-date-content .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('.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,4BAA4B,EAC3B,WAAW,MAAM,IAAI,CAAC,KAAK,CAAe;;AAI3E,MAAa,qBAAqB,OAA4B;AAC5D,QAAO,GAAG,cAAc,0CAA0C,CAAC,KAAK,MAAM;;AAGhF,MAAa,oBAAoB,OAA4B;AAE3D,QAAO,sBADK,GAAG,cAAc,mBAAmB,CAAC,WAAW;;AAI9D,MAAa,qBAAqB,OAA4B;AAC5D,QAAO,GAAG,cAAc,WAAW,CAAC,KAAK,MAAM;;AAGjD,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.js CHANGED
@@ -1,3 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
2
  const require_cinema_service = require('./services/cinema.service.js');
2
3
  const require_creator_service = require('./services/creator.service.js');
3
4
  const require_movie_service = require('./services/movie.service.js');
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["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';\nimport { CSFDOptions } from './types';\n\nexport class Csfd {\n private defaultOptions?: CSFDOptions;\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 defaultOptions?: CSFDOptions\n ) {\n this.defaultOptions = defaultOptions;\n }\n\n public setOptions({ request, language }: CSFDOptions): void {\n if (request !== undefined) {\n this.defaultOptions = { ...this.defaultOptions, request };\n }\n if (language !== undefined) {\n this.defaultOptions = { ...this.defaultOptions, language };\n }\n }\n\n public async userRatings(\n user: string | number,\n config?: CSFDUserRatingConfig,\n options?: CSFDOptions\n ): Promise<CSFDUserRatings[]> {\n const opts = options ?? this.defaultOptions;\n return this.userRatingsService.userRatings(user, config, opts);\n }\n\n public async userReviews(\n user: string | number,\n config?: CSFDUserReviewsConfig,\n options?: CSFDOptions\n ): Promise<CSFDUserReviews[]> {\n const opts = options ?? this.defaultOptions;\n return this.userReviewsService.userReviews(user, config, opts);\n }\n\n public async movie(movie: number, options?: CSFDOptions): Promise<CSFDMovie> {\n const opts = options ?? this.defaultOptions;\n return this.movieService.movie(+movie, opts);\n }\n\n public async creator(creator: number, options?: CSFDOptions): Promise<CSFDCreator> {\n const opts = options ?? this.defaultOptions;\n return this.creatorService.creator(+creator, opts);\n }\n\n public async search(text: string, options?: CSFDOptions): Promise<CSFDSearch> {\n const opts = options ?? this.defaultOptions;\n return this.searchService.search(text, opts);\n }\n\n public async cinema(\n district: number | string,\n period: CSFDCinemaPeriod,\n options?: CSFDOptions\n ): Promise<CSFDCinema[]> {\n const opts = options ?? this.defaultOptions;\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\n"],"mappings":";;;;;;;;AAcA,IAAa,OAAb,MAAkB;CAGhB,YACE,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AEzC,MAAa,OAAO,IAAI,KACtB,oBACA,oBACA,cACA,gBACA,eACA,cACD"}
1
+ {"version":3,"file":"index.js","names":["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';\nimport { CSFDOptions } from './types';\n\nexport class Csfd {\n private defaultOptions?: CSFDOptions;\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 defaultOptions?: CSFDOptions\n ) {\n this.defaultOptions = defaultOptions;\n }\n\n public setOptions({ request, language }: CSFDOptions): void {\n if (request !== undefined) {\n this.defaultOptions = { ...this.defaultOptions, request };\n }\n if (language !== undefined) {\n this.defaultOptions = { ...this.defaultOptions, language };\n }\n }\n\n public async userRatings(\n user: string | number,\n config?: CSFDUserRatingConfig,\n options?: CSFDOptions\n ): Promise<CSFDUserRatings[]> {\n const opts = options ?? this.defaultOptions;\n return this.userRatingsService.userRatings(user, config, opts);\n }\n\n public async userReviews(\n user: string | number,\n config?: CSFDUserReviewsConfig,\n options?: CSFDOptions\n ): Promise<CSFDUserReviews[]> {\n const opts = options ?? this.defaultOptions;\n return this.userReviewsService.userReviews(user, config, opts);\n }\n\n public async movie(movie: number, options?: CSFDOptions): Promise<CSFDMovie> {\n const opts = options ?? this.defaultOptions;\n return this.movieService.movie(+movie, opts);\n }\n\n public async creator(creator: number, options?: CSFDOptions): Promise<CSFDCreator> {\n const opts = options ?? this.defaultOptions;\n return this.creatorService.creator(+creator, opts);\n }\n\n public async search(text: string, options?: CSFDOptions): Promise<CSFDSearch> {\n const opts = options ?? this.defaultOptions;\n return this.searchService.search(text, opts);\n }\n\n public async cinema(\n district: number | string,\n period: CSFDCinemaPeriod,\n options?: CSFDOptions\n ): Promise<CSFDCinema[]> {\n const opts = options ?? this.defaultOptions;\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\n"],"mappings":";;;;;;;;;AAcA,IAAa,OAAb,MAAkB;CAGhB,YACE,AAAQ,oBACR,AAAQ,oBACR,AAAQ,cACR,AAAQ,gBACR,AAAQ,eACR,AAAQ,eACR,gBACA;EAPQ;EACA;EACA;EACA;EACA;EACA;AAGR,OAAK,iBAAiB;;CAGxB,AAAO,WAAW,EAAE,SAAS,YAA+B;AAC1D,MAAI,YAAY,OACd,MAAK,iBAAiB;GAAE,GAAG,KAAK;GAAgB;GAAS;AAE3D,MAAI,aAAa,OACf,MAAK,iBAAiB;GAAE,GAAG,KAAK;GAAgB;GAAU;;CAI9D,MAAa,YACX,MACA,QACA,SAC4B;EAC5B,MAAM,OAAO,WAAW,KAAK;AAC7B,SAAO,KAAK,mBAAmB,YAAY,MAAM,QAAQ,KAAK;;CAGhE,MAAa,YACX,MACA,QACA,SAC4B;EAC5B,MAAM,OAAO,WAAW,KAAK;AAC7B,SAAO,KAAK,mBAAmB,YAAY,MAAM,QAAQ,KAAK;;CAGhE,MAAa,MAAM,OAAe,SAA2C;EAC3E,MAAM,OAAO,WAAW,KAAK;AAC7B,SAAO,KAAK,aAAa,MAAM,CAAC,OAAO,KAAK;;CAG9C,MAAa,QAAQ,SAAiB,SAA6C;EACjF,MAAM,OAAO,WAAW,KAAK;AAC7B,SAAO,KAAK,eAAe,QAAQ,CAAC,SAAS,KAAK;;CAGpD,MAAa,OAAO,MAAc,SAA4C;EAC5E,MAAM,OAAO,WAAW,KAAK;AAC7B,SAAO,KAAK,cAAc,OAAO,MAAM,KAAK;;CAG9C,MAAa,OACX,UACA,QACA,SACuB;EACvB,MAAM,OAAO,WAAW,KAAK;AAC7B,SAAO,KAAK,cAAc,QAAQ,CAAC,UAAU,QAAQ,KAAK;;;AAI9D,MAAM,eAAe,IAAIA,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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-csfd-api",
3
- "version": "4.1.4",
3
+ "version": "4.1.6",
4
4
  "description": "ČSFD API in JavaScript. Amazing NPM library for scrapping csfd.cz :)",
5
5
  "author": "BART! <bart@bartweb.cz>",
6
6
  "publishConfig": {
@@ -11,7 +11,7 @@ var UserRatingsScraper = class {
11
11
  const pageToFetch = config?.page || 1;
12
12
  const url = require_vars.userRatingsUrl(user, pageToFetch > 1 ? pageToFetch : void 0, { language: options?.language });
13
13
  const items = (0, node_html_parser.parse)(await require_index.fetchPage(url, { ...options?.request }));
14
- const movies = items.querySelectorAll(".box-user-rating .table-container tbody tr");
14
+ const movies = items.querySelectorAll("#snippet--ratings table tr");
15
15
  const pagesNode = items.querySelector(".pagination");
16
16
  const pages = +pagesNode?.childNodes[pagesNode.childNodes.length - 4].rawText || 1;
17
17
  allMovies = this.getPage(config, movies);
@@ -20,8 +20,8 @@ var UserRatingsScraper = class {
20
20
  console.log("Fetching all pages", pages);
21
21
  for (let i = 2; i <= pages; i++) {
22
22
  console.log("Fetching page", i, "out of", pages, "...");
23
- const movies$1 = (0, node_html_parser.parse)(await require_index.fetchPage(require_vars.userRatingsUrl(user, i, { language: options?.language }), { ...options?.request })).querySelectorAll(".box-user-rating .table-container tbody tr");
24
- allMovies = [...allMovies, ...this.getPage(config, movies$1)];
23
+ const movies = (0, node_html_parser.parse)(await require_index.fetchPage(require_vars.userRatingsUrl(user, i, { language: options?.language }), { ...options?.request })).querySelectorAll("#snippet--ratings table tr");
24
+ allMovies = [...allMovies, ...this.getPage(config, movies)];
25
25
  if (config.allPagesDelay) await require_global_helper.sleep(config.allPagesDelay);
26
26
  }
27
27
  return allMovies;
@@ -1 +1 @@
1
- {"version":3,"file":"user-ratings.service.js","names":["userRatingsUrl","fetchPage","movies","sleep","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 { CSFDOptions } from '../types';\nimport { userRatingsUrl } from '../vars';\n\nexport class UserRatingsScraper {\n public async userRatings(\n user: string | number,\n config?: CSFDUserRatingConfig,\n options?: CSFDOptions\n ): Promise<CSFDUserRatings[]> {\n let allMovies: CSFDUserRatings[] = [];\n const pageToFetch = config?.page || 1;\n const url = userRatingsUrl(user, pageToFetch > 1 ? pageToFetch : undefined, { language: options?.language });\n const response = await fetchPage(url, { ...options?.request });\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, { language: options?.language });\n const response = await fetchPage(url, { ...options?.request });\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":";;;;;;;AAkBA,IAAa,qBAAb,MAAgC;CAC9B,MAAa,YACX,MACA,QACA,SAC4B;EAC5B,IAAI,YAA+B,EAAE;EACrC,MAAM,cAAc,QAAQ,QAAQ;EACpC,MAAM,MAAMA,4BAAe,MAAM,cAAc,IAAI,cAAc,QAAW,EAAE,UAAU,SAAS,UAAU,CAAC;EAE5G,MAAM,oCADW,MAAMC,wBAAU,KAAK,EAAE,GAAG,SAAS,SAAS,CAAC,CACjC;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,GAAG,EAAE,UAAU,SAAS,UAAU,CAAC,EAC9B,EAAE,GAAG,SAAS,SAAS,CAAC,CAEjC,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,MAAM,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
+ {"version":3,"file":"user-ratings.service.js","names":["userRatingsUrl","fetchPage","sleep","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 { CSFDOptions } from '../types';\nimport { userRatingsUrl } from '../vars';\n\nexport class UserRatingsScraper {\n public async userRatings(\n user: string | number,\n config?: CSFDUserRatingConfig,\n options?: CSFDOptions\n ): Promise<CSFDUserRatings[]> {\n let allMovies: CSFDUserRatings[] = [];\n const pageToFetch = config?.page || 1;\n const url = userRatingsUrl(user, pageToFetch > 1 ? pageToFetch : undefined, {\n language: options?.language\n });\n const response = await fetchPage(url, { ...options?.request });\n const items = parse(response);\n const movies = items.querySelectorAll('#snippet--ratings table 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, { language: options?.language });\n const response = await fetchPage(url, { ...options?.request });\n\n const items = parse(response);\n const movies = items.querySelectorAll('#snippet--ratings table 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":";;;;;;;AAkBA,IAAa,qBAAb,MAAgC;CAC9B,MAAa,YACX,MACA,QACA,SAC4B;EAC5B,IAAI,YAA+B,EAAE;EACrC,MAAM,cAAc,QAAQ,QAAQ;EACpC,MAAM,MAAMA,4BAAe,MAAM,cAAc,IAAI,cAAc,QAAW,EAC1E,UAAU,SAAS,UACpB,CAAC;EAEF,MAAM,oCADW,MAAMC,wBAAU,KAAK,EAAE,GAAG,SAAS,SAAS,CAAC,CACjC;EAC7B,MAAM,SAAS,MAAM,iBAAiB,6BAA6B;EAGnE,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,MAAM,qCAHW,MAAMA,wBADXD,4BAAe,MAAM,GAAG,EAAE,UAAU,SAAS,UAAU,CAAC,EAC9B,EAAE,GAAG,SAAS,SAAS,CAAC,CAEjC,CACR,iBAAiB,6BAA6B;AACnE,gBAAY,CAAC,GAAG,WAAW,GAAG,KAAK,QAAQ,QAAQ,OAAO,CAAC;AAG3D,QAAI,OAAO,cACT,OAAME,4BAAM,OAAO,cAAc;;AAGrC,UAAO;;AAGT,SAAO;;CAGT,AAAQ,QAAQ,QAA8B,QAAuB;EACnE,MAAM,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"}
@@ -11,7 +11,7 @@ var UserRatingsScraper = class {
11
11
  const pageToFetch = config?.page || 1;
12
12
  const url = userRatingsUrl(user, pageToFetch > 1 ? pageToFetch : void 0, { language: options?.language });
13
13
  const items = parse(await fetchPage(url, { ...options?.request }));
14
- const movies = items.querySelectorAll(".box-user-rating .table-container tbody tr");
14
+ const movies = items.querySelectorAll("#snippet--ratings table tr");
15
15
  const pagesNode = items.querySelector(".pagination");
16
16
  const pages = +pagesNode?.childNodes[pagesNode.childNodes.length - 4].rawText || 1;
17
17
  allMovies = this.getPage(config, movies);
@@ -20,8 +20,8 @@ var UserRatingsScraper = class {
20
20
  console.log("Fetching all pages", pages);
21
21
  for (let i = 2; i <= pages; i++) {
22
22
  console.log("Fetching page", i, "out of", pages, "...");
23
- const movies$1 = parse(await fetchPage(userRatingsUrl(user, i, { language: options?.language }), { ...options?.request })).querySelectorAll(".box-user-rating .table-container tbody tr");
24
- allMovies = [...allMovies, ...this.getPage(config, movies$1)];
23
+ const movies = parse(await fetchPage(userRatingsUrl(user, i, { language: options?.language }), { ...options?.request })).querySelectorAll("#snippet--ratings table tr");
24
+ allMovies = [...allMovies, ...this.getPage(config, movies)];
25
25
  if (config.allPagesDelay) await sleep(config.allPagesDelay);
26
26
  }
27
27
  return allMovies;
@@ -1 +1 @@
1
- {"version":3,"file":"user-ratings.service.mjs","names":["movies"],"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 { CSFDOptions } from '../types';\nimport { userRatingsUrl } from '../vars';\n\nexport class UserRatingsScraper {\n public async userRatings(\n user: string | number,\n config?: CSFDUserRatingConfig,\n options?: CSFDOptions\n ): Promise<CSFDUserRatings[]> {\n let allMovies: CSFDUserRatings[] = [];\n const pageToFetch = config?.page || 1;\n const url = userRatingsUrl(user, pageToFetch > 1 ? pageToFetch : undefined, { language: options?.language });\n const response = await fetchPage(url, { ...options?.request });\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, { language: options?.language });\n const response = await fetchPage(url, { ...options?.request });\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":";;;;;;;AAkBA,IAAa,qBAAb,MAAgC;CAC9B,MAAa,YACX,MACA,QACA,SAC4B;EAC5B,IAAI,YAA+B,EAAE;EACrC,MAAM,cAAc,QAAQ,QAAQ;EACpC,MAAM,MAAM,eAAe,MAAM,cAAc,IAAI,cAAc,QAAW,EAAE,UAAU,SAAS,UAAU,CAAC;EAE5G,MAAM,QAAQ,MADG,MAAM,UAAU,KAAK,EAAE,GAAG,SAAS,SAAS,CAAC,CACjC;EAC7B,MAAM,SAAS,MAAM,iBAAiB,6CAA6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vB,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"}
1
+ {"version":3,"file":"user-ratings.service.mjs","names":[],"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 { CSFDOptions } from '../types';\nimport { userRatingsUrl } from '../vars';\n\nexport class UserRatingsScraper {\n public async userRatings(\n user: string | number,\n config?: CSFDUserRatingConfig,\n options?: CSFDOptions\n ): Promise<CSFDUserRatings[]> {\n let allMovies: CSFDUserRatings[] = [];\n const pageToFetch = config?.page || 1;\n const url = userRatingsUrl(user, pageToFetch > 1 ? pageToFetch : undefined, {\n language: options?.language\n });\n const response = await fetchPage(url, { ...options?.request });\n const items = parse(response);\n const movies = items.querySelectorAll('#snippet--ratings table 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, { language: options?.language });\n const response = await fetchPage(url, { ...options?.request });\n\n const items = parse(response);\n const movies = items.querySelectorAll('#snippet--ratings table 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":";;;;;;;AAkBA,IAAa,qBAAb,MAAgC;CAC9B,MAAa,YACX,MACA,QACA,SAC4B;EAC5B,IAAI,YAA+B,EAAE;EACrC,MAAM,cAAc,QAAQ,QAAQ;EACpC,MAAM,MAAM,eAAe,MAAM,cAAc,IAAI,cAAc,QAAW,EAC1E,UAAU,SAAS,UACpB,CAAC;EAEF,MAAM,QAAQ,MADG,MAAM,UAAU,KAAK,EAAE,GAAG,SAAS,SAAS,CAAC,CACjC;EAC7B,MAAM,SAAS,MAAM,iBAAiB,6BAA6B;EAGnE,MAAM,YAAY,MAAM,cAAc,cAAc;EACpD,MAAM,QAAQ,CAAC,WAAW,WAAW,UAAU,WAAW,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K,iBAAiB,GAAG;GACzB,aAAa,yBAAyB,GAAG;GACzC,UAAU,kBAAkB,GAAG;GAC/B,YAAY,cAAc,GAAG;GAC9B"}
@@ -11,7 +11,7 @@ var UserReviewsScraper = class {
11
11
  const pageToFetch = config?.page || 1;
12
12
  const url = require_vars.userReviewsUrl(user, pageToFetch > 1 ? pageToFetch : void 0, { language: options?.language });
13
13
  const items = (0, node_html_parser.parse)(await require_index.fetchPage(url, { ...options?.request }));
14
- const reviews = items.querySelectorAll(".user-reviews .article");
14
+ const reviews = items.querySelectorAll(".user-tab-reviews .article");
15
15
  const pagesNode = items.querySelector(".pagination");
16
16
  const pages = +pagesNode?.childNodes[pagesNode.childNodes.length - 4].rawText || 1;
17
17
  allReviews = this.getPage(config, reviews);
@@ -20,8 +20,8 @@ var UserReviewsScraper = class {
20
20
  console.log("Fetching all pages", pages);
21
21
  for (let i = 2; i <= pages; i++) {
22
22
  console.log("Fetching page", i, "out of", pages, "...");
23
- const reviews$1 = (0, node_html_parser.parse)(await require_index.fetchPage(require_vars.userReviewsUrl(user, i, { language: options?.language }), { ...options?.request })).querySelectorAll(".user-reviews .article");
24
- allReviews = [...allReviews, ...this.getPage(config, reviews$1)];
23
+ const reviews = (0, node_html_parser.parse)(await require_index.fetchPage(require_vars.userReviewsUrl(user, i, { language: options?.language }), { ...options?.request })).querySelectorAll(".user-tab-reviews .article");
24
+ allReviews = [...allReviews, ...this.getPage(config, reviews)];
25
25
  if (config.allPagesDelay) await require_global_helper.sleep(config.allPagesDelay);
26
26
  }
27
27
  return allReviews;
@@ -1 +1 @@
1
- {"version":3,"file":"user-reviews.service.js","names":["userReviewsUrl","fetchPage","reviews","sleep","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 { CSFDOptions } from '../types';\nimport { userReviewsUrl } from '../vars';\n\nexport class UserReviewsScraper {\n public async userReviews(\n user: string | number,\n config?: CSFDUserReviewsConfig,\n options?: CSFDOptions\n ): Promise<CSFDUserReviews[]> {\n let allReviews: CSFDUserReviews[] = [];\n const pageToFetch = config?.page || 1;\n const url = userReviewsUrl(user, pageToFetch > 1 ? pageToFetch : undefined, { language: options?.language });\n const response = await fetchPage(url, { ...options?.request });\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, { language: options?.language });\n const response = await fetchPage(url, { ...options?.request });\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":";;;;;;;AAoBA,IAAa,qBAAb,MAAgC;CAC9B,MAAa,YACX,MACA,QACA,SAC4B;EAC5B,IAAI,aAAgC,EAAE;EACtC,MAAM,cAAc,QAAQ,QAAQ;EACpC,MAAM,MAAMA,4BAAe,MAAM,cAAc,IAAI,cAAc,QAAW,EAAE,UAAU,SAAS,UAAU,CAAC;EAE5G,MAAM,oCADW,MAAMC,wBAAU,KAAK,EAAE,GAAG,SAAS,SAAS,CAAC,CACjC;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,U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","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 { CSFDOptions } from '../types';\nimport { userReviewsUrl } from '../vars';\n\nexport class UserReviewsScraper {\n public async userReviews(\n user: string | number,\n config?: CSFDUserReviewsConfig,\n options?: CSFDOptions\n ): Promise<CSFDUserReviews[]> {\n let allReviews: CSFDUserReviews[] = [];\n const pageToFetch = config?.page || 1;\n const url = userReviewsUrl(user, pageToFetch > 1 ? pageToFetch : undefined, {\n language: options?.language\n });\n const response = await fetchPage(url, { ...options?.request });\n const items = parse(response);\n const reviews = items.querySelectorAll('.user-tab-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, { language: options?.language });\n const response = await fetchPage(url, { ...options?.request });\n\n const items = parse(response);\n const reviews = items.querySelectorAll('.user-tab-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":";;;;;;;AAoBA,IAAa,qBAAb,MAAgC;CAC9B,MAAa,YACX,MACA,QACA,SAC4B;EAC5B,IAAI,aAAgC,EAAE;EACtC,MAAM,cAAc,QAAQ,QAAQ;EACpC,MAAM,MAAMA,4BAAe,MAAM,cAAc,IAAI,cAAc,QAAW,EAC1E,UAAU,SAAS,UACpB,CAAC;EAEF,MAAM,oCADW,MAAMC,wBAAU,KAAK,EAAE,GAAG,SAAS,SAAS,CAAC,CACjC;EAC7B,MAAM,UAAU,MAAM,iBAAiB,6BAA6B;EAGpE,MAAM,YAAY,MAAM,cAAc,cAAc;EACpD,MAAM,QAAQ,CAAC,WAAW,WAAW,UAAU,WAAW,SAAS,GAAG,WAAW;AAEjF,eAAa,KAAK,QAAQ,Q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yB,GAAG;GACzC,UAAUC,8CAAkB,GAAG;GAC/B,YAAYC,gDAAoB,GAAG;GACnC,MAAMC,8CAAkB,GAAG;GAC3B,QAAQC,gDAAoB,GAAG;GAChC"}
@@ -11,7 +11,7 @@ var UserReviewsScraper = class {
11
11
  const pageToFetch = config?.page || 1;
12
12
  const url = userReviewsUrl(user, pageToFetch > 1 ? pageToFetch : void 0, { language: options?.language });
13
13
  const items = parse(await fetchPage(url, { ...options?.request }));
14
- const reviews = items.querySelectorAll(".user-reviews .article");
14
+ const reviews = items.querySelectorAll(".user-tab-reviews .article");
15
15
  const pagesNode = items.querySelector(".pagination");
16
16
  const pages = +pagesNode?.childNodes[pagesNode.childNodes.length - 4].rawText || 1;
17
17
  allReviews = this.getPage(config, reviews);
@@ -20,8 +20,8 @@ var UserReviewsScraper = class {
20
20
  console.log("Fetching all pages", pages);
21
21
  for (let i = 2; i <= pages; i++) {
22
22
  console.log("Fetching page", i, "out of", pages, "...");
23
- const reviews$1 = parse(await fetchPage(userReviewsUrl(user, i, { language: options?.language }), { ...options?.request })).querySelectorAll(".user-reviews .article");
24
- allReviews = [...allReviews, ...this.getPage(config, reviews$1)];
23
+ const reviews = parse(await fetchPage(userReviewsUrl(user, i, { language: options?.language }), { ...options?.request })).querySelectorAll(".user-tab-reviews .article");
24
+ allReviews = [...allReviews, ...this.getPage(config, reviews)];
25
25
  if (config.allPagesDelay) await sleep(config.allPagesDelay);
26
26
  }
27
27
  return allReviews;
@@ -1 +1 @@
1
- {"version":3,"file":"user-reviews.service.mjs","names":["reviews"],"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 { CSFDOptions } from '../types';\nimport { userReviewsUrl } from '../vars';\n\nexport class UserReviewsScraper {\n public async userReviews(\n user: string | number,\n config?: CSFDUserReviewsConfig,\n options?: CSFDOptions\n ): Promise<CSFDUserReviews[]> {\n let allReviews: CSFDUserReviews[] = [];\n const pageToFetch = config?.page || 1;\n const url = userReviewsUrl(user, pageToFetch > 1 ? pageToFetch : undefined, { language: options?.language });\n const response = await fetchPage(url, { ...options?.request });\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, { language: options?.language });\n const response = await fetchPage(url, { ...options?.request });\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":";;;;;;;AAoBA,IAAa,qBAAb,MAAgC;CAC9B,MAAa,YACX,MACA,QACA,SAC4B;EAC5B,IAAI,aAAgC,EAAE;EACtC,MAAM,cAAc,QAAQ,QAAQ;EACpC,MAAM,MAAM,eAAe,MAAM,cAAc,IAAI,cAAc,QAAW,EAAE,UAAU,SAAS,UAAU,CAAC;EAE5G,MAAM,QAAQ,MADG,MAAM,UAAU,KAAK,EAAE,GAAG,SAAS,SAAS,CAAC,CACjC;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,MAAMA,YADQ,MAFG,MAAM,UADX,eAAe,MAAM,GAAG,EAAE,UAAU,SAAS,UAAU,CAAC,EAC9B,EAAE,GAAG,SAAS,SAAS,CAAC,CAEjC,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,MAAM,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"}
1
+ {"version":3,"file":"user-reviews.service.mjs","names":[],"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 { CSFDOptions } from '../types';\nimport { userReviewsUrl } from '../vars';\n\nexport class UserReviewsScraper {\n public async userReviews(\n user: string | number,\n config?: CSFDUserReviewsConfig,\n options?: CSFDOptions\n ): Promise<CSFDUserReviews[]> {\n let allReviews: CSFDUserReviews[] = [];\n const pageToFetch = config?.page || 1;\n const url = userReviewsUrl(user, pageToFetch > 1 ? pageToFetch : undefined, {\n language: options?.language\n });\n const response = await fetchPage(url, { ...options?.request });\n const items = parse(response);\n const reviews = items.querySelectorAll('.user-tab-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, { language: options?.language });\n const response = await fetchPage(url, { ...options?.request });\n\n const items = parse(response);\n const reviews = items.querySelectorAll('.user-tab-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":";;;;;;;AAoBA,IAAa,qBAAb,MAAgC;CAC9B,MAAa,YACX,MACA,QACA,SAC4B;EAC5B,IAAI,aAAgC,EAAE;EACtC,MAAM,cAAc,QAAQ,QAAQ;EACpC,MAAM,MAAM,eAAe,MAAM,cAAc,IAAI,cAAc,QAAW,EAC1E,UAAU,SAAS,UACpB,CAAC;EAEF,MAAM,QAAQ,MADG,MAAM,UAAU,KAAK,EAAE,GAAG,SAAS,SAAS,CAAC,CACjC;EAC7B,MAAM,UAAU,MAAM,iBAAiB,6BAA6B;EAGpE,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,MAAM,UADQ,MAFG,MAAM,UADX,eAAe,MAAM,GAAG,EAAE,UAAU,SAAS,UAAU,CAAC,EAC9B,EAAE,GAAG,SAAS,SAAS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