File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818
1919import html
20+ import logging
2021import re
2122from collections import OrderedDict
2223from html .parser import HTMLParser
2728from pyrogram .errors import PeerIdInvalid
2829from . import utils
2930
31+ log = logging .getLogger (__name__ )
32+
3033
3134class Parser (HTMLParser ):
3235 MENTION_RE = re .compile (r"tg://user\?id=(\d+)" )
@@ -94,7 +97,7 @@ def handle_endtag(self, tag):
9497 line , offset = self .getpos ()
9598 offset += 1
9699
97- raise ValueError ("Unmatched closing tag </{}> at line {}:{}" .format (tag , line , offset ))
100+ log . warning ("Unmatched closing tag </{}> at line {}:{}" .format (tag , line , offset ))
98101 else :
99102 if not self .tag_entities [tag ]:
100103 self .tag_entities .pop (tag )
@@ -120,7 +123,7 @@ def parse(self, text: str):
120123 for tag , entities in parser .tag_entities .items ():
121124 unclosed_tags .append ("<{}> (x{})" .format (tag , len (entities )))
122125
123- raise ValueError ("Unclosed tags: {}" .format (", " .join (unclosed_tags )))
126+ log . warning ("Unclosed tags: {}" .format (", " .join (unclosed_tags )))
124127
125128 entities = []
126129
You can’t perform that action at this time.
0 commit comments