]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/trilulilu.py
   4 from .common 
import InfoExtractor
 
   7 class TriluliluIE(InfoExtractor
): 
   8     _VALID_URL 
= r
'(?x)(?:https?://)?(?:www\.)?trilulilu\.ro/video-(?P<category>[^/]+)/(?P<video_id>[^/]+)' 
  10         u
"url": u
"http://www.trilulilu.ro/video-animatie/big-buck-bunny-1", 
  11         u
'file': u
"big-buck-bunny-1.mp4", 
  13             u
"title": u
"Big Buck Bunny", 
  14             u
"description": u
":) pentru copilul din noi", 
  16         # Server ignores Range headers (--test) 
  18             u
"skip_download": True 
  22     def _real_extract(self
, url
): 
  23         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  24         video_id 
= mobj
.group('video_id') 
  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
, u
'log info') 
  34         log 
= json
.loads(log_str
) 
  36         format_url 
= (u
'http://fs%(server)s.trilulilu.ro/%(hash)s/' 
  37                       u
'video-formats2' % log
) 
  38         format_doc 
= self
._download
_xml
( 
  40             note
=u
'Downloading formats', 
  41             errnote
=u
'Error while downloading formats') 
  43         video_url_template 
= ( 
  44             u
'http://fs%(server)s.trilulilu.ro/stream.php?type=video' 
  45             u
'&source=site&hash=%(hash)s&username=%(userid)s&' 
  46             u
'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
,