]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ringtv.py
Update changelog.
[youtubedl] / youtube_dl / extractor / ringtv.py
1 from __future__ import unicode_literals
2
3 import re
4
5 from .common import InfoExtractor
6
7
8 class RingTVIE(InfoExtractor):
9 _VALID_URL = r'(?:http://)?(?:www\.)?ringtv\.craveonline\.com/(?P<type>news|videos/video)/(?P<id>[^/?#]+)'
10 _TEST = {
11 "url": "http://ringtv.craveonline.com/news/310833-luis-collazo-says-victor-ortiz-better-not-quit-on-jan-30",
12 "file": "857645.mp4",
13 "md5": "d25945f5df41cdca2d2587165ac28720",
14 "info_dict": {
15 "title": 'Video: Luis Collazo says Victor Ortiz "better not quit on Jan. 30" - Ring TV',
16 "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.',
17 }
18 }
19
20 def _real_extract(self, url):
21 mobj = re.match(self._VALID_URL, url)
22 video_id = mobj.group('id').split('-')[0]
23 webpage = self._download_webpage(url, video_id)
24
25 if mobj.group('type') == 'news':
26 video_id = self._search_regex(
27 r'''(?x)<iframe[^>]+src="http://cms\.springboardplatform\.com/
28 embed_iframe/[0-9]+/video/([0-9]+)/''',
29 webpage, 'real video ID')
30 title = self._og_search_title(webpage)
31 description = self._html_search_regex(
32 r'addthis:description="([^"]+)"',
33 webpage, 'description', fatal=False)
34 final_url = "http://ringtv.craveonline.springboardplatform.com/storage/ringtv.craveonline.com/conversion/%s.mp4" % video_id
35 thumbnail_url = "http://ringtv.craveonline.springboardplatform.com/storage/ringtv.craveonline.com/snapshots/%s.jpg" % video_id
36
37 return {
38 'id': video_id,
39 'url': final_url,
40 'title': title,
41 'thumbnail': thumbnail_url,
42 'description': description,
43 }
44