]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[comedycentral] Re-add shortnames
authorPhilipp Hagemeister <phihag@phihag.de>
Tue, 2 Aug 2016 12:02:31 +0000 (14:02 +0200)
committerPhilipp Hagemeister <phihag@phihag.de>
Tue, 2 Aug 2016 12:02:31 +0000 (14:02 +0200)
In cc99d4f826a942b18133fe4221c9de2f9197e860, the shortname feature got deleted by accident. Re-add it as a separate IE.

youtube_dl/extractor/comedycentral.py
youtube_dl/extractor/extractors.py

index c76909e48dfdb7ff7c490c22971be8462ec8a59d..88346dde7754a124e2b1d88d5ab8291dca4ca632 100644 (file)
@@ -1,6 +1,7 @@
 from __future__ import unicode_literals
 
 from .mtv import MTVServicesInfoExtractor
+from .common import InfoExtractor
 
 
 class ComedyCentralIE(MTVServicesInfoExtractor):
@@ -96,3 +97,22 @@ class ComedyCentralTVIE(MTVServicesInfoExtractor):
             webpage, 'mrss url', group='url')
 
         return self._get_videos_info_from_url(mrss_url, video_id)
+
+
+class ComedyCentralShortnameIE(InfoExtractor):
+    _VALID_URL = r'^:(?P<id>tds|thedailyshow)$'
+    _TESTS = [{
+        'url': ':tds',
+        'only_matching': True,
+    }, {
+        'url': ':thedailyshow',
+        'only_matching': True,
+    }]
+
+    def _real_extract(self, url):
+        video_id = self._match_id(url)
+        shortcut_map = {
+            'tds': 'http://www.cc.com/shows/the-daily-show-with-trevor-noah/full-episodes',
+            'thedailyshow': 'http://www.cc.com/shows/the-daily-show-with-trevor-noah/full-episodes',
+        }
+        return self.url_result(shortcut_map[video_id])
index 53fab1a317a7456d82162ecc47ad260c09bcb347..86c48ff54351ad558e651995b53248d4ab73520e 100644 (file)
@@ -159,6 +159,7 @@ from .coub import CoubIE
 from .collegerama import CollegeRamaIE
 from .comedycentral import (
     ComedyCentralIE,
+    ComedyCentralShortnameIE,
     ComedyCentralTVIE,
     ToshIE,
 )