2 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from youtube_dl.utils import compat_str, compat_urlretrieve
11 class Sport5IE(InfoExtractor):
12 _VALID_URL = r'http://.*sport5\.co\.il'
14 'url': 'http://vod.sport5.co.il/?Vc=147&Vi=176331&Page=1',
16 'id': 's5-Y59xx1-GUh2',
18 'title': 'md5:4a2a5eba7e7dc88fdc446cbca8a41c79',
21 'url': 'http://www.sport5.co.il/articles.aspx?FolderID=3075&docID=176372&lang=HE',
23 'id': 's5-SiXxx1-hKh2',
25 'title': 'md5:5cb1c6bfc0f16086e59f6683013f8e02',
30 def _real_extract(self, url):
31 mobj = re.match(self._VALID_URL, url)
33 webpage = self._download_webpage(url, '')
35 media_id = self._html_search_regex('clipId=(s5-\w+-\w+)', webpage, 'media id')
37 xml = self._download_xml(
38 'http://sport5-metadata-rr-d.nsacdn.com/vod/vod/%s/HDS/metadata.xml' % media_id,
39 media_id, 'Downloading media XML')
41 title = xml.find('./Title').text
42 duration = xml.find('./Duration').text
43 description = xml.find('./Description').text
44 thumbnail = xml.find('./PosterLinks/PosterIMG').text
45 player_url = xml.find('./PlaybackLinks/PlayerUrl').text
46 file_els = xml.findall('./PlaybackLinks/FileURL')
50 for file_el in file_els:
51 bitrate = file_el.attrib.get('bitrate')
52 width = int(file_el.attrib.get('width'))
53 height = int(file_el.attrib.get('height'))
55 'url': compat_str(file_el.text),
61 self._sort_formats(formats)
66 'thumbnail': thumbnail,
69 'player_url': player_url,