]> gitweb @ CieloNegro.org - youtube-dl.git/blob - youtube_dl/extractor/spike.py
[ebaumsworld] Modernize
[youtube-dl.git] / youtube_dl / extractor / spike.py
1 from __future__ import unicode_literals
2
3 import re
4
5 from .mtv import MTVServicesInfoExtractor
6
7
8 class SpikeIE(MTVServicesInfoExtractor):
9     _VALID_URL = r'''(?x)https?://
10         (www\.spike\.com/(video-clips|episodes)/.+|
11          m\.spike\.com/videos/video.rbml\?id=(?P<mobile_id>[^&]+))
12         '''
13     _TEST = {
14         'url': 'http://www.spike.com/video-clips/lhtu8m/auction-hunters-can-allen-ride-a-hundred-year-old-motorcycle',
15         'md5': '1a9265f32b0c375793d6c4ce45255256',
16         'info_dict': {
17             'id': 'b9c8221a-4e50-479a-b86d-3333323e38ba',
18             'ext': 'mp4',
19             'title': 'Auction Hunters|Can Allen Ride A Hundred Year-Old Motorcycle?',
20             'description': 'md5:fbed7e82ed5fad493615b3094a9499cb',
21         },
22     }
23
24     _FEED_URL = 'http://www.spike.com/feeds/mrss/'
25     _MOBILE_TEMPLATE = 'http://m.spike.com/videos/video.rbml?id=%s'
26
27     def _real_extract(self, url):
28         mobj = re.search(self._VALID_URL, url)
29         mobile_id = mobj.group('mobile_id')
30         if mobile_id is not None:
31             url = 'http://www.spike.com/video-clips/%s' % mobile_id
32         return super(SpikeIE, self)._real_extract(url)