]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/sport5.py
2 from __future__
import unicode_literals
5 from .common
import InfoExtractor
6 from ..utils
import ExtractorError
9 class Sport5IE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?:www|vod)?\.sport5\.co\.il/.*\b(?:Vi|docID)=(?P<id>\d+)'
13 'url': 'http://vod.sport5.co.il/?Vc=147&Vi=176331&Page=1',
15 'id': 's5-Y59xx1-GUh2',
17 'title': 'ולנסיה-קורדובה 0:3',
18 'description': 'אלקאסר, גאייה ופגולי סידרו לקבוצה של נונו ניצחון על קורדובה ואת המקום הראשון בליגה',
22 'skip': 'Blocked outside of Israel',
24 'url': 'http://www.sport5.co.il/articles.aspx?FolderID=3075&docID=176372&lang=HE',
26 'id': 's5-SiXxx1-hKh2',
28 'title': 'GOALS_CELTIC_270914.mp4',
33 'skip': 'Blocked outside of Israel',
37 def _real_extract(self
, url
):
38 mobj
= self
._match
_valid
_url
(url
)
39 media_id
= mobj
.group('id')
41 webpage
= self
._download
_webpage
(url
, media_id
)
43 video_id
= self
._html
_search
_regex
(r
'clipId=([\w-]+)', webpage
, 'video id')
45 metadata
= self
._download
_xml
(
46 'http://sport5-metadata-rr-d.nsacdn.com/vod/vod/%s/HDS/metadata.xml' % video_id
,
49 error
= metadata
.find('./Error')
52 '%s returned error: %s - %s' % (
54 error
.find('./Name').text
,
55 error
.find('./Description').text
),
58 title
= metadata
.find('./Title').text
59 description
= metadata
.find('./Description').text
60 duration
= int(metadata
.find('./Duration').text
)
62 posters_el
= metadata
.find('./PosterLinks')
64 'url': thumbnail
.text
,
65 'width': int(thumbnail
.get('width')),
66 'height': int(thumbnail
.get('height')),
67 } for thumbnail
in posters_el
.findall('./PosterIMG')] if posters_el
is not None else []
69 categories_el
= metadata
.find('./Categories')
71 cat
.get('name') for cat
in categories_el
.findall('./Category')
72 ] if categories_el
is not None else []
77 'vbr': int(fmt
.get('bitrate')),
78 'width': int(fmt
.get('width')),
79 'height': int(fmt
.get('height')),
80 } for fmt
in metadata
.findall('./PlaybackLinks/FileURL')]
81 self
._sort
_formats
(formats
)
86 'description': description
,
87 'thumbnails': thumbnails
,
89 'categories': categories
,