epg-grabber 0.37.3 → 0.37.4

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.37.3",
3
+ "version": "0.37.4",
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/parser.js CHANGED
@@ -27,12 +27,14 @@ function parseChannels(xml) {
27
27
  .filter(el => el.name === 'channel')
28
28
  .map(el => {
29
29
  const c = el.attributes
30
+ if (!Array.isArray(el.elements)) return
30
31
  c.name = el.elements.find(el => el.type === 'text').text
31
32
  c.site = c.site || rootSite
32
- if (!c.name) throw new Error(`Channel '${c.xmltv_id}' has no valid name`)
33
+ if (!c.name) return
33
34
 
34
35
  return new Channel(c)
35
36
  })
37
+ .filter(Boolean)
36
38
 
37
39
  return channels
38
40
  }
@@ -2,4 +2,5 @@
2
2
  <channels site="example.com">
3
3
  <channel xmltv_id="1TV.com" site_id="1" lang="fr" logo="https://example.com/logos/1TV.png">1 TV</channel>
4
4
  <channel xmltv_id="2TV.com" site_id="2">2 TV</channel>
5
+ <channel xmltv_id="3TV.com" site_id="3"></channel>
5
6
  </channels>