mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-11-14 22:37:59 +09:00
[utils] remove check for val from find_xpath_attr
This commit is contained in:
parent
8c5a994424
commit
e07237f640
@ -160,8 +160,6 @@ if sys.version_info >= (2, 7):
|
|||||||
def find_xpath_attr(node, xpath, key, val=None):
|
def find_xpath_attr(node, xpath, key, val=None):
|
||||||
""" Find the xpath xpath[@key=val] """
|
""" Find the xpath xpath[@key=val] """
|
||||||
assert re.match(r'^[a-zA-Z_-]+$', key)
|
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))
|
expr = xpath + ('[@%s]' % key if val is None else "[@%s='%s']" % (key, val))
|
||||||
return node.find(expr)
|
return node.find(expr)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user