aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-12-14 21:30:58 +0600
committerSergey M․ <dstftw@gmail.com>2015-12-14 21:30:58 +0600
commit31b2051e211f3e2691a186d16733cf91eb4ab391 (patch)
treecc389d19f9138799eb749a9ad332f0ea2091fabd /youtube_dl
parenteb0bdc2c3e112801bbc7517def25647b8a9fe4a4 (diff)
[utils] Add remove_quotes
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/utils.py9
1 files changed, 9 insertions, 0 deletions
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]