You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.1 KiB

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