node-csfd-api 3.3.0 → 4.0.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +317 -209
- package/dto/movie.d.mts +4 -2
- package/dto/movie.d.ts +4 -2
- package/dto/options.d.mts +9 -0
- package/dto/options.d.ts +9 -0
- package/dto/user-ratings.d.mts +2 -2
- package/dto/user-ratings.d.ts +2 -2
- package/fetchers/fetch.polyfill.js +0 -2
- package/fetchers/fetch.polyfill.js.map +1 -1
- package/fetchers/index.js +1 -1
- package/fetchers/index.js.map +1 -1
- package/fetchers/index.mjs +1 -1
- package/fetchers/index.mjs.map +1 -1
- package/helpers/cinema.helper.js.map +1 -1
- package/helpers/cinema.helper.mjs.map +1 -1
- package/helpers/creator.helper.js.map +1 -1
- package/helpers/creator.helper.mjs.map +1 -1
- package/helpers/global.helper.js.map +1 -1
- package/helpers/global.helper.mjs.map +1 -1
- package/helpers/movie.helper.js +57 -0
- package/helpers/movie.helper.js.map +1 -1
- package/helpers/movie.helper.mjs +57 -1
- package/helpers/movie.helper.mjs.map +1 -1
- package/helpers/search-user.helper.js +0 -2
- package/helpers/search-user.helper.js.map +1 -1
- package/helpers/search.helper.js.map +1 -1
- package/helpers/search.helper.mjs.map +1 -1
- package/helpers/user-ratings.helper.js.map +1 -1
- package/helpers/user-ratings.helper.mjs.map +1 -1
- package/helpers/user-reviews.helper.js.map +1 -1
- package/helpers/user-reviews.helper.mjs.map +1 -1
- package/index.d.mts +15 -15
- package/index.d.ts +15 -15
- package/index.js +23 -16
- package/index.js.map +1 -1
- package/index.mjs +23 -16
- package/index.mjs.map +1 -1
- package/package.json +3 -3
- package/services/cinema.service.d.mts +2 -1
- package/services/cinema.service.d.ts +2 -1
- package/services/cinema.service.js +2 -4
- package/services/cinema.service.js.map +1 -1
- package/services/cinema.service.mjs +2 -2
- package/services/cinema.service.mjs.map +1 -1
- package/services/creator.service.d.mts +2 -1
- package/services/creator.service.d.ts +2 -1
- package/services/creator.service.js +2 -4
- package/services/creator.service.js.map +1 -1
- package/services/creator.service.mjs +2 -2
- package/services/creator.service.mjs.map +1 -1
- package/services/movie.service.d.mts +2 -1
- package/services/movie.service.d.ts +2 -1
- package/services/movie.service.js +15 -17
- package/services/movie.service.js.map +1 -1
- package/services/movie.service.mjs +16 -16
- package/services/movie.service.mjs.map +1 -1
- package/services/search.service.d.mts +2 -1
- package/services/search.service.d.ts +2 -1
- package/services/search.service.js +8 -9
- package/services/search.service.js.map +1 -1
- package/services/search.service.mjs +9 -8
- package/services/search.service.mjs.map +1 -1
- package/services/user-ratings.service.d.mts +2 -1
- package/services/user-ratings.service.d.ts +2 -1
- package/services/user-ratings.service.js +4 -6
- package/services/user-ratings.service.js.map +1 -1
- package/services/user-ratings.service.mjs +4 -4
- package/services/user-ratings.service.mjs.map +1 -1
- package/services/user-reviews.service.d.mts +2 -1
- package/services/user-reviews.service.d.ts +2 -1
- package/services/user-reviews.service.js +4 -6
- package/services/user-reviews.service.js.map +1 -1
- package/services/user-reviews.service.mjs +4 -4
- package/services/user-reviews.service.mjs.map +1 -1
- package/vars.js +17 -7
- package/vars.js.map +1 -1
- package/vars.mjs +17 -8
- package/vars.mjs.map +1 -1
- package/_virtual/rolldown_runtime.js +0 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-user.helper.js","names":["NodeType","addProtocol"],"sources":["../../src/helpers/search-user.helper.ts"],"sourcesContent":["import { HTMLElement, NodeType } from 'node-html-parser';\nimport { addProtocol } from './global.helper';\n\nexport const getUser = (el: HTMLElement): string => {\n return el.querySelector('.user-title-name').text;\n};\n\nexport const getUserRealName = (el: HTMLElement): string => {\n const p = el.querySelector('.article-content p');\n if (!p) return null;\n\n const textNodes = p.childNodes.filter(n => n.nodeType === NodeType.TEXT_NODE && n.rawText.trim() !== '');\n const name = textNodes.length ? textNodes[0].rawText.trim() : null;\n\n return name;\n};\n\nexport const getAvatar = (el: HTMLElement): string => {\n const image = el.querySelector('.article-img img').attributes.src;\n return addProtocol(image);\n};\n\nexport const getUserUrl = (el: HTMLElement): string => {\n return el.querySelector('.user-title-name').attributes.href;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"search-user.helper.js","names":["NodeType","addProtocol"],"sources":["../../src/helpers/search-user.helper.ts"],"sourcesContent":["import { HTMLElement, NodeType } from 'node-html-parser';\nimport { addProtocol } from './global.helper';\n\nexport const getUser = (el: HTMLElement): string => {\n return el.querySelector('.user-title-name').text;\n};\n\nexport const getUserRealName = (el: HTMLElement): string => {\n const p = el.querySelector('.article-content p');\n if (!p) return null;\n\n const textNodes = p.childNodes.filter(n => n.nodeType === NodeType.TEXT_NODE && n.rawText.trim() !== '');\n const name = textNodes.length ? textNodes[0].rawText.trim() : null;\n\n return name;\n};\n\nexport const getAvatar = (el: HTMLElement): string => {\n const image = el.querySelector('.article-img img').attributes.src;\n return addProtocol(image);\n};\n\nexport const getUserUrl = (el: HTMLElement): string => {\n return el.querySelector('.user-title-name').attributes.href;\n};\n"],"mappings":";;;;AAGA,MAAa,WAAW,OAA4B;AAClD,QAAO,GAAG,cAAc,mBAAmB,CAAC;;AAG9C,MAAa,mBAAmB,OAA4B;CAC1D,MAAM,IAAI,GAAG,cAAc,qBAAqB;AAChD,KAAI,CAAC,EAAG,QAAO;CAEf,MAAM,YAAY,EAAE,WAAW,QAAO,MAAK,EAAE,aAAaA,0BAAS,aAAa,EAAE,QAAQ,MAAM,KAAK,GAAG;AAGxG,QAFa,UAAU,SAAS,UAAU,GAAG,QAAQ,MAAM,GAAG;;AAKhE,MAAa,aAAa,OAA4B;CACpD,MAAM,QAAQ,GAAG,cAAc,mBAAmB,CAAC,WAAW;AAC9D,QAAOC,kCAAY,MAAM;;AAG3B,MAAa,cAAc,OAA4B;AACrD,QAAO,GAAG,cAAc,mBAAmB,CAAC,WAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.helper.js","names":["parseColor","addProtocol","who: Creator","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 {
|
|
1
|
+
{"version":3,"file":"search.helper.js","names":["parseColor","addProtocol","who: Creator","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,IAAIC;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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.helper.mjs","names":["who: Creator","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 {
|
|
1
|
+
{"version":3,"file":"search.helper.mjs","names":["who: Creator","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,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,QAAO,WACL,GAAG,cAAc,yBAAyB,CAAC,WAAW,MAAM,IAAI,CAAC,KAAK,CACvE;;AAGH,MAAa,mBAAmB,OAA4B;CAC1D,MAAM,QAAQ,GAAG,cAAc,MAAM,CAAC,WAAW;AACjD,QAAO,YAAY,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,IAAIA;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,IAAI,eAAe,OAAO,WAAW,KAAK;GAC1C,MAAM,OAAO,UAAU,MAAM;GAC7B,KAAK,sBAAsB,OAAO,WAAW;GAC9C;GACD;KAEF,QAAO,EAAE"}
|
|
@@ -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 {
|
|
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 +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 {
|
|
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 +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 {
|
|
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 +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 {
|
|
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,aAAa,GAAG,cAAc,sBAAsB,CAAC,WAAW,MAAM,IAAI,CAAC,KAAK;AAGtF,QADe,WAAW,SAAS,SAAS,GAAG,CAAC,WAAW,MAAM,IAAI,CAAC,KAAK,GAAG;;AAIhF,MAAa,qBAAqB,OAAmC;CAEnE,MAAM,WAAW,GAAG,iBAAiB,yBAAyB;AAE9D,QAAQ,SAAS,SAAS,IAAI,SAAS,GAAG,KAAK,MAAM,GAAG,GAAG,GAAG;;AAGhE,MAAa,sBAAsB,OAA4B;AAC7D,QAAO,GAAG,cAAc,mBAAmB,CAAC;;AAG9C,MAAa,qBAAqB,OAA4B;CAC5D,MAAM,WAAW,GAAG,cAAc,yBAAyB;AAC3D,QAAO,WAAW,CAAC,SAAS,KAAK,QAAQ,SAAS,GAAG,GAAG;;AAG1D,MAAa,4BAA4B,OAAqC;AAG5E,QADc,WADD,GAAG,cAAc,+BAA+B,EAC9B,WAAW,MAAM,IAAI,CAAC,KAAK,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"}
|
package/index.d.mts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { CSFDColorRating, CSFDFilmTypes, CSFDScreening, CSFDStars } from "./dto/global.mjs";
|
|
2
|
-
import { CSFDBoxContent, CSFDCreatorGroups, CSFDCreators, CSFDGenres, CSFDMovie, CSFDMovieCreator, CSFDMovieListItem, CSFDPremiere, CSFDTitlesOther, CSFDVod, CSFDVodService } from "./dto/movie.mjs";
|
|
2
|
+
import { CSFDBoxContent, CSFDCreatorGroups, CSFDCreatorGroupsEnglish, CSFDCreatorGroupsSlovak, CSFDCreators, CSFDGenres, CSFDMovie, CSFDMovieCreator, CSFDMovieListItem, CSFDPremiere, CSFDTitlesOther, CSFDVod, CSFDVodService } from "./dto/movie.mjs";
|
|
3
3
|
import { CSFDCinema, CSFDCinemaGroupedFilmsByDate, CSFDCinemaMeta, CSFDCinemaMovie, CSFDCinemaPeriod } from "./dto/cinema.mjs";
|
|
4
4
|
import { CSFDCreator, CSFDCreatorScreening } from "./dto/creator.mjs";
|
|
5
5
|
import { CSFDSearch, CSFDSearchCreator, CSFDSearchCreators, CSFDSearchMovie, CSFDSearchUser } from "./dto/search.mjs";
|
|
6
|
-
import { CSFDUserRatingConfig, CSFDUserRatings
|
|
6
|
+
import { CSFDColors, CSFDUserRatingConfig, CSFDUserRatings } from "./dto/user-ratings.mjs";
|
|
7
7
|
import { CSFDUserReviews, CSFDUserReviewsConfig } from "./dto/user-reviews.mjs";
|
|
8
|
+
import { CSFDOptions } from "./dto/options.mjs";
|
|
8
9
|
import { CinemaScraper } from "./services/cinema.service.mjs";
|
|
9
10
|
import { CreatorScraper } from "./services/creator.service.mjs";
|
|
10
11
|
import { MovieScraper } from "./services/movie.service.mjs";
|
|
@@ -20,21 +21,20 @@ declare class Csfd {
|
|
|
20
21
|
private creatorService;
|
|
21
22
|
private searchService;
|
|
22
23
|
private cinemaService;
|
|
23
|
-
private
|
|
24
|
-
constructor(userRatingsService: UserRatingsScraper, userReviewsService: UserReviewsScraper, movieService: MovieScraper, creatorService: CreatorScraper, searchService: SearchScraper, cinemaService: CinemaScraper,
|
|
24
|
+
private defaultOptions?;
|
|
25
|
+
constructor(userRatingsService: UserRatingsScraper, userReviewsService: UserReviewsScraper, movieService: MovieScraper, creatorService: CreatorScraper, searchService: SearchScraper, cinemaService: CinemaScraper, defaultOptions?: CSFDOptions);
|
|
25
26
|
setOptions({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
cinema(district: number | string, period: CSFDCinemaPeriod, optionsRequest?: RequestInit): Promise<CSFDCinema[]>;
|
|
27
|
+
request,
|
|
28
|
+
language
|
|
29
|
+
}: CSFDOptions): void;
|
|
30
|
+
userRatings(user: string | number, config?: CSFDUserRatingConfig, options?: CSFDOptions): Promise<CSFDUserRatings[]>;
|
|
31
|
+
userReviews(user: string | number, config?: CSFDUserReviewsConfig, options?: CSFDOptions): Promise<CSFDUserReviews[]>;
|
|
32
|
+
movie(movie: number, options?: CSFDOptions): Promise<CSFDMovie>;
|
|
33
|
+
creator(creator: number, options?: CSFDOptions): Promise<CSFDCreator>;
|
|
34
|
+
search(text: string, options?: CSFDOptions): Promise<CSFDSearch>;
|
|
35
|
+
cinema(district: number | string, period: CSFDCinemaPeriod, options?: CSFDOptions): Promise<CSFDCinema[]>;
|
|
36
36
|
}
|
|
37
37
|
declare const csfd: Csfd;
|
|
38
38
|
//#endregion
|
|
39
|
-
export { CSFDBoxContent, CSFDCinema, CSFDCinemaGroupedFilmsByDate, CSFDCinemaMeta, CSFDCinemaMovie, CSFDCinemaPeriod, CSFDColorRating, CSFDCreator, CSFDCreatorGroups, CSFDCreatorScreening, CSFDCreators, CSFDFilmTypes, CSFDGenres, CSFDMovie, CSFDMovieCreator, CSFDMovieListItem, CSFDPremiere, CSFDScreening, CSFDSearch, CSFDSearchCreator, CSFDSearchCreators, CSFDSearchMovie, CSFDSearchUser, CSFDStars, CSFDTitlesOther, CSFDUserRatingConfig, CSFDUserRatings, CSFDVod, CSFDVodService,
|
|
39
|
+
export { CSFDBoxContent, CSFDCinema, CSFDCinemaGroupedFilmsByDate, CSFDCinemaMeta, CSFDCinemaMovie, CSFDCinemaPeriod, CSFDColorRating, CSFDColors, CSFDCreator, CSFDCreatorGroups, CSFDCreatorGroupsEnglish, CSFDCreatorGroupsSlovak, CSFDCreatorScreening, CSFDCreators, CSFDFilmTypes, CSFDGenres, CSFDMovie, CSFDMovieCreator, CSFDMovieListItem, CSFDPremiere, CSFDScreening, CSFDSearch, CSFDSearchCreator, CSFDSearchCreators, CSFDSearchMovie, CSFDSearchUser, CSFDStars, CSFDTitlesOther, CSFDUserRatingConfig, CSFDUserRatings, CSFDVod, CSFDVodService, Csfd, csfd };
|
|
40
40
|
//# sourceMappingURL=index.d.mts.map
|
package/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { CSFDColorRating, CSFDFilmTypes, CSFDScreening, CSFDStars } from "./dto/global.js";
|
|
2
|
-
import { CSFDBoxContent, CSFDCreatorGroups, CSFDCreators, CSFDGenres, CSFDMovie, CSFDMovieCreator, CSFDMovieListItem, CSFDPremiere, CSFDTitlesOther, CSFDVod, CSFDVodService } from "./dto/movie.js";
|
|
2
|
+
import { CSFDBoxContent, CSFDCreatorGroups, CSFDCreatorGroupsEnglish, CSFDCreatorGroupsSlovak, CSFDCreators, CSFDGenres, CSFDMovie, CSFDMovieCreator, CSFDMovieListItem, CSFDPremiere, CSFDTitlesOther, CSFDVod, CSFDVodService } from "./dto/movie.js";
|
|
3
3
|
import { CSFDCinema, CSFDCinemaGroupedFilmsByDate, CSFDCinemaMeta, CSFDCinemaMovie, CSFDCinemaPeriod } from "./dto/cinema.js";
|
|
4
4
|
import { CSFDCreator, CSFDCreatorScreening } from "./dto/creator.js";
|
|
5
5
|
import { CSFDSearch, CSFDSearchCreator, CSFDSearchCreators, CSFDSearchMovie, CSFDSearchUser } from "./dto/search.js";
|
|
6
|
-
import { CSFDUserRatingConfig, CSFDUserRatings
|
|
6
|
+
import { CSFDColors, CSFDUserRatingConfig, CSFDUserRatings } from "./dto/user-ratings.js";
|
|
7
7
|
import { CSFDUserReviews, CSFDUserReviewsConfig } from "./dto/user-reviews.js";
|
|
8
|
+
import { CSFDOptions } from "./dto/options.js";
|
|
8
9
|
import { CinemaScraper } from "./services/cinema.service.js";
|
|
9
10
|
import { CreatorScraper } from "./services/creator.service.js";
|
|
10
11
|
import { MovieScraper } from "./services/movie.service.js";
|
|
@@ -20,21 +21,20 @@ declare class Csfd {
|
|
|
20
21
|
private creatorService;
|
|
21
22
|
private searchService;
|
|
22
23
|
private cinemaService;
|
|
23
|
-
private
|
|
24
|
-
constructor(userRatingsService: UserRatingsScraper, userReviewsService: UserReviewsScraper, movieService: MovieScraper, creatorService: CreatorScraper, searchService: SearchScraper, cinemaService: CinemaScraper,
|
|
24
|
+
private defaultOptions?;
|
|
25
|
+
constructor(userRatingsService: UserRatingsScraper, userReviewsService: UserReviewsScraper, movieService: MovieScraper, creatorService: CreatorScraper, searchService: SearchScraper, cinemaService: CinemaScraper, defaultOptions?: CSFDOptions);
|
|
25
26
|
setOptions({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
cinema(district: number | string, period: CSFDCinemaPeriod, optionsRequest?: RequestInit): Promise<CSFDCinema[]>;
|
|
27
|
+
request,
|
|
28
|
+
language
|
|
29
|
+
}: CSFDOptions): void;
|
|
30
|
+
userRatings(user: string | number, config?: CSFDUserRatingConfig, options?: CSFDOptions): Promise<CSFDUserRatings[]>;
|
|
31
|
+
userReviews(user: string | number, config?: CSFDUserReviewsConfig, options?: CSFDOptions): Promise<CSFDUserReviews[]>;
|
|
32
|
+
movie(movie: number, options?: CSFDOptions): Promise<CSFDMovie>;
|
|
33
|
+
creator(creator: number, options?: CSFDOptions): Promise<CSFDCreator>;
|
|
34
|
+
search(text: string, options?: CSFDOptions): Promise<CSFDSearch>;
|
|
35
|
+
cinema(district: number | string, period: CSFDCinemaPeriod, options?: CSFDOptions): Promise<CSFDCinema[]>;
|
|
36
36
|
}
|
|
37
37
|
declare const csfd: Csfd;
|
|
38
38
|
//#endregion
|
|
39
|
-
export { CSFDBoxContent, CSFDCinema, CSFDCinemaGroupedFilmsByDate, CSFDCinemaMeta, CSFDCinemaMovie, CSFDCinemaPeriod, CSFDColorRating, CSFDCreator, CSFDCreatorGroups, CSFDCreatorScreening, CSFDCreators, CSFDFilmTypes, CSFDGenres, CSFDMovie, CSFDMovieCreator, CSFDMovieListItem, CSFDPremiere, CSFDScreening, CSFDSearch, CSFDSearchCreator, CSFDSearchCreators, CSFDSearchMovie, CSFDSearchUser, CSFDStars, CSFDTitlesOther, CSFDUserRatingConfig, CSFDUserRatings, CSFDVod, CSFDVodService,
|
|
39
|
+
export { CSFDBoxContent, CSFDCinema, CSFDCinemaGroupedFilmsByDate, CSFDCinemaMeta, CSFDCinemaMovie, CSFDCinemaPeriod, CSFDColorRating, CSFDColors, CSFDCreator, CSFDCreatorGroups, CSFDCreatorGroupsEnglish, CSFDCreatorGroupsSlovak, CSFDCreatorScreening, CSFDCreators, CSFDFilmTypes, CSFDGenres, CSFDMovie, CSFDMovieCreator, CSFDMovieListItem, CSFDPremiere, CSFDScreening, CSFDSearch, CSFDSearchCreator, CSFDSearchCreators, CSFDSearchMovie, CSFDSearchUser, CSFDStars, CSFDTitlesOther, CSFDUserRatingConfig, CSFDUserRatings, CSFDVod, CSFDVodService, Csfd, csfd };
|
|
40
40
|
//# sourceMappingURL=index.d.ts.map
|
package/index.js
CHANGED
|
@@ -7,40 +7,47 @@ const require_user_reviews_service = require('./services/user-reviews.service.js
|
|
|
7
7
|
|
|
8
8
|
//#region src/index.ts
|
|
9
9
|
var Csfd = class {
|
|
10
|
-
constructor(userRatingsService, userReviewsService, movieService, creatorService, searchService, cinemaService,
|
|
10
|
+
constructor(userRatingsService, userReviewsService, movieService, creatorService, searchService, cinemaService, defaultOptions) {
|
|
11
11
|
this.userRatingsService = userRatingsService;
|
|
12
12
|
this.userReviewsService = userReviewsService;
|
|
13
13
|
this.movieService = movieService;
|
|
14
14
|
this.creatorService = creatorService;
|
|
15
15
|
this.searchService = searchService;
|
|
16
16
|
this.cinemaService = cinemaService;
|
|
17
|
-
this.
|
|
17
|
+
this.defaultOptions = defaultOptions;
|
|
18
18
|
}
|
|
19
|
-
setOptions({
|
|
20
|
-
this.
|
|
19
|
+
setOptions({ request, language }) {
|
|
20
|
+
if (request !== void 0) this.defaultOptions = {
|
|
21
|
+
...this.defaultOptions,
|
|
22
|
+
request
|
|
23
|
+
};
|
|
24
|
+
if (language !== void 0) this.defaultOptions = {
|
|
25
|
+
...this.defaultOptions,
|
|
26
|
+
language
|
|
27
|
+
};
|
|
21
28
|
}
|
|
22
|
-
async userRatings(user, config,
|
|
23
|
-
const opts =
|
|
29
|
+
async userRatings(user, config, options) {
|
|
30
|
+
const opts = options ?? this.defaultOptions;
|
|
24
31
|
return this.userRatingsService.userRatings(user, config, opts);
|
|
25
32
|
}
|
|
26
|
-
async userReviews(user, config,
|
|
27
|
-
const opts =
|
|
33
|
+
async userReviews(user, config, options) {
|
|
34
|
+
const opts = options ?? this.defaultOptions;
|
|
28
35
|
return this.userReviewsService.userReviews(user, config, opts);
|
|
29
36
|
}
|
|
30
|
-
async movie(movie,
|
|
31
|
-
const opts =
|
|
37
|
+
async movie(movie, options) {
|
|
38
|
+
const opts = options ?? this.defaultOptions;
|
|
32
39
|
return this.movieService.movie(+movie, opts);
|
|
33
40
|
}
|
|
34
|
-
async creator(creator,
|
|
35
|
-
const opts =
|
|
41
|
+
async creator(creator, options) {
|
|
42
|
+
const opts = options ?? this.defaultOptions;
|
|
36
43
|
return this.creatorService.creator(+creator, opts);
|
|
37
44
|
}
|
|
38
|
-
async search(text,
|
|
39
|
-
const opts =
|
|
45
|
+
async search(text, options) {
|
|
46
|
+
const opts = options ?? this.defaultOptions;
|
|
40
47
|
return this.searchService.search(text, opts);
|
|
41
48
|
}
|
|
42
|
-
async cinema(district, period,
|
|
43
|
-
const opts =
|
|
49
|
+
async cinema(district, period, options) {
|
|
50
|
+
const opts = options ?? this.defaultOptions;
|
|
44
51
|
return this.cinemaService.cinemas(+district, period, opts);
|
|
45
52
|
}
|
|
46
53
|
};
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["userRatingsService: UserRatingsScraper","userReviewsService: UserReviewsScraper","movieService: MovieScraper","creatorService: CreatorScraper","searchService: SearchScraper","cinemaService: CinemaScraper","MovieScraper","UserRatingsScraper","UserReviewsScraper","CinemaScraper","CreatorScraper","SearchScraper"],"sources":["../src/index.ts"],"sourcesContent":["import { CSFDCinema, CSFDCinemaPeriod } from './dto/cinema';\nimport { CSFDCreator } from './dto/creator';\nimport { CSFDMovie } from './dto/movie';\nimport { CSFDSearch } from './dto/search';\nimport { CSFDUserRatingConfig, CSFDUserRatings } from './dto/user-ratings';\nimport { CSFDUserReviews, CSFDUserReviewsConfig } from './dto/user-reviews';\nimport { CinemaScraper } from './services/cinema.service';\nimport { CreatorScraper } from './services/creator.service';\nimport { MovieScraper } from './services/movie.service';\nimport { SearchScraper } from './services/search.service';\nimport { UserRatingsScraper } from './services/user-ratings.service';\nimport { UserReviewsScraper } from './services/user-reviews.service';\n\nexport class Csfd {\n private
|
|
1
|
+
{"version":3,"file":"index.js","names":["userRatingsService: UserRatingsScraper","userReviewsService: UserReviewsScraper","movieService: MovieScraper","creatorService: CreatorScraper","searchService: SearchScraper","cinemaService: CinemaScraper","MovieScraper","UserRatingsScraper","UserReviewsScraper","CinemaScraper","CreatorScraper","SearchScraper"],"sources":["../src/index.ts"],"sourcesContent":["import { CSFDCinema, CSFDCinemaPeriod } from './dto/cinema';\nimport { CSFDCreator } from './dto/creator';\nimport { CSFDMovie } from './dto/movie';\nimport { CSFDSearch } from './dto/search';\nimport { CSFDUserRatingConfig, CSFDUserRatings } from './dto/user-ratings';\nimport { CSFDUserReviews, CSFDUserReviewsConfig } from './dto/user-reviews';\nimport { CinemaScraper } from './services/cinema.service';\nimport { CreatorScraper } from './services/creator.service';\nimport { MovieScraper } from './services/movie.service';\nimport { SearchScraper } from './services/search.service';\nimport { UserRatingsScraper } from './services/user-ratings.service';\nimport { UserReviewsScraper } from './services/user-reviews.service';\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,AAAQA,oBACR,AAAQC,oBACR,AAAQC,cACR,AAAQC,gBACR,AAAQC,eACR,AAAQC,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,IAAIC,oCAAc;AACvC,MAAM,qBAAqB,IAAIC,iDAAoB;AACnD,MAAM,qBAAqB,IAAIC,iDAAoB;AACnD,MAAM,gBAAgB,IAAIC,sCAAe;AACzC,MAAM,iBAAiB,IAAIC,wCAAgB;AAC3C,MAAM,gBAAgB,IAAIC,sCAAe;AAEzC,MAAa,OAAO,IAAI,KACtB,oBACA,oBACA,cACA,gBACA,eACA,cACD"}
|
package/index.mjs
CHANGED
|
@@ -7,40 +7,47 @@ import { UserReviewsScraper } from "./services/user-reviews.service.mjs";
|
|
|
7
7
|
|
|
8
8
|
//#region src/index.ts
|
|
9
9
|
var Csfd = class {
|
|
10
|
-
constructor(userRatingsService, userReviewsService, movieService, creatorService, searchService, cinemaService,
|
|
10
|
+
constructor(userRatingsService, userReviewsService, movieService, creatorService, searchService, cinemaService, defaultOptions) {
|
|
11
11
|
this.userRatingsService = userRatingsService;
|
|
12
12
|
this.userReviewsService = userReviewsService;
|
|
13
13
|
this.movieService = movieService;
|
|
14
14
|
this.creatorService = creatorService;
|
|
15
15
|
this.searchService = searchService;
|
|
16
16
|
this.cinemaService = cinemaService;
|
|
17
|
-
this.
|
|
17
|
+
this.defaultOptions = defaultOptions;
|
|
18
18
|
}
|
|
19
|
-
setOptions({
|
|
20
|
-
this.
|
|
19
|
+
setOptions({ request, language }) {
|
|
20
|
+
if (request !== void 0) this.defaultOptions = {
|
|
21
|
+
...this.defaultOptions,
|
|
22
|
+
request
|
|
23
|
+
};
|
|
24
|
+
if (language !== void 0) this.defaultOptions = {
|
|
25
|
+
...this.defaultOptions,
|
|
26
|
+
language
|
|
27
|
+
};
|
|
21
28
|
}
|
|
22
|
-
async userRatings(user, config,
|
|
23
|
-
const opts =
|
|
29
|
+
async userRatings(user, config, options) {
|
|
30
|
+
const opts = options ?? this.defaultOptions;
|
|
24
31
|
return this.userRatingsService.userRatings(user, config, opts);
|
|
25
32
|
}
|
|
26
|
-
async userReviews(user, config,
|
|
27
|
-
const opts =
|
|
33
|
+
async userReviews(user, config, options) {
|
|
34
|
+
const opts = options ?? this.defaultOptions;
|
|
28
35
|
return this.userReviewsService.userReviews(user, config, opts);
|
|
29
36
|
}
|
|
30
|
-
async movie(movie,
|
|
31
|
-
const opts =
|
|
37
|
+
async movie(movie, options) {
|
|
38
|
+
const opts = options ?? this.defaultOptions;
|
|
32
39
|
return this.movieService.movie(+movie, opts);
|
|
33
40
|
}
|
|
34
|
-
async creator(creator,
|
|
35
|
-
const opts =
|
|
41
|
+
async creator(creator, options) {
|
|
42
|
+
const opts = options ?? this.defaultOptions;
|
|
36
43
|
return this.creatorService.creator(+creator, opts);
|
|
37
44
|
}
|
|
38
|
-
async search(text,
|
|
39
|
-
const opts =
|
|
45
|
+
async search(text, options) {
|
|
46
|
+
const opts = options ?? this.defaultOptions;
|
|
40
47
|
return this.searchService.search(text, opts);
|
|
41
48
|
}
|
|
42
|
-
async cinema(district, period,
|
|
43
|
-
const opts =
|
|
49
|
+
async cinema(district, period, options) {
|
|
50
|
+
const opts = options ?? this.defaultOptions;
|
|
44
51
|
return this.cinemaService.cinemas(+district, period, opts);
|
|
45
52
|
}
|
|
46
53
|
};
|
package/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["userRatingsService: UserRatingsScraper","userReviewsService: UserReviewsScraper","movieService: MovieScraper","creatorService: CreatorScraper","searchService: SearchScraper","cinemaService: CinemaScraper"],"sources":["../src/index.ts"],"sourcesContent":["import { CSFDCinema, CSFDCinemaPeriod } from './dto/cinema';\nimport { CSFDCreator } from './dto/creator';\nimport { CSFDMovie } from './dto/movie';\nimport { CSFDSearch } from './dto/search';\nimport { CSFDUserRatingConfig, CSFDUserRatings } from './dto/user-ratings';\nimport { CSFDUserReviews, CSFDUserReviewsConfig } from './dto/user-reviews';\nimport { CinemaScraper } from './services/cinema.service';\nimport { CreatorScraper } from './services/creator.service';\nimport { MovieScraper } from './services/movie.service';\nimport { SearchScraper } from './services/search.service';\nimport { UserRatingsScraper } from './services/user-ratings.service';\nimport { UserReviewsScraper } from './services/user-reviews.service';\n\nexport class Csfd {\n private
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["userRatingsService: UserRatingsScraper","userReviewsService: UserReviewsScraper","movieService: MovieScraper","creatorService: CreatorScraper","searchService: SearchScraper","cinemaService: CinemaScraper"],"sources":["../src/index.ts"],"sourcesContent":["import { CSFDCinema, CSFDCinemaPeriod } from './dto/cinema';\nimport { CSFDCreator } from './dto/creator';\nimport { CSFDMovie } from './dto/movie';\nimport { CSFDSearch } from './dto/search';\nimport { CSFDUserRatingConfig, CSFDUserRatings } from './dto/user-ratings';\nimport { CSFDUserReviews, CSFDUserReviewsConfig } from './dto/user-reviews';\nimport { CinemaScraper } from './services/cinema.service';\nimport { CreatorScraper } from './services/creator.service';\nimport { MovieScraper } from './services/movie.service';\nimport { SearchScraper } from './services/search.service';\nimport { UserRatingsScraper } from './services/user-ratings.service';\nimport { UserReviewsScraper } from './services/user-reviews.service';\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,AAAQA,oBACR,AAAQC,oBACR,AAAQC,cACR,AAAQC,gBACR,AAAQC,eACR,AAAQC,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,IAAI,cAAc;AACvC,MAAM,qBAAqB,IAAI,oBAAoB;AACnD,MAAM,qBAAqB,IAAI,oBAAoB;AACnD,MAAM,gBAAgB,IAAI,eAAe;AACzC,MAAM,iBAAiB,IAAI,gBAAgB;AAC3C,MAAM,gBAAgB,IAAI,eAAe;AAEzC,MAAa,OAAO,IAAI,KACtB,oBACA,oBACA,cACA,gBACA,eACA,cACD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-csfd-api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-next.1",
|
|
4
4
|
"description": "ČSFD API in JavaScript. Amazing NPM library for scrapping csfd.cz :)",
|
|
5
5
|
"author": "BART! <bart@bartweb.cz>",
|
|
6
6
|
"publishConfig": {
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"types": "./index.d.ts",
|
|
42
42
|
"exports": {
|
|
43
43
|
".": {
|
|
44
|
-
"
|
|
45
|
-
"
|
|
44
|
+
"require": "./index.js",
|
|
45
|
+
"import": "./index.mjs"
|
|
46
46
|
},
|
|
47
47
|
"./package.json": "./package.json"
|
|
48
48
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { CSFDCinema, CSFDCinemaPeriod } from "../dto/cinema.mjs";
|
|
2
|
+
import { CSFDOptions } from "../dto/options.mjs";
|
|
2
3
|
|
|
3
4
|
//#region src/services/cinema.service.d.ts
|
|
4
5
|
declare class CinemaScraper {
|
|
5
|
-
cinemas(district?: number, period?: CSFDCinemaPeriod,
|
|
6
|
+
cinemas(district?: number, period?: CSFDCinemaPeriod, options?: CSFDOptions): Promise<CSFDCinema[]>;
|
|
6
7
|
private buildCinemas;
|
|
7
8
|
}
|
|
8
9
|
//#endregion
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { CSFDCinema, CSFDCinemaPeriod } from "../dto/cinema.js";
|
|
2
|
+
import { CSFDOptions } from "../dto/options.js";
|
|
2
3
|
|
|
3
4
|
//#region src/services/cinema.service.d.ts
|
|
4
5
|
declare class CinemaScraper {
|
|
5
|
-
cinemas(district?: number, period?: CSFDCinemaPeriod,
|
|
6
|
+
cinemas(district?: number, period?: CSFDCinemaPeriod, options?: CSFDOptions): Promise<CSFDCinema[]>;
|
|
6
7
|
private buildCinemas;
|
|
7
8
|
}
|
|
8
9
|
//#endregion
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
1
|
const require_index = require('../fetchers/index.js');
|
|
3
2
|
const require_vars = require('../vars.js');
|
|
4
3
|
const require_cinema_helper = require('../helpers/cinema.helper.js');
|
|
5
4
|
let node_html_parser = require("node-html-parser");
|
|
6
|
-
node_html_parser = require_rolldown_runtime.__toESM(node_html_parser);
|
|
7
5
|
|
|
8
6
|
//#region src/services/cinema.service.ts
|
|
9
7
|
var CinemaScraper = class {
|
|
10
|
-
async cinemas(district = 1, period = "today",
|
|
11
|
-
const contentNode = (0, node_html_parser.parse)(await require_index.fetchPage(require_vars.cinemasUrl(district, period), { ...
|
|
8
|
+
async cinemas(district = 1, period = "today", options) {
|
|
9
|
+
const contentNode = (0, node_html_parser.parse)(await require_index.fetchPage(require_vars.cinemasUrl(district, period, { language: options?.language }), { ...options?.request })).querySelectorAll("#snippet--cinemas section[id*=\"cinema-\"]");
|
|
12
10
|
return this.buildCinemas(contentNode);
|
|
13
11
|
}
|
|
14
12
|
buildCinemas(contentNode) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cinema.service.js","names":["fetchPage","cinemasUrl","cinemas: CSFDCinema[]","parseCinema","cinema: CSFDCinema","getCinemaId","getCinemaUrl","getCinemaCoords","getGroupedFilmsByDate"],"sources":["../../src/services/cinema.service.ts"],"sourcesContent":["import { HTMLElement, parse } from 'node-html-parser';\nimport { CSFDCinema, CSFDCinemaPeriod } from '../dto/cinema';\nimport { fetchPage } from '../fetchers';\nimport { cinemasUrl } from '../vars';\nimport {\n getCinemaCoords,\n getCinemaId,\n getCinemaUrl,\n getGroupedFilmsByDate,\n parseCinema\n} from './../helpers/cinema.helper';\n\nexport class CinemaScraper {\n public async cinemas(\n district: number = 1,\n period: CSFDCinemaPeriod = 'today',\n
|
|
1
|
+
{"version":3,"file":"cinema.service.js","names":["fetchPage","cinemasUrl","cinemas: CSFDCinema[]","parseCinema","cinema: CSFDCinema","getCinemaId","getCinemaUrl","getCinemaCoords","getGroupedFilmsByDate"],"sources":["../../src/services/cinema.service.ts"],"sourcesContent":["import { HTMLElement, parse } from 'node-html-parser';\nimport { CSFDCinema, CSFDCinemaPeriod } from '../dto/cinema';\nimport { fetchPage } from '../fetchers';\nimport { CSFDOptions } from '../types';\nimport { cinemasUrl } from '../vars';\nimport {\n getCinemaCoords,\n getCinemaId,\n getCinemaUrl,\n getGroupedFilmsByDate,\n parseCinema\n} from './../helpers/cinema.helper';\n\nexport class CinemaScraper {\n public async cinemas(\n district: number = 1,\n period: CSFDCinemaPeriod = 'today',\n options?: CSFDOptions\n ): Promise<CSFDCinema[]> {\n const url = cinemasUrl(district, period, { language: options?.language });\n const response = await fetchPage(url, { ...options?.request });\n const cinemasHtml = parse(response);\n\n const contentNode = cinemasHtml.querySelectorAll('#snippet--cinemas section[id*=\"cinema-\"]');\n\n return this.buildCinemas(contentNode);\n }\n\n private buildCinemas(contentNode: HTMLElement[]): CSFDCinema[] {\n const cinemas: CSFDCinema[] = [];\n\n contentNode.forEach((x) => {\n const cinemaInfo = parseCinema(x);\n const cinema: CSFDCinema = {\n id: getCinemaId(x),\n name: cinemaInfo?.name,\n city: cinemaInfo?.city,\n url: getCinemaUrl(x),\n coords: getCinemaCoords(x),\n screenings: getGroupedFilmsByDate(x)\n };\n cinemas.push(cinema);\n });\n\n return cinemas;\n }\n}\n"],"mappings":";;;;;;AAaA,IAAa,gBAAb,MAA2B;CACzB,MAAa,QACX,WAAmB,GACnB,SAA2B,SAC3B,SACuB;EAKvB,MAAM,0CAHW,MAAMA,wBADXC,wBAAW,UAAU,QAAQ,EAAE,UAAU,SAAS,UAAU,CAAC,EACnC,EAAE,GAAG,SAAS,SAAS,CAAC,CAC3B,CAEH,iBAAiB,6CAA2C;AAE5F,SAAO,KAAK,aAAa,YAAY;;CAGvC,AAAQ,aAAa,aAA0C;EAC7D,MAAMC,UAAwB,EAAE;AAEhC,cAAY,SAAS,MAAM;GACzB,MAAM,aAAaC,kCAAY,EAAE;GACjC,MAAMC,SAAqB;IACzB,IAAIC,kCAAY,EAAE;IAClB,MAAM,YAAY;IAClB,MAAM,YAAY;IAClB,KAAKC,mCAAa,EAAE;IACpB,QAAQC,sCAAgB,EAAE;IAC1B,YAAYC,4CAAsB,EAAE;IACrC;AACD,WAAQ,KAAK,OAAO;IACpB;AAEF,SAAO"}
|
|
@@ -5,8 +5,8 @@ import { parse } from "node-html-parser";
|
|
|
5
5
|
|
|
6
6
|
//#region src/services/cinema.service.ts
|
|
7
7
|
var CinemaScraper = class {
|
|
8
|
-
async cinemas(district = 1, period = "today",
|
|
9
|
-
const contentNode = parse(await fetchPage(cinemasUrl(district, period), { ...
|
|
8
|
+
async cinemas(district = 1, period = "today", options) {
|
|
9
|
+
const contentNode = parse(await fetchPage(cinemasUrl(district, period, { language: options?.language }), { ...options?.request })).querySelectorAll("#snippet--cinemas section[id*=\"cinema-\"]");
|
|
10
10
|
return this.buildCinemas(contentNode);
|
|
11
11
|
}
|
|
12
12
|
buildCinemas(contentNode) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cinema.service.mjs","names":["cinemas: CSFDCinema[]","cinema: CSFDCinema"],"sources":["../../src/services/cinema.service.ts"],"sourcesContent":["import { HTMLElement, parse } from 'node-html-parser';\nimport { CSFDCinema, CSFDCinemaPeriod } from '../dto/cinema';\nimport { fetchPage } from '../fetchers';\nimport { cinemasUrl } from '../vars';\nimport {\n getCinemaCoords,\n getCinemaId,\n getCinemaUrl,\n getGroupedFilmsByDate,\n parseCinema\n} from './../helpers/cinema.helper';\n\nexport class CinemaScraper {\n public async cinemas(\n district: number = 1,\n period: CSFDCinemaPeriod = 'today',\n
|
|
1
|
+
{"version":3,"file":"cinema.service.mjs","names":["cinemas: CSFDCinema[]","cinema: CSFDCinema"],"sources":["../../src/services/cinema.service.ts"],"sourcesContent":["import { HTMLElement, parse } from 'node-html-parser';\nimport { CSFDCinema, CSFDCinemaPeriod } from '../dto/cinema';\nimport { fetchPage } from '../fetchers';\nimport { CSFDOptions } from '../types';\nimport { cinemasUrl } from '../vars';\nimport {\n getCinemaCoords,\n getCinemaId,\n getCinemaUrl,\n getGroupedFilmsByDate,\n parseCinema\n} from './../helpers/cinema.helper';\n\nexport class CinemaScraper {\n public async cinemas(\n district: number = 1,\n period: CSFDCinemaPeriod = 'today',\n options?: CSFDOptions\n ): Promise<CSFDCinema[]> {\n const url = cinemasUrl(district, period, { language: options?.language });\n const response = await fetchPage(url, { ...options?.request });\n const cinemasHtml = parse(response);\n\n const contentNode = cinemasHtml.querySelectorAll('#snippet--cinemas section[id*=\"cinema-\"]');\n\n return this.buildCinemas(contentNode);\n }\n\n private buildCinemas(contentNode: HTMLElement[]): CSFDCinema[] {\n const cinemas: CSFDCinema[] = [];\n\n contentNode.forEach((x) => {\n const cinemaInfo = parseCinema(x);\n const cinema: CSFDCinema = {\n id: getCinemaId(x),\n name: cinemaInfo?.name,\n city: cinemaInfo?.city,\n url: getCinemaUrl(x),\n coords: getCinemaCoords(x),\n screenings: getGroupedFilmsByDate(x)\n };\n cinemas.push(cinema);\n });\n\n return cinemas;\n }\n}\n"],"mappings":";;;;;;AAaA,IAAa,gBAAb,MAA2B;CACzB,MAAa,QACX,WAAmB,GACnB,SAA2B,SAC3B,SACuB;EAKvB,MAAM,cAFc,MADH,MAAM,UADX,WAAW,UAAU,QAAQ,EAAE,UAAU,SAAS,UAAU,CAAC,EACnC,EAAE,GAAG,SAAS,SAAS,CAAC,CAC3B,CAEH,iBAAiB,6CAA2C;AAE5F,SAAO,KAAK,aAAa,YAAY;;CAGvC,AAAQ,aAAa,aAA0C;EAC7D,MAAMA,UAAwB,EAAE;AAEhC,cAAY,SAAS,MAAM;GACzB,MAAM,aAAa,YAAY,EAAE;GACjC,MAAMC,SAAqB;IACzB,IAAI,YAAY,EAAE;IAClB,MAAM,YAAY;IAClB,MAAM,YAAY;IAClB,KAAK,aAAa,EAAE;IACpB,QAAQ,gBAAgB,EAAE;IAC1B,YAAY,sBAAsB,EAAE;IACrC;AACD,WAAQ,KAAK,OAAO;IACpB;AAEF,SAAO"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { CSFDCreator } from "../dto/creator.mjs";
|
|
2
|
+
import { CSFDOptions } from "../dto/options.mjs";
|
|
2
3
|
|
|
3
4
|
//#region src/services/creator.service.d.ts
|
|
4
5
|
declare class CreatorScraper {
|
|
5
|
-
creator(creatorId: number,
|
|
6
|
+
creator(creatorId: number, options?: CSFDOptions): Promise<CSFDCreator>;
|
|
6
7
|
private buildCreator;
|
|
7
8
|
}
|
|
8
9
|
//#endregion
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { CSFDCreator } from "../dto/creator.js";
|
|
2
|
+
import { CSFDOptions } from "../dto/options.js";
|
|
2
3
|
|
|
3
4
|
//#region src/services/creator.service.d.ts
|
|
4
5
|
declare class CreatorScraper {
|
|
5
|
-
creator(creatorId: number,
|
|
6
|
+
creator(creatorId: number, options?: CSFDOptions): Promise<CSFDCreator>;
|
|
6
7
|
private buildCreator;
|
|
7
8
|
}
|
|
8
9
|
//#endregion
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
1
|
const require_index = require('../fetchers/index.js');
|
|
3
2
|
const require_vars = require('../vars.js');
|
|
4
3
|
const require_creator_helper = require('../helpers/creator.helper.js');
|
|
5
4
|
let node_html_parser = require("node-html-parser");
|
|
6
|
-
node_html_parser = require_rolldown_runtime.__toESM(node_html_parser);
|
|
7
5
|
|
|
8
6
|
//#region src/services/creator.service.ts
|
|
9
7
|
var CreatorScraper = class {
|
|
10
|
-
async creator(creatorId,
|
|
8
|
+
async creator(creatorId, options) {
|
|
11
9
|
const id = Number(creatorId);
|
|
12
10
|
if (isNaN(id)) throw new Error("node-csfd-api: creatorId must be a valid number");
|
|
13
|
-
const creatorHtml = (0, node_html_parser.parse)(await require_index.fetchPage(require_vars.creatorUrl(id), { ...
|
|
11
|
+
const creatorHtml = (0, node_html_parser.parse)(await require_index.fetchPage(require_vars.creatorUrl(id, { language: options?.language }), { ...options?.request }));
|
|
14
12
|
const asideNode = creatorHtml.querySelector(".creator-about");
|
|
15
13
|
const filmsNode = creatorHtml.querySelector(".creator-filmography");
|
|
16
14
|
return this.buildCreator(+creatorId, asideNode, filmsNode);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"creator.service.js","names":["fetchPage","creatorUrl","getCreatorName","getCreatorBirthdayInfo","getCreatorPhoto","getCreatorBio","getCreatorFilms"],"sources":["../../src/services/creator.service.ts"],"sourcesContent":["import { HTMLElement, parse } from 'node-html-parser';\nimport { CSFDCreator } from '../dto/creator';\nimport { fetchPage } from '../fetchers';\nimport {\n getCreatorBio,\n getCreatorBirthdayInfo,\n getCreatorFilms,\n getCreatorName,\n getCreatorPhoto\n} from '../helpers/creator.helper';\nimport { creatorUrl } from '../vars';\n\nexport class CreatorScraper {\n public async creator(creatorId: number,
|
|
1
|
+
{"version":3,"file":"creator.service.js","names":["fetchPage","creatorUrl","getCreatorName","getCreatorBirthdayInfo","getCreatorPhoto","getCreatorBio","getCreatorFilms"],"sources":["../../src/services/creator.service.ts"],"sourcesContent":["import { HTMLElement, parse } from 'node-html-parser';\nimport { CSFDCreator } from '../dto/creator';\nimport { fetchPage } from '../fetchers';\nimport {\n getCreatorBio,\n getCreatorBirthdayInfo,\n getCreatorFilms,\n getCreatorName,\n getCreatorPhoto\n} from '../helpers/creator.helper';\nimport { CSFDOptions } from '../types';\nimport { creatorUrl } from '../vars';\n\nexport class CreatorScraper {\n public async creator(creatorId: number, options?: CSFDOptions): Promise<CSFDCreator> {\n const id = Number(creatorId);\n if (isNaN(id)) {\n throw new Error('node-csfd-api: creatorId must be a valid number');\n }\n const url = creatorUrl(id, { language: options?.language });\n const response = await fetchPage(url, { ...options?.request });\n\n const creatorHtml = parse(response);\n\n const asideNode = creatorHtml.querySelector('.creator-about');\n const filmsNode = creatorHtml.querySelector('.creator-filmography');\n return this.buildCreator(+creatorId, asideNode, filmsNode);\n }\n\n private buildCreator(id: number, asideEl: HTMLElement, filmsNode: HTMLElement): CSFDCreator {\n return {\n id,\n name: getCreatorName(asideEl),\n birthday: getCreatorBirthdayInfo(asideEl)?.birthday,\n birthplace: getCreatorBirthdayInfo(asideEl)?.birthPlace,\n photo: getCreatorPhoto(asideEl),\n age: getCreatorBirthdayInfo(asideEl)?.age || null,\n bio: getCreatorBio(asideEl),\n films: getCreatorFilms(filmsNode)\n };\n }\n}\n"],"mappings":";;;;;;AAaA,IAAa,iBAAb,MAA4B;CAC1B,MAAa,QAAQ,WAAmB,SAA6C;EACnF,MAAM,KAAK,OAAO,UAAU;AAC5B,MAAI,MAAM,GAAG,CACX,OAAM,IAAI,MAAM,kDAAkD;EAKpE,MAAM,0CAFW,MAAMA,wBADXC,wBAAW,IAAI,EAAE,UAAU,SAAS,UAAU,CAAC,EACrB,EAAE,GAAG,SAAS,SAAS,CAAC,CAE3B;EAEnC,MAAM,YAAY,YAAY,cAAc,iBAAiB;EAC7D,MAAM,YAAY,YAAY,cAAc,uBAAuB;AACnE,SAAO,KAAK,aAAa,CAAC,WAAW,WAAW,UAAU;;CAG5D,AAAQ,aAAa,IAAY,SAAsB,WAAqC;AAC1F,SAAO;GACL;GACA,MAAMC,sCAAe,QAAQ;GAC7B,UAAUC,8CAAuB,QAAQ,EAAE;GAC3C,YAAYA,8CAAuB,QAAQ,EAAE;GAC7C,OAAOC,uCAAgB,QAAQ;GAC/B,KAAKD,8CAAuB,QAAQ,EAAE,OAAO;GAC7C,KAAKE,qCAAc,QAAQ;GAC3B,OAAOC,uCAAgB,UAAU;GAClC"}
|