mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-01 00:52:58 +01:00
ignore parsing errors in get_element_by_id()
This commit is contained in:
parent
781cc523af
commit
7a8501e307
@ -252,7 +252,10 @@ class IDParser(HTMLParser.HTMLParser):
|
|||||||
def get_element_by_id(id, html):
|
def get_element_by_id(id, html):
|
||||||
"""Return the content of the tag with the specified id in the passed HTML document"""
|
"""Return the content of the tag with the specified id in the passed HTML document"""
|
||||||
parser = IDParser(id)
|
parser = IDParser(id)
|
||||||
|
try:
|
||||||
parser.loads(html)
|
parser.loads(html)
|
||||||
|
except HTMLParser.HTMLParseError:
|
||||||
|
pass
|
||||||
return parser.get_result()
|
return parser.get_result()
|
||||||
|
|
||||||
|
|
||||||
|
@ -252,7 +252,10 @@ def get_result(self):
|
|||||||
def get_element_by_id(id, html):
|
def get_element_by_id(id, html):
|
||||||
"""Return the content of the tag with the specified id in the passed HTML document"""
|
"""Return the content of the tag with the specified id in the passed HTML document"""
|
||||||
parser = IDParser(id)
|
parser = IDParser(id)
|
||||||
|
try:
|
||||||
parser.loads(html)
|
parser.loads(html)
|
||||||
|
except HTMLParser.HTMLParseError:
|
||||||
|
pass
|
||||||
return parser.get_result()
|
return parser.get_result()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user