aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2016-10-07 19:20:53 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2016-10-07 19:20:53 +0800
commit98763ee354ffc13a57f28dbd006729affacb6d30 (patch)
tree60e93ba4915cd48abc94a64dd0c211d8fe4796e6 /youtube_dl
parent3d83a1ae924902a0421bea8e2e6cd57bb34ee299 (diff)
[extractor/common] Add id and title helpers for generic IEs
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/common.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py
index 1076b46da..da192728f 100644
--- a/youtube_dl/extractor/common.py
+++ b/youtube_dl/extractor/common.py
@@ -21,6 +21,7 @@ from ..compat import (
compat_os_name,
compat_str,
compat_urllib_error,
+ compat_urllib_parse_unquote,
compat_urllib_parse_urlencode,
compat_urllib_request,
compat_urlparse,
@@ -2020,6 +2021,12 @@ class InfoExtractor(object):
headers['Ytdl-request-proxy'] = geo_verification_proxy
return headers
+ def _generic_id(self, url):
+ return compat_urllib_parse_unquote(os.path.splitext(url.rstrip('/').split('/')[-1])[0])
+
+ def _generic_title(self, url):
+ return compat_urllib_parse_unquote(os.path.splitext(url_basename(url))[0])
+
class SearchInfoExtractor(InfoExtractor):
"""