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'(?:http://)?(?: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. "file": "857645.mp4",
  9. "md5": "d25945f5df41cdca2d2587165ac28720",
  10. "info_dict": {
  11. "title": 'Video: Luis Collazo says Victor Ortiz "better not quit on Jan. 30" - Ring TV',
  12. "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.',
  13. }
  14. }
  15. def _real_extract(self, url):
  16. mobj = re.match(self._VALID_URL, url)
  17. video_id = mobj.group('id').split('-')[0]
  18. webpage = self._download_webpage(url, video_id)
  19. if mobj.group('type') == 'news':
  20. video_id = self._search_regex(
  21. r'''(?x)<iframe[^>]+src="http://cms\.springboardplatform\.com/
  22. embed_iframe/[0-9]+/video/([0-9]+)/''',
  23. webpage, 'real video ID')
  24. title = self._og_search_title(webpage)
  25. description = self._html_search_regex(
  26. r'addthis:description="([^"]+)"',
  27. webpage, 'description', fatal=False)
  28. final_url = "http://ringtv.craveonline.springboardplatform.com/storage/ringtv.craveonline.com/conversion/%s.mp4" % video_id
  29. thumbnail_url = "http://ringtv.craveonline.springboardplatform.com/storage/ringtv.craveonline.com/snapshots/%s.jpg" % video_id
  30. return {
  31. 'id': video_id,
  32. 'url': final_url,
  33. 'title': title,
  34. 'thumbnail': thumbnail_url,
  35. 'description': description,
  36. }