huxuan / iptvtools

A set of scripts that help to better the IPTV experience.
https://iptvtools.readthedocs.io/
MIT License
179 stars 50 forks source link

NL character cause AttributeError: 'NoneType' object has no attribute 'groupdict' #24

Open FrancYescO opened 2 years ago

FrancYescO commented 2 years ago

Hello, i need to manage an m3u list that have a \n in channel title.. this breaks the regex/perline parsing and make the tool unusable

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/bin/iptv-filter", line 8, in <module>
    sys.exit(main())
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/iptvtools/iptv_filter.py", line 73, in main
    playlist.parse()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/iptvtools/models.py", line 68, in parse
    self._parse(self.args.inputs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/iptvtools/models.py", line 95, in _parse
    current_item = parsers.parse_tag_inf(line)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/iptvtools/parsers.py", line 35, in parse_tag_inf
    res = match.groupdict()
AttributeError: 'NoneType' object has no attribute 'groupdict'

Here a test case, put it in an m3u file and try to use the tool on it

#EXTM3U
#EXTINF:-1 tvg-id="" tvg-name="broken channel
name" tvg-logo="" group-title="US",broken channel
name
http://blabla.com/11111
#EXTINF:-1 tvg-id="" tvg-name="
" tvg-logo="" group-title="US",

http://blabla.com/2222
#EXTINF:-1 tvg-id="" tvg-name="good channel name" tvg-logo="https://logo.com/logo.png" group-title="USA",good channel name
http://blabla.com/3333

can we fix this somehow? this is a similar issue as https://github.com/huxuan/iptvtools/issues/16