]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/nba.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
12 class NBAIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:watch\.|www\.)?nba\.com/(?:nba/)?video(?P<id>/[^?]*?)(?:/index\.html)?(?:\?.*)?$'
15 'url': 'http://www.nba.com/video/games/nets/2012/12/04/0021200253-okc-bkn-recap.nba/index.html',
16 'md5': 'c0edcfc37607344e2ff8f13c378c88a4',
18 'id': '0021200253-okc-bkn-recap.nba',
20 'title': 'Thunder vs. Nets',
21 'description': 'Kevin Durant scores 32 points and dishes out six assists as the Thunder beat the Nets in Brooklyn.',
26 def _real_extract(self
, url
):
27 mobj
= re
.match(self
._VALID
_URL
, url
)
28 video_id
= mobj
.group('id')
30 webpage
= self
._download
_webpage
(url
, video_id
)
32 video_url
= 'http://ht-mobile.cdn.turner.com/nba/big' + video_id
+ '_nba_1280x720.mp4'
34 shortened_video_id
= video_id
.rpartition('/')[2]
36 self
._og
_search
_title
(webpage
, default
=shortened_video_id
), ' : NBA.com')
38 description
= self
._og
_search
_description
(webpage
)
39 duration
= parse_duration(
40 self
._html
_search
_meta
('duration', webpage
, 'duration', fatal
=False))
43 'id': shortened_video_id
,
46 'description': description
,