Remove html comments GRR

j0anita

Developer
Sep 1, 2012
169
0
0
Portugal
Hi,

On my TV addon, i use re.search('servername',link) to catch the server and this works well.

But now, one of my sources put old/dead streams on page with html comments (<!-- and -->).

I created one function to remove this, but sometimes doesn't work 100%.

Code:
def limparcomentarioshtml(link):
    link=clean(link)
    link=link.replace('<!--','<comentario>').replace('-->','<fimcomentario>')
    limparcomentarios=re.compile('<comentario>(.+?)<fimcomentario>').findall(link)
    for texto in limparcomentarios:
        re.sub(texto,'',link)
    return link
The page:
Code:
http://www.zuuk.net/sporttv_5.php?width=768&height=432
Please help me remove the commented sources :p