bebo-dot-dev / m3u-epg-editor

a python m3u / epg optimizer
120 stars 27 forks source link

Error parsing XML file #48

Closed arjunior26 closed 4 years ago

arjunior26 commented 4 years ago

Hi,

My actual XML file contains some invalid character which leads to an error when parsing epg file. So I modify the script to use lxml library and XMLParser class with recover argument :

from lxml.etree import Element, SubElement, parse, ElementTree, XMLParser
...
def create_new_epg(args, original_epg_filename, m3u_entries):
    output_str("creating new xml epg for {} m3u items".format(len(m3u_entries)))
    try:
        #original_tree = parse(original_epg_filename)
        parser = XMLParser(recover=True)
        original_tree = parse(original_epg_filename, parser)
        ...

What do you think about using it ? That shouldn't be a problem except we have to install one more package.

bebo-dot-dev commented 4 years ago

haha ok, I'll take a look. I have to say that I'm noticing a common theme with your 3 issues, in one way or another they're all data quality related 😃

arjunior26 commented 4 years ago

You're right :))

bebo-dot-dev commented 4 years ago

I like this suggestion, thank you. Making the change now.

bebo-dot-dev commented 4 years ago

Done, thanks.

arjunior26 commented 4 years ago

Thank you !