mirror of
https://github.com/vikstrous/pirate-get
synced 2025-01-10 10:04:21 +01:00
remove quotes before calling --custom command, fix #49
This commit is contained in:
parent
09f7f24411
commit
b165eb1265
@ -169,7 +169,13 @@ def parse_cmd(cmd, url):
|
|||||||
cmd_args_regex = r'''(('[^']*'|"[^"]*"|(\\\s|[^\s])+)+ *)'''
|
cmd_args_regex = r'''(('[^']*'|"[^"]*"|(\\\s|[^\s])+)+ *)'''
|
||||||
ret = re.findall(cmd_args_regex, cmd)
|
ret = re.findall(cmd_args_regex, cmd)
|
||||||
ret = [i[0].strip().replace('%s', url) for i in ret]
|
ret = [i[0].strip().replace('%s', url) for i in ret]
|
||||||
return ret
|
ret_no_quotes = []
|
||||||
|
for item in ret:
|
||||||
|
if (item[0] == "'" and item[-1] == "'") or (item[0] == '"' and item[-1] == '"'):
|
||||||
|
ret_no_quotes.append(item[1:-1])
|
||||||
|
else:
|
||||||
|
ret_no_quotes.append(item)
|
||||||
|
return ret_no_quotes
|
||||||
|
|
||||||
|
|
||||||
#todo: redo this with html parser instead of regex
|
#todo: redo this with html parser instead of regex
|
||||||
|
Loading…
Reference in New Issue
Block a user