]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/trutube.py
   1 from __future__ 
import unicode_literals
 
   3 from .common 
import InfoExtractor
 
   4 from ..utils 
import xpath_text
 
   7 class TruTubeIE(InfoExtractor
): 
   8     _VALID_URL 
= r
'https?://(?:www\.)?trutube\.tv/(?:video/|nuevo/player/embed\.php\?v=)(?P<id>[0-9]+)' 
  10         'url': 'http://trutube.tv/video/14880/Ramses-II-Proven-To-Be-A-Red-Headed-Caucasoid-', 
  11         'md5': 'c5b6e301b0a2040b074746cbeaa26ca1', 
  15             'title': 'Ramses II - Proven To Be A Red Headed Caucasoid', 
  16             'thumbnail': 're:^http:.*\.jpg$', 
  19         'url': 'https://trutube.tv/nuevo/player/embed.php?v=14880', 
  20         'only_matching': True, 
  23     def _real_extract(self
, url
): 
  24         video_id 
= self
._match
_id
(url
) 
  26         config 
= self
._download
_xml
( 
  27             'https://trutube.tv/nuevo/player/config.php?v=%s' % video_id
, 
  28             video_id
, transform_source
=lambda s
: s
.strip()) 
  30         # filehd is always 404 
  31         video_url 
= xpath_text(config
, './file', 'video URL', fatal
=True) 
  32         title 
= xpath_text(config
, './title', 'title').strip() 
  33         thumbnail 
= xpath_text(config
, './image', ' thumbnail') 
  39             'thumbnail': thumbnail
,