]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/sport5.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..utils
import ExtractorError
10 class Sport5IE(InfoExtractor
):
11 _VALID_URL
= r
'http://(?:www|vod)?\.sport5\.co\.il/.*\b(?:Vi|docID)=(?P<id>\d+)'
14 'url': 'http://vod.sport5.co.il/?Vc=147&Vi=176331&Page=1',
16 'id': 's5-Y59xx1-GUh2',
18 'title': 'ולנסיה-קורדובה 0:3',
19 'description': 'אלקאסר, גאייה ופגולי סידרו לקבוצה של נונו ניצחון על קורדובה ואת המקום הראשון בליגה',
23 'skip': 'Blocked outside of Israel',
25 'url': 'http://www.sport5.co.il/articles.aspx?FolderID=3075&docID=176372&lang=HE',
27 'id': 's5-SiXxx1-hKh2',
29 'title': 'GOALS_CELTIC_270914.mp4',
34 'skip': 'Blocked outside of Israel',
38 def _real_extract(self
, url
):
39 mobj
= re
.match(self
._VALID
_URL
, url
)
40 media_id
= mobj
.group('id')
42 webpage
= self
._download
_webpage
(url
, media_id
)
44 video_id
= self
._html
_search
_regex
('clipId=([\w-]+)', webpage
, 'video id')
46 metadata
= self
._download
_xml
(
47 'http://sport5-metadata-rr-d.nsacdn.com/vod/vod/%s/HDS/metadata.xml' % video_id
,
50 error
= metadata
.find('./Error')
53 '%s returned error: %s - %s' % (
55 error
.find('./Name').text
,
56 error
.find('./Description').text
),
59 title
= metadata
.find('./Title').text
60 description
= metadata
.find('./Description').text
61 duration
= int(metadata
.find('./Duration').text
)
63 posters_el
= metadata
.find('./PosterLinks')
65 'url': thumbnail
.text
,
66 'width': int(thumbnail
.get('width')),
67 'height': int(thumbnail
.get('height')),
68 } for thumbnail
in posters_el
.findall('./PosterIMG')] if posters_el
is not None else []
70 categories_el
= metadata
.find('./Categories')
72 cat
.get('name') for cat
in categories_el
.findall('./Category')
73 ] if categories_el
is not None else []
78 'vbr': int(fmt
.get('bitrate')),
79 'width': int(fmt
.get('width')),
80 'height': int(fmt
.get('height')),
81 } for fmt
in metadata
.findall('./PlaybackLinks/FileURL')]
82 self
._sort
_formats
(formats
)
87 'description': description
,
88 'thumbnails': thumbnails
,
90 'categories': categories
,