]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/teamcoco.py
   3 from .common 
import InfoExtractor
 
   9 class TeamcocoIE(InfoExtractor
): 
  10     _VALID_URL 
= r
'http://teamcoco\.com/video/(?P<url_title>.*)' 
  12         u
'url': u
'http://teamcoco.com/video/louis-ck-interview-george-w-bush', 
  13         u
'file': u
'19705.mp4', 
  14         u
'md5': u
'27b6f7527da5acf534b15f21b032656e', 
  16             u
"description": u
"Louis C.K. got starstruck by George W. Bush, so what? Part one.",  
  17             u
"title": u
"Louis C.K. Interview Pt. 1 11/3/11" 
  21     def _real_extract(self
, url
): 
  22         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  24             raise ExtractorError(u
'Invalid URL: %s' % url
) 
  25         url_title 
= mobj
.group('url_title') 
  26         webpage 
= self
._download
_webpage
(url
, url_title
) 
  28         video_id 
= self
._html
_search
_regex
(r
'<article class="video" data-id="(\d+?)"', 
  31         self
.report_extraction(video_id
) 
  33         data_url 
= 'http://teamcoco.com/cvp/2.0/%s.xml' % video_id
 
  34         data 
= self
._download
_webpage
(data_url
, video_id
, 'Downloading data webpage') 
  36         video_url 
= self
._html
_search
_regex
(r
'<file [^>]*type="high".*?>(.*?)</file>', 
  43             'title':       self
._og
_search
_title
(webpage
), 
  44             'thumbnail':   self
._og
_search
_thumbnail
(webpage
), 
  45             'description': self
._og
_search
_description
(webpage
),