1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-02 17:22:31 +01:00

[utils] remove check for val from find_xpath_attr

This commit is contained in:
remitamine 2016-03-02 21:40:21 +01:00
parent 8c5a994424
commit e07237f640

View File

@ -160,8 +160,6 @@ def write_json_file(obj, fn):
def find_xpath_attr(node, xpath, key, val=None):
""" Find the xpath xpath[@key=val] """
assert re.match(r'^[a-zA-Z_-]+$', key)
if val:
assert re.match(r'^[a-zA-Z0-9@\s:._-]*$', val)
expr = xpath + ('[@%s]' % key if val is None else "[@%s='%s']" % (key, val))
return node.find(expr)
else: