43 lines
1.7 KiB
Python
Raw Normal View History

from __future__ import unicode_literals
2016-11-29 08:06:01 -08:00
import re
from .mtv import MTVServicesInfoExtractor
class SpikeIE(MTVServicesInfoExtractor):
_VALID_URL = r'https?://(?:[^/]+\.)?paramountnetwork\.com/[^/]+/[\da-z]{6}(?:[/?#&]|$)'
_TESTS = [{
'url': 'http://www.paramountnetwork.com/video-clips/e1ktem/nobodies-gangbanged',
'md5': 'f53ab001b5c1c6fee01bc9f00e2859d1',
'info_dict': {
'id': 'e1ktem',
'ext': 'mp4',
'title': 'Gangbanged - NOBODIES | Paramount Network',
'description': 'TODO: Add description checksum',
'upload_date': 'TODO: Add upload date',
},
2016-11-29 08:06:01 -08:00
}, {
'url': 'http://www.paramountnetwork.com/episodes/j830qm/lip-sync-battle-joel-mchale-vs-jim-rash-season-2-ep-13',
'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)',
2016-11-29 08:06:01 -08:00
'info_dict': {
'id': 'j830qm',
2016-11-29 08:06:01 -08:00
'ext': 'mp4',
'title': 'Lip Sync Battle - Season 2, Ep. 13 - Joel McHale Vs. Jim Rash - Full Episode | Paramount Network',
'description': 'TODO: Add description checksum',
2016-11-29 08:06:01 -08:00
},
}]
_FEED_URL = 'http://www.spike.com/feeds/mrss/'
_MOBILE_TEMPLATE = 'http://m.spike.com/videos/video.rbml?id=%s'
2016-11-29 08:06:01 -08:00
_CUSTOM_URL_REGEX = re.compile(r'spikenetworkapp://([^/]+/[-a-fA-F0-9]+)')
2017-10-13 08:41:57 +00:00
_GEO_COUNTRIES = ['US']
2016-11-29 08:06:01 -08:00
def _extract_mgid(self, webpage):
mgid = super(SpikeIE, self)._extract_mgid(webpage)
2016-11-29 08:06:01 -08:00
if mgid is None:
url_parts = self._search_regex(self._CUSTOM_URL_REGEX, webpage, 'episode_id')
video_type, episode_id = url_parts.split('/', 1)
mgid = 'mgid:arc:{0}:spike.com:{1}'.format(video_type, episode_id)
return mgid