mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-27 20:37:54 +00:00
Fix HTML parsing breaking with no tags
This commit is contained in:
parent
8e0182633f
commit
cac0bcabf9
@ -93,7 +93,10 @@ class Parser(HTMLParser):
|
||||
self.text += data
|
||||
|
||||
def handle_endtag(self, tag):
|
||||
try:
|
||||
start_tag = self.tags.pop()
|
||||
except IndexError:
|
||||
return
|
||||
|
||||
if start_tag != tag:
|
||||
line, offset = self.getpos()
|
||||
@ -113,6 +116,7 @@ class HTML:
|
||||
|
||||
def parse(self, text: str):
|
||||
text = utils.add_surrogates(str(text or "").strip())
|
||||
text = "<p>{}</p>".format(text)
|
||||
|
||||
parser = Parser(self.client)
|
||||
parser.feed(text)
|
||||
|
Loading…
x
Reference in New Issue
Block a user