]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/trilulilu.py
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
   8 class TriluliluIE(InfoExtractor
): 
   9     _VALID_URL 
= r
'https?://(?:www\.)?trilulilu\.ro/video-[^/]+/(?P<id>[^/]+)' 
  11         'url': 'http://www.trilulilu.ro/video-animatie/big-buck-bunny-1', 
  13             'id': 'big-buck-bunny-1', 
  15             'title': 'Big Buck Bunny', 
  16             'description': ':) pentru copilul din noi', 
  18         # Server ignores Range headers (--test) 
  24     def _real_extract(self
, url
): 
  25         video_id 
= self
._match
_id
(url
) 
  26         webpage 
= self
._download
_webpage
(url
, video_id
) 
  28         title 
= self
._og
_search
_title
(webpage
) 
  29         thumbnail 
= self
._og
_search
_thumbnail
(webpage
) 
  30         description 
= self
._og
_search
_description
(webpage
) 
  32         log_str 
= self
._search
_regex
( 
  33             r
'block_flash_vars[ ]=[ ]({[^}]+})', webpage
, 'log info') 
  34         log 
= json
.loads(log_str
) 
  36         format_url 
= ('http://fs%(server)s.trilulilu.ro/%(hash)s/' 
  37                       'video-formats2' % log
) 
  38         format_doc 
= self
._download
_xml
( 
  40             note
='Downloading formats', 
  41             errnote
='Error while downloading formats') 
  43         video_url_template 
= ( 
  44             'http://fs%(server)s.trilulilu.ro/stream.php?type=video' 
  45             '&source=site&hash=%(hash)s&username=%(userid)s&' 
  46             'key=ministhebest&format=%%s&sig=&exp=' % 
  51                 'url': video_url_template 
% fnode
.text
, 
  52                 'ext': fnode
.text
.partition('-')[0] 
  55             for fnode 
in format_doc
.findall('./formats/format') 
  63             'description': description
, 
  64             'thumbnail': thumbnail
,