node-csfd-api 5.2.2 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fetchers/fetch.polyfill.js +1 -2
- package/fetchers/fetch.polyfill.js.map +1 -1
- package/fetchers/fetch.polyfill.mjs +1 -2
- package/fetchers/fetch.polyfill.mjs.map +1 -1
- package/fetchers/index.js +2 -3
- package/fetchers/index.js.map +1 -1
- package/fetchers/index.mjs +1 -2
- package/fetchers/index.mjs.map +1 -1
- package/helpers/cinema.helper.js +2 -3
- package/helpers/cinema.helper.js.map +1 -1
- package/helpers/cinema.helper.mjs +1 -2
- package/helpers/cinema.helper.mjs.map +1 -1
- package/helpers/creator.helper.js +2 -3
- package/helpers/creator.helper.js.map +1 -1
- package/helpers/creator.helper.mjs +1 -2
- package/helpers/creator.helper.mjs.map +1 -1
- package/helpers/global.helper.js +17 -18
- package/helpers/global.helper.js.map +1 -1
- package/helpers/global.helper.mjs +17 -17
- package/helpers/global.helper.mjs.map +1 -1
- package/helpers/movie.helper.js +5 -12
- package/helpers/movie.helper.js.map +1 -1
- package/helpers/movie.helper.mjs +4 -11
- package/helpers/movie.helper.mjs.map +1 -1
- package/helpers/search-creator.helper.js +2 -3
- package/helpers/search-creator.helper.js.map +1 -1
- package/helpers/search-creator.helper.mjs +1 -2
- package/helpers/search-creator.helper.mjs.map +1 -1
- package/helpers/search-user.helper.js +2 -3
- package/helpers/search-user.helper.js.map +1 -1
- package/helpers/search-user.helper.mjs +1 -2
- package/helpers/search-user.helper.mjs.map +1 -1
- package/helpers/search.helper.js +2 -3
- package/helpers/search.helper.js.map +1 -1
- package/helpers/search.helper.mjs +1 -2
- package/helpers/search.helper.mjs.map +1 -1
- package/helpers/user-ratings.helper.js +7 -7
- package/helpers/user-ratings.helper.js.map +1 -1
- package/helpers/user-ratings.helper.mjs +7 -7
- package/helpers/user-ratings.helper.mjs.map +1 -1
- package/helpers/user-reviews.helper.js +5 -6
- package/helpers/user-reviews.helper.js.map +1 -1
- package/helpers/user-reviews.helper.mjs +4 -5
- package/helpers/user-reviews.helper.mjs.map +1 -1
- package/index.js +9 -12
- package/index.js.map +1 -1
- package/index.mjs +2 -5
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/package.mjs +1 -1
- package/services/cinema.service.js +4 -5
- package/services/cinema.service.js.map +1 -1
- package/services/cinema.service.mjs +1 -2
- package/services/cinema.service.mjs.map +1 -1
- package/services/creator.service.js +4 -5
- package/services/creator.service.js.map +1 -1
- package/services/creator.service.mjs +1 -2
- package/services/creator.service.mjs.map +1 -1
- package/services/movie.service.js +6 -11
- package/services/movie.service.js.map +1 -1
- package/services/movie.service.mjs +3 -8
- package/services/movie.service.mjs.map +1 -1
- package/services/search.service.js +7 -8
- package/services/search.service.js.map +1 -1
- package/services/search.service.mjs +1 -2
- package/services/search.service.mjs.map +1 -1
- package/services/user-ratings.service.js +5 -6
- package/services/user-ratings.service.js.map +1 -1
- package/services/user-ratings.service.mjs +1 -2
- package/services/user-ratings.service.mjs.map +1 -1
- package/services/user-reviews.service.js +5 -6
- package/services/user-reviews.service.js.map +1 -1
- package/services/user-reviews.service.mjs +1 -2
- package/services/user-reviews.service.mjs.map +1 -1
- package/vars.js +1 -2
- package/vars.js.map +1 -1
- package/vars.mjs +1 -1
|
@@ -5,7 +5,6 @@ import { getCreatorImage, getCreatorName, getCreatorUrl } from "../helpers/searc
|
|
|
5
5
|
import { getAvatar, getUser, getUserRealName, getUserUrl } from "../helpers/search-user.helper.mjs";
|
|
6
6
|
import { getSearchColorRating, getSearchOrigins, getSearchPoster, getSearchTitle, getSearchType, getSearchUrl, getSearchYear, parseSearchPeople } from "../helpers/search.helper.mjs";
|
|
7
7
|
import { parse } from "node-html-parser";
|
|
8
|
-
|
|
9
8
|
//#region src/services/search.service.ts
|
|
10
9
|
var SearchScraper = class {
|
|
11
10
|
async search(text, options) {
|
|
@@ -70,7 +69,7 @@ var SearchScraper = class {
|
|
|
70
69
|
};
|
|
71
70
|
}
|
|
72
71
|
};
|
|
73
|
-
|
|
74
72
|
//#endregion
|
|
75
73
|
export { SearchScraper };
|
|
74
|
+
|
|
76
75
|
//# sourceMappingURL=search.service.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.service.mjs","names":[],"sources":["../../src/services/search.service.ts"],"sourcesContent":["import { HTMLElement, parse } from 'node-html-parser';\nimport { CSFDSearch, CSFDSearchCreator, CSFDSearchMovie, CSFDSearchUser } from '../dto/search';\nimport { fetchPage } from '../fetchers';\nimport { parseIdFromUrl } from '../helpers/global.helper';\nimport { getCreatorImage, getCreatorName, getCreatorUrl } from '../helpers/search-creator.helper';\nimport { getAvatar, getUser, getUserRealName, getUserUrl } from '../helpers/search-user.helper';\nimport {\n getSearchColorRating,\n getSearchOrigins,\n getSearchPoster,\n getSearchTitle,\n getSearchType,\n getSearchUrl,\n getSearchYear,\n parseSearchPeople\n} from '../helpers/search.helper';\nimport { CSFDLanguage, CSFDOptions } from '../types';\nimport { getUrlByLanguage, searchUrl } from '../vars';\n\nexport class SearchScraper {\n public async search(text: string, options?: CSFDOptions): Promise<CSFDSearch> {\n const url = searchUrl(text, { language: options?.language });\n const response = await fetchPage(url, { ...options?.request });\n\n const html = parse(response);\n const moviesNode = html.querySelectorAll('.main-movies article');\n const usersNode = html.querySelectorAll('.main-users article');\n const tvSeriesNode = html.querySelectorAll('.main-series article');\n const creatorsNode = html.querySelectorAll('.main-authors article');\n\n return this.parseSearch(moviesNode, usersNode, tvSeriesNode, creatorsNode, options?.language);\n }\n\n private parseSearch(\n moviesNode: HTMLElement[],\n usersNode: HTMLElement[],\n tvSeriesNode: HTMLElement[],\n creatorsNode: HTMLElement[],\n language?: CSFDLanguage\n ) {\n const baseUrl = getUrlByLanguage(language);\n\n const movies: CSFDSearchMovie[] = [];\n const users: CSFDSearchUser[] = [];\n const tvSeries: CSFDSearchMovie[] = [];\n const creators: CSFDSearchCreator[] = [];\n\n const movieMapper = (m: HTMLElement): CSFDSearchMovie => {\n const url = getSearchUrl(m);\n return {\n id: parseIdFromUrl(url),\n title: getSearchTitle(m),\n year: getSearchYear(m),\n url: `${baseUrl}${url}`,\n type: getSearchType(m),\n colorRating: getSearchColorRating(m),\n poster: getSearchPoster(m),\n origins: getSearchOrigins(m),\n creators: {\n directors: parseSearchPeople(m, 'directors'),\n actors: parseSearchPeople(m, 'actors')\n }\n };\n };\n\n const userMapper = (m: HTMLElement): CSFDSearchUser => {\n const url = getUserUrl(m);\n return {\n id: parseIdFromUrl(url),\n user: getUser(m),\n userRealName: getUserRealName(m),\n avatar: getAvatar(m),\n url: `${baseUrl}${url}`\n };\n };\n\n const creatorMapper = (m: HTMLElement): CSFDSearchCreator => {\n const url = getCreatorUrl(m);\n return {\n id: parseIdFromUrl(url),\n name: getCreatorName(m),\n image: getCreatorImage(m),\n url: `${baseUrl}${url}`\n };\n };\n\n movies.push(...moviesNode.map(movieMapper));\n users.push(...usersNode.map(userMapper));\n tvSeries.push(...tvSeriesNode.map(movieMapper));\n creators.push(...creatorsNode.map(creatorMapper));\n\n const search: CSFDSearch = {\n movies,\n users,\n tvSeries,\n creators\n };\n return search;\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"search.service.mjs","names":[],"sources":["../../src/services/search.service.ts"],"sourcesContent":["import { HTMLElement, parse } from 'node-html-parser';\nimport { CSFDSearch, CSFDSearchCreator, CSFDSearchMovie, CSFDSearchUser } from '../dto/search';\nimport { fetchPage } from '../fetchers';\nimport { parseIdFromUrl } from '../helpers/global.helper';\nimport { getCreatorImage, getCreatorName, getCreatorUrl } from '../helpers/search-creator.helper';\nimport { getAvatar, getUser, getUserRealName, getUserUrl } from '../helpers/search-user.helper';\nimport {\n getSearchColorRating,\n getSearchOrigins,\n getSearchPoster,\n getSearchTitle,\n getSearchType,\n getSearchUrl,\n getSearchYear,\n parseSearchPeople\n} from '../helpers/search.helper';\nimport { CSFDLanguage, CSFDOptions } from '../types';\nimport { getUrlByLanguage, searchUrl } from '../vars';\n\nexport class SearchScraper {\n public async search(text: string, options?: CSFDOptions): Promise<CSFDSearch> {\n const url = searchUrl(text, { language: options?.language });\n const response = await fetchPage(url, { ...options?.request });\n\n const html = parse(response);\n const moviesNode = html.querySelectorAll('.main-movies article');\n const usersNode = html.querySelectorAll('.main-users article');\n const tvSeriesNode = html.querySelectorAll('.main-series article');\n const creatorsNode = html.querySelectorAll('.main-authors article');\n\n return this.parseSearch(moviesNode, usersNode, tvSeriesNode, creatorsNode, options?.language);\n }\n\n private parseSearch(\n moviesNode: HTMLElement[],\n usersNode: HTMLElement[],\n tvSeriesNode: HTMLElement[],\n creatorsNode: HTMLElement[],\n language?: CSFDLanguage\n ) {\n const baseUrl = getUrlByLanguage(language);\n\n const movies: CSFDSearchMovie[] = [];\n const users: CSFDSearchUser[] = [];\n const tvSeries: CSFDSearchMovie[] = [];\n const creators: CSFDSearchCreator[] = [];\n\n const movieMapper = (m: HTMLElement): CSFDSearchMovie => {\n const url = getSearchUrl(m);\n return {\n id: parseIdFromUrl(url),\n title: getSearchTitle(m),\n year: getSearchYear(m),\n url: `${baseUrl}${url}`,\n type: getSearchType(m),\n colorRating: getSearchColorRating(m),\n poster: getSearchPoster(m),\n origins: getSearchOrigins(m),\n creators: {\n directors: parseSearchPeople(m, 'directors'),\n actors: parseSearchPeople(m, 'actors')\n }\n };\n };\n\n const userMapper = (m: HTMLElement): CSFDSearchUser => {\n const url = getUserUrl(m);\n return {\n id: parseIdFromUrl(url),\n user: getUser(m),\n userRealName: getUserRealName(m),\n avatar: getAvatar(m),\n url: `${baseUrl}${url}`\n };\n };\n\n const creatorMapper = (m: HTMLElement): CSFDSearchCreator => {\n const url = getCreatorUrl(m);\n return {\n id: parseIdFromUrl(url),\n name: getCreatorName(m),\n image: getCreatorImage(m),\n url: `${baseUrl}${url}`\n };\n };\n\n movies.push(...moviesNode.map(movieMapper));\n users.push(...usersNode.map(userMapper));\n tvSeries.push(...tvSeriesNode.map(movieMapper));\n creators.push(...creatorsNode.map(creatorMapper));\n\n const search: CSFDSearch = {\n movies,\n users,\n tvSeries,\n creators\n };\n return search;\n }\n}\n"],"mappings":";;;;;;;;AAmBA,IAAa,gBAAb,MAA2B;CACzB,MAAa,OAAO,MAAc,SAA4C;EAI5E,MAAM,OAAO,MAFI,MAAM,UADX,UAAU,MAAM,EAAE,UAAU,SAAS,UAAU,CAAC,EACtB,EAAE,GAAG,SAAS,SAAS,CAAC,CAElC;EAC5B,MAAM,aAAa,KAAK,iBAAiB,uBAAuB;EAChE,MAAM,YAAY,KAAK,iBAAiB,sBAAsB;EAC9D,MAAM,eAAe,KAAK,iBAAiB,uBAAuB;EAClE,MAAM,eAAe,KAAK,iBAAiB,wBAAwB;AAEnE,SAAO,KAAK,YAAY,YAAY,WAAW,cAAc,cAAc,SAAS,SAAS;;CAG/F,YACE,YACA,WACA,cACA,cACA,UACA;EACA,MAAM,UAAU,iBAAiB,SAAS;EAE1C,MAAM,SAA4B,EAAE;EACpC,MAAM,QAA0B,EAAE;EAClC,MAAM,WAA8B,EAAE;EACtC,MAAM,WAAgC,EAAE;EAExC,MAAM,eAAe,MAAoC;GACvD,MAAM,MAAM,aAAa,EAAE;AAC3B,UAAO;IACL,IAAI,eAAe,IAAI;IACvB,OAAO,eAAe,EAAE;IACxB,MAAM,cAAc,EAAE;IACtB,KAAK,GAAG,UAAU;IAClB,MAAM,cAAc,EAAE;IACtB,aAAa,qBAAqB,EAAE;IACpC,QAAQ,gBAAgB,EAAE;IAC1B,SAAS,iBAAiB,EAAE;IAC5B,UAAU;KACR,WAAW,kBAAkB,GAAG,YAAY;KAC5C,QAAQ,kBAAkB,GAAG,SAAS;KACvC;IACF;;EAGH,MAAM,cAAc,MAAmC;GACrD,MAAM,MAAM,WAAW,EAAE;AACzB,UAAO;IACL,IAAI,eAAe,IAAI;IACvB,MAAM,QAAQ,EAAE;IAChB,cAAc,gBAAgB,EAAE;IAChC,QAAQ,UAAU,EAAE;IACpB,KAAK,GAAG,UAAU;IACnB;;EAGH,MAAM,iBAAiB,MAAsC;GAC3D,MAAM,MAAM,cAAc,EAAE;AAC5B,UAAO;IACL,IAAI,eAAe,IAAI;IACvB,MAAM,eAAe,EAAE;IACvB,OAAO,gBAAgB,EAAE;IACzB,KAAK,GAAG,UAAU;IACnB;;AAGH,SAAO,KAAK,GAAG,WAAW,IAAI,YAAY,CAAC;AAC3C,QAAM,KAAK,GAAG,UAAU,IAAI,WAAW,CAAC;AACxC,WAAS,KAAK,GAAG,aAAa,IAAI,YAAY,CAAC;AAC/C,WAAS,KAAK,GAAG,aAAa,IAAI,cAAc,CAAC;AAQjD,SAN2B;GACzB;GACA;GACA;GACA;GACD"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
const require_index = require(
|
|
2
|
-
const require_vars = require(
|
|
3
|
-
const require_global_helper = require(
|
|
4
|
-
const require_user_ratings_helper = require(
|
|
1
|
+
const require_index = require("../fetchers/index.js");
|
|
2
|
+
const require_vars = require("../vars.js");
|
|
3
|
+
const require_global_helper = require("../helpers/global.helper.js");
|
|
4
|
+
const require_user_ratings_helper = require("../helpers/user-ratings.helper.js");
|
|
5
5
|
let node_html_parser = require("node-html-parser");
|
|
6
|
-
|
|
7
6
|
//#region src/services/user-ratings.service.ts
|
|
8
7
|
var UserRatingsScraper = class {
|
|
9
8
|
async userRatings(user, config, options) {
|
|
@@ -60,7 +59,7 @@ var UserRatingsScraper = class {
|
|
|
60
59
|
};
|
|
61
60
|
}
|
|
62
61
|
};
|
|
63
|
-
|
|
64
62
|
//#endregion
|
|
65
63
|
exports.UserRatingsScraper = UserRatingsScraper;
|
|
64
|
+
|
|
66
65
|
//# sourceMappingURL=user-ratings.service.js.map
|
|
@@ -1 +1 @@
|
|
|
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, CSFDFilmTypes, 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 const includesSet = config?.includesOnly?.length ? new Set(config.includesOnly) : null;\n const excludesSet = config?.excludes?.length ? new Set(config.excludes) : null;\n\n for (const el of movies) {\n const type = getUserRatingType(el);\n\n // Filtering includesOnly\n if (includesSet) {\n if (includesSet.has(type)) {\n films.push(this.buildUserRatings(el, type));\n }\n // Filter excludes\n } else if (excludesSet) {\n if (!excludesSet.has(type)) {\n films.push(this.buildUserRatings(el, type));\n }\n } else {\n // Without filtering\n films.push(this.buildUserRatings(el, type));\n }\n }\n return films;\n }\n\n private buildUserRatings(el: HTMLElement, type: CSFDFilmTypes): CSFDUserRatings {\n return {\n id: getUserRatingId(el),\n title: getUserRatingTitle(el),\n year: getUserRatingYear(el),\n type,\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":"
|
|
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, CSFDFilmTypes, 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 const includesSet = config?.includesOnly?.length ? new Set(config.includesOnly) : null;\n const excludesSet = config?.excludes?.length ? new Set(config.excludes) : null;\n\n for (const el of movies) {\n const type = getUserRatingType(el);\n\n // Filtering includesOnly\n if (includesSet) {\n if (includesSet.has(type)) {\n films.push(this.buildUserRatings(el, type));\n }\n // Filter excludes\n } else if (excludesSet) {\n if (!excludesSet.has(type)) {\n films.push(this.buildUserRatings(el, type));\n }\n } else {\n // Without filtering\n films.push(this.buildUserRatings(el, type));\n }\n }\n return films;\n }\n\n private buildUserRatings(el: HTMLElement, type: CSFDFilmTypes): CSFDUserRatings {\n return {\n id: getUserRatingId(el),\n title: getUserRatingTitle(el),\n year: getUserRatingYear(el),\n type,\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,aAAAA,eAAe,MAAM,cAAc,IAAI,cAAc,KAAA,GAAW,EAC1E,UAAU,SAAS,UACpB,CAAC;EAEF,MAAM,SAAA,GAAA,iBAAA,OADW,MAAMC,cAAAA,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,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,UAAA,GAAA,iBAAA,OAHW,MAAMA,cAAAA,UADXD,aAAAA,eAAe,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,sBAAAA,MAAM,OAAO,cAAc;;AAGrC,UAAO;;AAGT,SAAO;;CAGT,QAAgB,QAA8B,QAAuB;EACnE,MAAM,QAA2B,EAAE;AACnC,MAAI;OACE,OAAO,cAAc,UAAU,OAAO,UAAU,OAClD,SAAQ,KACN;;qDAGA,OAAO,aACR;;EAIL,MAAM,cAAc,QAAQ,cAAc,SAAS,IAAI,IAAI,OAAO,aAAa,GAAG;EAClF,MAAM,cAAc,QAAQ,UAAU,SAAS,IAAI,IAAI,OAAO,SAAS,GAAG;AAE1E,OAAK,MAAM,MAAM,QAAQ;GACvB,MAAM,OAAOC,4BAAAA,kBAAkB,GAAG;AAGlC,OAAI;QACE,YAAY,IAAI,KAAK,CACvB,OAAM,KAAK,KAAK,iBAAiB,IAAI,KAAK,CAAC;cAGpC;QACL,CAAC,YAAY,IAAI,KAAK,CACxB,OAAM,KAAK,KAAK,iBAAiB,IAAI,KAAK,CAAC;SAI7C,OAAM,KAAK,KAAK,iBAAiB,IAAI,KAAK,CAAC;;AAG/C,SAAO;;CAGT,iBAAyB,IAAiB,MAAsC;AAC9E,SAAO;GACL,IAAIC,4BAAAA,gBAAgB,GAAG;GACvB,OAAOC,4BAAAA,mBAAmB,GAAG;GAC7B,MAAMC,4BAAAA,kBAAkB,GAAG;GAC3B;GACA,KAAKC,4BAAAA,iBAAiB,GAAG;GACzB,aAAaC,4BAAAA,yBAAyB,GAAG;GACzC,UAAUC,4BAAAA,kBAAkB,GAAG;GAC/B,YAAYC,4BAAAA,cAAc,GAAG;GAC9B"}
|
|
@@ -3,7 +3,6 @@ import { userRatingsUrl } from "../vars.mjs";
|
|
|
3
3
|
import { sleep } from "../helpers/global.helper.mjs";
|
|
4
4
|
import { getUserRating, getUserRatingColorRating, getUserRatingDate, getUserRatingId, getUserRatingTitle, getUserRatingType, getUserRatingUrl, getUserRatingYear } from "../helpers/user-ratings.helper.mjs";
|
|
5
5
|
import { parse } from "node-html-parser";
|
|
6
|
-
|
|
7
6
|
//#region src/services/user-ratings.service.ts
|
|
8
7
|
var UserRatingsScraper = class {
|
|
9
8
|
async userRatings(user, config, options) {
|
|
@@ -60,7 +59,7 @@ var UserRatingsScraper = class {
|
|
|
60
59
|
};
|
|
61
60
|
}
|
|
62
61
|
};
|
|
63
|
-
|
|
64
62
|
//#endregion
|
|
65
63
|
export { UserRatingsScraper };
|
|
64
|
+
|
|
66
65
|
//# sourceMappingURL=user-ratings.service.mjs.map
|
|
@@ -1 +1 @@
|
|
|
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, CSFDFilmTypes, 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 const includesSet = config?.includesOnly?.length ? new Set(config.includesOnly) : null;\n const excludesSet = config?.excludes?.length ? new Set(config.excludes) : null;\n\n for (const el of movies) {\n const type = getUserRatingType(el);\n\n // Filtering includesOnly\n if (includesSet) {\n if (includesSet.has(type)) {\n films.push(this.buildUserRatings(el, type));\n }\n // Filter excludes\n } else if (excludesSet) {\n if (!excludesSet.has(type)) {\n films.push(this.buildUserRatings(el, type));\n }\n } else {\n // Without filtering\n films.push(this.buildUserRatings(el, type));\n }\n }\n return films;\n }\n\n private buildUserRatings(el: HTMLElement, type: CSFDFilmTypes): CSFDUserRatings {\n return {\n id: getUserRatingId(el),\n title: getUserRatingTitle(el),\n year: getUserRatingYear(el),\n type,\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":"
|
|
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, CSFDFilmTypes, 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 const includesSet = config?.includesOnly?.length ? new Set(config.includesOnly) : null;\n const excludesSet = config?.excludes?.length ? new Set(config.excludes) : null;\n\n for (const el of movies) {\n const type = getUserRatingType(el);\n\n // Filtering includesOnly\n if (includesSet) {\n if (includesSet.has(type)) {\n films.push(this.buildUserRatings(el, type));\n }\n // Filter excludes\n } else if (excludesSet) {\n if (!excludesSet.has(type)) {\n films.push(this.buildUserRatings(el, type));\n }\n } else {\n // Without filtering\n films.push(this.buildUserRatings(el, type));\n }\n }\n return films;\n }\n\n private buildUserRatings(el: HTMLElement, type: CSFDFilmTypes): CSFDUserRatings {\n return {\n id: getUserRatingId(el),\n title: getUserRatingTitle(el),\n year: getUserRatingYear(el),\n type,\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,KAAA,GAAW,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,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,SADQ,MAFG,MAAM,UADX,eAAe,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,OAAM,MAAM,OAAO,cAAc;;AAGrC,UAAO;;AAGT,SAAO;;CAGT,QAAgB,QAA8B,QAAuB;EACnE,MAAM,QAA2B,EAAE;AACnC,MAAI;OACE,OAAO,cAAc,UAAU,OAAO,UAAU,OAClD,SAAQ,KACN;;qDAGA,OAAO,aACR;;EAIL,MAAM,cAAc,QAAQ,cAAc,SAAS,IAAI,IAAI,OAAO,aAAa,GAAG;EAClF,MAAM,cAAc,QAAQ,UAAU,SAAS,IAAI,IAAI,OAAO,SAAS,GAAG;AAE1E,OAAK,MAAM,MAAM,QAAQ;GACvB,MAAM,OAAO,kBAAkB,GAAG;AAGlC,OAAI;QACE,YAAY,IAAI,KAAK,CACvB,OAAM,KAAK,KAAK,iBAAiB,IAAI,KAAK,CAAC;cAGpC;QACL,CAAC,YAAY,IAAI,KAAK,CACxB,OAAM,KAAK,KAAK,iBAAiB,IAAI,KAAK,CAAC;SAI7C,OAAM,KAAK,KAAK,iBAAiB,IAAI,KAAK,CAAC;;AAG/C,SAAO;;CAGT,iBAAyB,IAAiB,MAAsC;AAC9E,SAAO;GACL,IAAI,gBAAgB,GAAG;GACvB,OAAO,mBAAmB,GAAG;GAC7B,MAAM,kBAAkB,GAAG;GAC3B;GACA,KAAK,iBAAiB,GAAG;GACzB,aAAa,yBAAyB,GAAG;GACzC,UAAU,kBAAkB,GAAG;GAC/B,YAAY,cAAc,GAAG;GAC9B"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
const require_index = require(
|
|
2
|
-
const require_vars = require(
|
|
3
|
-
const require_global_helper = require(
|
|
4
|
-
const require_user_reviews_helper = require(
|
|
1
|
+
const require_index = require("../fetchers/index.js");
|
|
2
|
+
const require_vars = require("../vars.js");
|
|
3
|
+
const require_global_helper = require("../helpers/global.helper.js");
|
|
4
|
+
const require_user_reviews_helper = require("../helpers/user-reviews.helper.js");
|
|
5
5
|
let node_html_parser = require("node-html-parser");
|
|
6
|
-
|
|
7
6
|
//#region src/services/user-reviews.service.ts
|
|
8
7
|
var UserReviewsScraper = class {
|
|
9
8
|
async userReviews(user, config, options) {
|
|
@@ -62,7 +61,7 @@ var UserReviewsScraper = class {
|
|
|
62
61
|
};
|
|
63
62
|
}
|
|
64
63
|
};
|
|
65
|
-
|
|
66
64
|
//#endregion
|
|
67
65
|
exports.UserReviewsScraper = UserReviewsScraper;
|
|
66
|
+
|
|
68
67
|
//# sourceMappingURL=user-reviews.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-reviews.service.js","names":["userReviewsUrl","fetchPage","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, CSFDFilmTypes, 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 const includesSet = config?.includesOnly?.length ? new Set(config.includesOnly) : null;\n const excludesSet = config?.excludes?.length ? new Set(config.excludes) : null;\n\n for (const el of reviews) {\n const type = getUserReviewType(el);\n\n // Filtering includesOnly\n if (includesSet) {\n if (includesSet.has(type)) {\n films.push(this.buildUserReviews(el, type));\n }\n // Filter excludes\n } else if (excludesSet) {\n if (!excludesSet.has(type)) {\n films.push(this.buildUserReviews(el, type));\n }\n } else {\n // Without filtering\n films.push(this.buildUserReviews(el, type));\n }\n }\n return films;\n }\n\n private buildUserReviews(el: HTMLElement, type: CSFDFilmTypes): CSFDUserReviews {\n return {\n id: getUserReviewId(el),\n title: getUserReviewTitle(el),\n year: getUserReviewYear(el),\n type,\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":"
|
|
1
|
+
{"version":3,"file":"user-reviews.service.js","names":["userReviewsUrl","fetchPage","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, CSFDFilmTypes, 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 const includesSet = config?.includesOnly?.length ? new Set(config.includesOnly) : null;\n const excludesSet = config?.excludes?.length ? new Set(config.excludes) : null;\n\n for (const el of reviews) {\n const type = getUserReviewType(el);\n\n // Filtering includesOnly\n if (includesSet) {\n if (includesSet.has(type)) {\n films.push(this.buildUserReviews(el, type));\n }\n // Filter excludes\n } else if (excludesSet) {\n if (!excludesSet.has(type)) {\n films.push(this.buildUserReviews(el, type));\n }\n } else {\n // Without filtering\n films.push(this.buildUserReviews(el, type));\n }\n }\n return films;\n }\n\n private buildUserReviews(el: HTMLElement, type: CSFDFilmTypes): CSFDUserReviews {\n return {\n id: getUserReviewId(el),\n title: getUserReviewTitle(el),\n year: getUserReviewYear(el),\n type,\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,aAAAA,eAAe,MAAM,cAAc,IAAI,cAAc,KAAA,GAAW,EAC1E,UAAU,SAAS,UACpB,CAAC;EAEF,MAAM,SAAA,GAAA,iBAAA,OADW,MAAMC,cAAAA,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,WAAA,GAAA,iBAAA,OAHW,MAAMA,cAAAA,UADXD,aAAAA,eAAe,MAAM,GAAG,EAAE,UAAU,SAAS,UAAU,CAAC,EAC9B,EAAE,GAAG,SAAS,SAAS,CAAC,CAEjC,CACP,iBAAiB,6BAA6B;AACpE,iBAAa,CAAC,GAAG,YAAY,GAAG,KAAK,QAAQ,QAAQ,QAAQ,CAAC;AAG9D,QAAI,OAAO,cACT,OAAME,sBAAAA,MAAM,OAAO,cAAc;;AAGrC,UAAO;;AAGT,SAAO;;CAGT,QAAgB,QAA+B,SAAwB;EACrE,MAAM,QAA2B,EAAE;AACnC,MAAI;OACE,OAAO,cAAc,UAAU,OAAO,UAAU,OAClD,SAAQ,KACN;;qDAGA,OAAO,aACR;;EAIL,MAAM,cAAc,QAAQ,cAAc,SAAS,IAAI,IAAI,OAAO,aAAa,GAAG;EAClF,MAAM,cAAc,QAAQ,UAAU,SAAS,IAAI,IAAI,OAAO,SAAS,GAAG;AAE1E,OAAK,MAAM,MAAM,SAAS;GACxB,MAAM,OAAOC,4BAAAA,kBAAkB,GAAG;AAGlC,OAAI;QACE,YAAY,IAAI,KAAK,CACvB,OAAM,KAAK,KAAK,iBAAiB,IAAI,KAAK,CAAC;cAGpC;QACL,CAAC,YAAY,IAAI,KAAK,CACxB,OAAM,KAAK,KAAK,iBAAiB,IAAI,KAAK,CAAC;SAI7C,OAAM,KAAK,KAAK,iBAAiB,IAAI,KAAK,CAAC;;AAG/C,SAAO;;CAGT,iBAAyB,IAAiB,MAAsC;AAC9E,SAAO;GACL,IAAIC,4BAAAA,gBAAgB,GAAG;GACvB,OAAOC,4BAAAA,mBAAmB,GAAG;GAC7B,MAAMC,4BAAAA,kBAAkB,GAAG;GAC3B;GACA,KAAKC,4BAAAA,iBAAiB,GAAG;GACzB,aAAaC,4BAAAA,yBAAyB,GAAG;GACzC,UAAUC,4BAAAA,kBAAkB,GAAG;GAC/B,YAAYC,4BAAAA,oBAAoB,GAAG;GACnC,MAAMC,4BAAAA,kBAAkB,GAAG;GAC3B,QAAQC,4BAAAA,oBAAoB,GAAG;GAChC"}
|
|
@@ -3,7 +3,6 @@ import { userReviewsUrl } from "../vars.mjs";
|
|
|
3
3
|
import { sleep } from "../helpers/global.helper.mjs";
|
|
4
4
|
import { getUserReviewColorRating, getUserReviewDate, getUserReviewId, getUserReviewPoster, getUserReviewRating, getUserReviewText, getUserReviewTitle, getUserReviewType, getUserReviewUrl, getUserReviewYear } from "../helpers/user-reviews.helper.mjs";
|
|
5
5
|
import { parse } from "node-html-parser";
|
|
6
|
-
|
|
7
6
|
//#region src/services/user-reviews.service.ts
|
|
8
7
|
var UserReviewsScraper = class {
|
|
9
8
|
async userReviews(user, config, options) {
|
|
@@ -62,7 +61,7 @@ var UserReviewsScraper = class {
|
|
|
62
61
|
};
|
|
63
62
|
}
|
|
64
63
|
};
|
|
65
|
-
|
|
66
64
|
//#endregion
|
|
67
65
|
export { UserReviewsScraper };
|
|
66
|
+
|
|
68
67
|
//# sourceMappingURL=user-reviews.service.mjs.map
|
|
@@ -1 +1 @@
|
|
|
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, CSFDFilmTypes, 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 const includesSet = config?.includesOnly?.length ? new Set(config.includesOnly) : null;\n const excludesSet = config?.excludes?.length ? new Set(config.excludes) : null;\n\n for (const el of reviews) {\n const type = getUserReviewType(el);\n\n // Filtering includesOnly\n if (includesSet) {\n if (includesSet.has(type)) {\n films.push(this.buildUserReviews(el, type));\n }\n // Filter excludes\n } else if (excludesSet) {\n if (!excludesSet.has(type)) {\n films.push(this.buildUserReviews(el, type));\n }\n } else {\n // Without filtering\n films.push(this.buildUserReviews(el, type));\n }\n }\n return films;\n }\n\n private buildUserReviews(el: HTMLElement, type: CSFDFilmTypes): CSFDUserReviews {\n return {\n id: getUserReviewId(el),\n title: getUserReviewTitle(el),\n year: getUserReviewYear(el),\n type,\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":"
|
|
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, CSFDFilmTypes, 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 const includesSet = config?.includesOnly?.length ? new Set(config.includesOnly) : null;\n const excludesSet = config?.excludes?.length ? new Set(config.excludes) : null;\n\n for (const el of reviews) {\n const type = getUserReviewType(el);\n\n // Filtering includesOnly\n if (includesSet) {\n if (includesSet.has(type)) {\n films.push(this.buildUserReviews(el, type));\n }\n // Filter excludes\n } else if (excludesSet) {\n if (!excludesSet.has(type)) {\n films.push(this.buildUserReviews(el, type));\n }\n } else {\n // Without filtering\n films.push(this.buildUserReviews(el, type));\n }\n }\n return films;\n }\n\n private buildUserReviews(el: HTMLElement, type: CSFDFilmTypes): CSFDUserReviews {\n return {\n id: getUserReviewId(el),\n title: getUserReviewTitle(el),\n year: getUserReviewYear(el),\n type,\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,KAAA,GAAW,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,CAAC,CAEjC,CACP,iBAAiB,6BAA6B;AACpE,iBAAa,CAAC,GAAG,YAAY,GAAG,KAAK,QAAQ,QAAQ,QAAQ,CAAC;AAG9D,QAAI,OAAO,cACT,OAAM,MAAM,OAAO,cAAc;;AAGrC,UAAO;;AAGT,SAAO;;CAGT,QAAgB,QAA+B,SAAwB;EACrE,MAAM,QAA2B,EAAE;AACnC,MAAI;OACE,OAAO,cAAc,UAAU,OAAO,UAAU,OAClD,SAAQ,KACN;;qDAGA,OAAO,aACR;;EAIL,MAAM,cAAc,QAAQ,cAAc,SAAS,IAAI,IAAI,OAAO,aAAa,GAAG;EAClF,MAAM,cAAc,QAAQ,UAAU,SAAS,IAAI,IAAI,OAAO,SAAS,GAAG;AAE1E,OAAK,MAAM,MAAM,SAAS;GACxB,MAAM,OAAO,kBAAkB,GAAG;AAGlC,OAAI;QACE,YAAY,IAAI,KAAK,CACvB,OAAM,KAAK,KAAK,iBAAiB,IAAI,KAAK,CAAC;cAGpC;QACL,CAAC,YAAY,IAAI,KAAK,CACxB,OAAM,KAAK,KAAK,iBAAiB,IAAI,KAAK,CAAC;SAI7C,OAAM,KAAK,KAAK,iBAAiB,IAAI,KAAK,CAAC;;AAG/C,SAAO;;CAGT,iBAAyB,IAAiB,MAAsC;AAC9E,SAAO;GACL,IAAI,gBAAgB,GAAG;GACvB,OAAO,mBAAmB,GAAG;GAC7B,MAAM,kBAAkB,GAAG;GAC3B;GACA,KAAK,iBAAiB,GAAG;GACzB,aAAa,yBAAyB,GAAG;GACzC,UAAU,kBAAkB,GAAG;GAC/B,YAAY,oBAAoB,GAAG;GACnC,MAAM,kBAAkB,GAAG;GAC3B,QAAQ,oBAAoB,GAAG;GAChC"}
|
package/vars.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
//#region src/vars.ts
|
|
3
2
|
const LANGUAGE_DOMAIN_MAP = {
|
|
4
3
|
cs: "https://www.csfd.cz",
|
|
@@ -17,7 +16,6 @@ const movieUrl = (movie, options) => `${getUrlByLanguage(options?.language)}/fil
|
|
|
17
16
|
const creatorUrl = (creator, options) => `${getUrlByLanguage(options?.language)}/tvurce/${encodeURIComponent(creator)}`;
|
|
18
17
|
const cinemasUrl = (district, period, options) => `${getUrlByLanguage(options?.language)}/kino/?period=${period}&district=${district}`;
|
|
19
18
|
const searchUrl = (text, options) => `${getUrlByLanguage(options?.language)}/hledat/?q=${encodeURIComponent(text)}`;
|
|
20
|
-
|
|
21
19
|
//#endregion
|
|
22
20
|
exports.cinemasUrl = cinemasUrl;
|
|
23
21
|
exports.creatorUrl = creatorUrl;
|
|
@@ -26,4 +24,5 @@ exports.movieUrl = movieUrl;
|
|
|
26
24
|
exports.searchUrl = searchUrl;
|
|
27
25
|
exports.userRatingsUrl = userRatingsUrl;
|
|
28
26
|
exports.userReviewsUrl = userReviewsUrl;
|
|
27
|
+
|
|
29
28
|
//# sourceMappingURL=vars.js.map
|
package/vars.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vars.js","names":[],"sources":["../src/vars.ts"],"sourcesContent":["import { CSFDCinemaPeriod } from './dto/cinema';\nimport { CSFDLanguage } from './types';\n\ntype Options = {\n language?: CSFDLanguage;\n};\n\n// Language to domain mapping\nconst LANGUAGE_DOMAIN_MAP: Record<CSFDLanguage, string> = {\n cs: 'https://www.csfd.cz',\n en: 'https://www.csfd.cz/en',\n sk: 'https://www.csfd.cz/sk',\n};\n\nlet BASE_URL = LANGUAGE_DOMAIN_MAP.cs;\n\nexport const getBaseUrl = (): string => BASE_URL;\nexport const setBaseUrl = (language: CSFDLanguage): void => {\n BASE_URL = getUrlByLanguage(language);\n};\n\nexport const getUrlByLanguage = (language?: CSFDLanguage): string => {\n if (language && language in LANGUAGE_DOMAIN_MAP) {\n return LANGUAGE_DOMAIN_MAP[language];\n }\n return BASE_URL;\n};\n\n// User URLs\nexport const userUrl = (user: string | number, options: Options): string =>\n `${getUrlByLanguage(options?.language)}/uzivatel/${encodeURIComponent(user)}`;\n\nexport const userRatingsUrl = (user: string | number, page?: number, options: Options = {}): string =>\n `${userUrl(user, options)}/hodnoceni/${page ? '?page=' + page : ''}`;\nexport const userReviewsUrl = (user: string | number, page?: number, options: Options = {}): string =>\n `${userUrl(user, options)}/recenze/${page ? '?page=' + page : ''}`;\n\n// Movie URLs\nexport const movieUrl = (movie: number, options: Options): string =>\n `${getUrlByLanguage(options?.language)}/film/${encodeURIComponent(movie)}/prehled/`;\n// Creator URLs\nexport const creatorUrl = (creator: number | string, options: Options): string =>\n `${getUrlByLanguage(options?.language)}/tvurce/${encodeURIComponent(creator)}`;\n\n// Cinema URLs\nexport const cinemasUrl = (district: number | string, period: CSFDCinemaPeriod, options: Options): string =>\n `${getUrlByLanguage(options?.language)}/kino/?period=${period}&district=${district}`;\n\n// Search URLs\nexport const searchUrl = (text: string, options: Options): string =>\n `${getUrlByLanguage(options?.language)}/hledat/?q=${encodeURIComponent(text)}`;"],"mappings":"
|
|
1
|
+
{"version":3,"file":"vars.js","names":[],"sources":["../src/vars.ts"],"sourcesContent":["import { CSFDCinemaPeriod } from './dto/cinema';\nimport { CSFDLanguage } from './types';\n\ntype Options = {\n language?: CSFDLanguage;\n};\n\n// Language to domain mapping\nconst LANGUAGE_DOMAIN_MAP: Record<CSFDLanguage, string> = {\n cs: 'https://www.csfd.cz',\n en: 'https://www.csfd.cz/en',\n sk: 'https://www.csfd.cz/sk',\n};\n\nlet BASE_URL = LANGUAGE_DOMAIN_MAP.cs;\n\nexport const getBaseUrl = (): string => BASE_URL;\nexport const setBaseUrl = (language: CSFDLanguage): void => {\n BASE_URL = getUrlByLanguage(language);\n};\n\nexport const getUrlByLanguage = (language?: CSFDLanguage): string => {\n if (language && language in LANGUAGE_DOMAIN_MAP) {\n return LANGUAGE_DOMAIN_MAP[language];\n }\n return BASE_URL;\n};\n\n// User URLs\nexport const userUrl = (user: string | number, options: Options): string =>\n `${getUrlByLanguage(options?.language)}/uzivatel/${encodeURIComponent(user)}`;\n\nexport const userRatingsUrl = (user: string | number, page?: number, options: Options = {}): string =>\n `${userUrl(user, options)}/hodnoceni/${page ? '?page=' + page : ''}`;\nexport const userReviewsUrl = (user: string | number, page?: number, options: Options = {}): string =>\n `${userUrl(user, options)}/recenze/${page ? '?page=' + page : ''}`;\n\n// Movie URLs\nexport const movieUrl = (movie: number, options: Options): string =>\n `${getUrlByLanguage(options?.language)}/film/${encodeURIComponent(movie)}/prehled/`;\n// Creator URLs\nexport const creatorUrl = (creator: number | string, options: Options): string =>\n `${getUrlByLanguage(options?.language)}/tvurce/${encodeURIComponent(creator)}`;\n\n// Cinema URLs\nexport const cinemasUrl = (district: number | string, period: CSFDCinemaPeriod, options: Options): string =>\n `${getUrlByLanguage(options?.language)}/kino/?period=${period}&district=${district}`;\n\n// Search URLs\nexport const searchUrl = (text: string, options: Options): string =>\n `${getUrlByLanguage(options?.language)}/hledat/?q=${encodeURIComponent(text)}`;"],"mappings":";AAQA,MAAM,sBAAoD;CACxD,IAAI;CACJ,IAAI;CACJ,IAAI;CACL;AAED,IAAI,WAAW,oBAAoB;AAOnC,MAAa,oBAAoB,aAAoC;AACnE,KAAI,YAAY,YAAY,oBAC1B,QAAO,oBAAoB;AAE7B,QAAO;;AAIT,MAAa,WAAW,MAAuB,YAC7C,GAAG,iBAAiB,SAAS,SAAS,CAAC,YAAY,mBAAmB,KAAK;AAE7E,MAAa,kBAAkB,MAAuB,MAAe,UAAmB,EAAE,KACxF,GAAG,QAAQ,MAAM,QAAQ,CAAC,aAAa,OAAO,WAAW,OAAO;AAClE,MAAa,kBAAkB,MAAuB,MAAe,UAAmB,EAAE,KACxF,GAAG,QAAQ,MAAM,QAAQ,CAAC,WAAW,OAAO,WAAW,OAAO;AAGhE,MAAa,YAAY,OAAe,YACtC,GAAG,iBAAiB,SAAS,SAAS,CAAC,QAAQ,mBAAmB,MAAM,CAAC;AAE3E,MAAa,cAAc,SAA0B,YACnD,GAAG,iBAAiB,SAAS,SAAS,CAAC,UAAU,mBAAmB,QAAQ;AAG9E,MAAa,cAAc,UAA2B,QAA0B,YAC9E,GAAG,iBAAiB,SAAS,SAAS,CAAC,gBAAgB,OAAO,YAAY;AAG5E,MAAa,aAAa,MAAc,YACtC,GAAG,iBAAiB,SAAS,SAAS,CAAC,aAAa,mBAAmB,KAAK"}
|
package/vars.mjs
CHANGED
|
@@ -16,7 +16,7 @@ const movieUrl = (movie, options) => `${getUrlByLanguage(options?.language)}/fil
|
|
|
16
16
|
const creatorUrl = (creator, options) => `${getUrlByLanguage(options?.language)}/tvurce/${encodeURIComponent(creator)}`;
|
|
17
17
|
const cinemasUrl = (district, period, options) => `${getUrlByLanguage(options?.language)}/kino/?period=${period}&district=${district}`;
|
|
18
18
|
const searchUrl = (text, options) => `${getUrlByLanguage(options?.language)}/hledat/?q=${encodeURIComponent(text)}`;
|
|
19
|
-
|
|
20
19
|
//#endregion
|
|
21
20
|
export { cinemasUrl, creatorUrl, getUrlByLanguage, movieUrl, searchUrl, userRatingsUrl, userReviewsUrl };
|
|
21
|
+
|
|
22
22
|
//# sourceMappingURL=vars.mjs.map
|