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.

44 lines
1.9 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. class RingTVIE(InfoExtractor):
  5. _VALID_URL = r'https?://(?:www\.)?ringtv\.craveonline\.com/(?P<type>news|videos/video)/(?P<id>[^/?#]+)'
  6. _TEST = {
  7. 'url': 'http://ringtv.craveonline.com/news/310833-luis-collazo-says-victor-ortiz-better-not-quit-on-jan-30',
  8. 'md5': 'd25945f5df41cdca2d2587165ac28720',
  9. 'info_dict': {
  10. 'id': '857645',
  11. 'ext': 'mp4',
  12. 'title': 'Video: Luis Collazo says Victor Ortiz "better not quit on Jan. 30" - Ring TV',
  13. 'description': 'Luis Collazo is excited about his Jan. 30 showdown with fellow former welterweight titleholder Victor Ortiz at Barclays Center in his hometown of Brooklyn. The SuperBowl week fight headlines a Golden Boy Live! card on Fox Sports 1.',
  14. }
  15. }
  16. def _real_extract(self, url):
  17. mobj = re.match(self._VALID_URL, url)
  18. video_id = mobj.group('id').split('-')[0]
  19. webpage = self._download_webpage(url, video_id)
  20. if mobj.group('type') == 'news':
  21. video_id = self._search_regex(
  22. r'''(?x)<iframe[^>]+src="http://cms\.springboardplatform\.com/
  23. embed_iframe/[0-9]+/video/([0-9]+)/''',
  24. webpage, 'real video ID')
  25. title = self._og_search_title(webpage)
  26. description = self._html_search_regex(
  27. r'addthis:description="([^"]+)"',
  28. webpage, 'description', fatal=False)
  29. final_url = 'http://ringtv.craveonline.springboardplatform.com/storage/ringtv.craveonline.com/conversion/%s.mp4' % video_id
  30. thumbnail_url = 'http://ringtv.craveonline.springboardplatform.com/storage/ringtv.craveonline.com/snapshots/%s.jpg' % video_id
  31. return {
  32. 'id': video_id,
  33. 'url': final_url,
  34. 'title': title,
  35. 'thumbnail': thumbnail_url,
  36. 'description': description,
  37. }