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 +1 -1
- package/src/index.js +9 -3
- package/tests/__data__/output/guide.xml +1 -1
package/package.json
CHANGED
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
|
-
|
|
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 (
|
|
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="
|
|
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=шеллы&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=шеллы&sid=777"/><url>https://example2.com</url></channel>
|