From 31b2051e211f3e2691a186d16733cf91eb4ab391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergey=20M=E2=80=A4?= Date: Mon, 14 Dec 2015 21:30:58 +0600 Subject: [utils] Add remove_quotes --- youtube_dl/utils.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'youtube_dl/utils.py') diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index d0606b4bc..91917fc96 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -1406,6 +1406,15 @@ def remove_end(s, end): return s +def remove_quotes(s): + if s is None or len(s) < 2: + return s + for quote in ('"', "'", ): + if s[0] == quote and s[-1] == quote: + return s[1:-1] + return s + + def url_basename(url): path = compat_urlparse.urlparse(url).path return path.strip('/').split('/')[-1] -- cgit v1.2.3