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.

37 lines
1.7 KiB

  1. import re
  2. from .common import InfoExtractor
  3. class RingTVIE(InfoExtractor):
  4. _VALID_URL = r'(?:http://)?(?:www\.)?ringtv\.craveonline\.com/videos/video/([^/]+)'
  5. _TEST = {
  6. u"url": u"http://ringtv.craveonline.com/videos/video/746619-canelo-alvarez-talks-about-mayweather-showdown",
  7. u"file": u"746619.mp4",
  8. u"md5": u"7c46b4057d22de32e0a539f017e64ad3",
  9. u"info_dict": {
  10. u"title": u"Canelo Alvarez talks about Mayweather showdown",
  11. u"description": u"Saul \\\"Canelo\\\" Alvarez spoke to the media about his Sept. 14 showdown with Floyd Mayweather after their kick-off presser in NYC. Canelo is motivated and confident that he will have the speed and gameplan to beat the pound-for-pound king."
  12. }
  13. }
  14. def _real_extract(self, url):
  15. mobj = re.match(self._VALID_URL, url)
  16. video_id = mobj.group(1).split('-')[0]
  17. webpage = self._download_webpage(url, video_id)
  18. title = self._search_regex(r'<title>(.+?)</title>',
  19. webpage, 'video title').replace(' | RingTV','')
  20. description = self._search_regex(r'<div class="blurb">(.+?)</div>',
  21. webpage, 'Description')
  22. final_url = "http://ringtv.craveonline.springboardplatform.com/storage/ringtv.craveonline.com/conversion/%s.mp4" %(str(video_id))
  23. thumbnail_url = "http://ringtv.craveonline.springboardplatform.com/storage/ringtv.craveonline.com/snapshots/%s.jpg" %(str(video_id))
  24. ext = final_url.split('.')[-1]
  25. return [{
  26. 'id' : video_id,
  27. 'url' : final_url,
  28. 'ext' : ext,
  29. 'title' : title,
  30. 'thumbnail' : thumbnail_url,
  31. 'description' : description,
  32. }]