epg-grabber 0.21.0 → 0.22.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "epg-grabber",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
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
@@ -18,9 +18,12 @@ module.exports = {
18
18
  cb(item, null)
19
19
  programs = programs.concat(results)
20
20
  })
21
- .catch(err => {
21
+ .catch(error => {
22
22
  item.programs = []
23
- cb(item, err)
23
+ if (config.debug) {
24
+ console.log('Error:', JSON.stringify(error, null, 2))
25
+ }
26
+ cb(item, error)
24
27
  })
25
28
 
26
29
  await utils.sleep(config.delay)
package/src/utils.js CHANGED
@@ -266,6 +266,20 @@ utils.getUTCDate = function (d = null) {
266
266
  }
267
267
 
268
268
  utils.parseResponse = async (item, response, config) => {
269
+ if (config.debug) {
270
+ console.log(
271
+ 'Response:',
272
+ JSON.stringify(
273
+ {
274
+ headers: response.headers,
275
+ data: response.data.toString()
276
+ },
277
+ null,
278
+ 2
279
+ )
280
+ )
281
+ }
282
+
269
283
  const data = merge(item, config, {
270
284
  content: response.data.toString(),
271
285
  buffer: response.data,