]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/trutube.py
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
   8 class TruTubeIE(InfoExtractor
): 
   9     _VALID_URL 
= r
'https?://(?:www\.)?trutube\.tv/video/(?P<id>[0-9]+)/.*' 
  11         'url': 'http://trutube.tv/video/14880/Ramses-II-Proven-To-Be-A-Red-Headed-Caucasoid-', 
  12         'md5': 'c5b6e301b0a2040b074746cbeaa26ca1', 
  16             'title': 'Ramses II - Proven To Be A Red Headed Caucasoid', 
  17             'thumbnail': 're:^http:.*\.jpg$', 
  21     def _real_extract(self
, url
): 
  22         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  23         video_id 
= mobj
.group('id') 
  25         webpage 
= self
._download
_webpage
(url
, video_id
) 
  26         video_title 
= self
._og
_search
_title
(webpage
).strip() 
  27         thumbnail 
= self
._search
_regex
( 
  28             r
"var splash_img = '([^']+)';", webpage
, 'thumbnail', fatal
=False) 
  30         all_formats 
= re
.finditer( 
  31             r
"var (?P<key>[a-z]+)_video_file\s*=\s*'(?P<url>[^']+)';", webpage
) 
  33             'format_id': m
.group('key'), 
  35             'url': m
.group('url'), 
  36         } for i
, m 
in enumerate(all_formats
)] 
  37         self
._sort
_formats
(formats
) 
  43             'thumbnail': thumbnail
,