mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-11-06 21:17:11 +01:00
[utils] Relax attribute key assert
This commit is contained in:
parent
a41fb80ce1
commit
5d2354f177
@ -141,7 +141,7 @@ def write_json_file(obj, fn):
|
|||||||
if sys.version_info >= (2, 7):
|
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:
|
if val:
|
||||||
assert re.match(r'^[a-zA-Z0-9@\s:._-]*$', 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))
|
||||||
|
Loading…
Reference in New Issue
Block a user