epg-grabber 0.36.0 → 0.36.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "epg-grabber",
3
- "version": "0.36.0",
3
+ "version": "0.36.1",
4
4
  "description": "Node.js CLI tool for grabbing EPG from different sites",
5
5
  "main": "src/index.js",
6
6
  "preferGlobal": true,
package/src/index.js CHANGED
@@ -64,12 +64,18 @@ class EPGGrabberMock {
64
64
  this.config = config
65
65
  }
66
66
 
67
- async grab(channel, date, cb) {
67
+ async grab(channel, date, config = {}, cb = () => {}) {
68
68
  let _date = getUTCDate(date)
69
- let _programs = await this.config.parser({ channel, date: _date })
69
+ if (typeof config == 'function') {
70
+ cb = config
71
+ config = {}
72
+ }
73
+ config = merge(this.config, config)
74
+ config = parseConfig(config)
75
+ let _programs = await config.parser({ channel, date: _date })
70
76
  let programs = _programs.map(data => new Program(data, channel))
71
77
 
72
- if (this.config.request?.timeout !== undefined && this.config.request.timeout < 1) {
78
+ if (config.request?.timeout !== undefined && config.request.timeout < 1) {
73
79
  cb({ programs: [], date: _date, channel }, new Error('Connection timeout'))
74
80
  return []
75
81
  }
@@ -1,4 +1,4 @@
1
- <?xml version="1.0" encoding="UTF-8" ?><tv date="20231125">
1
+ <?xml version="1.0" encoding="UTF-8" ?><tv date="20231201">
2
2
  <channel id="1TV.com"><display-name>1 TV</display-name><icon src="https://example.com/logos/1TV.png"/><url>https://example.com</url></channel>
3
3
  <channel id="2TV.com"><display-name>2 TV</display-name><icon src="http://example.com/logos/1TV.png?x=шеллы&amp;sid=777"/><url>https://example.com</url></channel>
4
4
  <channel id="3TV.com"><display-name>3 TV</display-name><icon src="http://example.com/logos/1TV.png?x=шеллы&amp;sid=777"/><url>https://example2.com</url></channel>