From b165eb1265ffa108086eab8e7ef567c51828e7cd Mon Sep 17 00:00:00 2001 From: Viktor Stanchev Date: Thu, 21 May 2015 18:39:44 +0300 Subject: [PATCH] remove quotes before calling --custom command, fix #49 --- pirate-get.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pirate-get.py b/pirate-get.py index e97d2d8..4a9aeaa 100755 --- a/pirate-get.py +++ b/pirate-get.py @@ -169,7 +169,13 @@ def parse_cmd(cmd, url): cmd_args_regex = r'''(('[^']*'|"[^"]*"|(\\\s|[^\s])+)+ *)''' ret = re.findall(cmd_args_regex, cmd) 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