]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/cbssports.py
ae47e74ccf583ac9d821dd588f07f33ff57673db
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
   8 class CBSSportsIE(InfoExtractor
): 
   9     _VALID_URL 
= r
'http://www\.cbssports\.com/video/player/(?P<section>[^/]+)/(?P<id>[^/]+)' 
  12         'url': 'http://www.cbssports.com/video/player/tennis/318462531970/0/us-open-flashbacks-1990s', 
  16             'title': 'US Open flashbacks: 1990s', 
  17             'description': 'Bill Macatee relives the best moments in US Open history from the 1990s.', 
  21     def _real_extract(self
, url
): 
  22         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  23         section 
= mobj
.group('section') 
  24         video_id 
= mobj
.group('id') 
  25         all_videos 
= self
._download
_json
( 
  26             'http://www.cbssports.com/data/video/player/getVideos/%s?as=json' % section
, 
  28         # The json file contains the info of all the videos in the section 
  29         video_info 
= next(v 
for v 
in all_videos 
if v
['pcid'] == video_id
) 
  30         return self
.url_result('theplatform:%s' % video_info
['pid'], 'ThePlatform')