]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/walla.py
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
  13 class WallaIE(InfoExtractor
): 
  14     _VALID_URL 
= r
'https?://vod\.walla\.co\.il/[^/]+/(?P<id>\d+)/(?P<display_id>.+)' 
  16         'url': 'http://vod.walla.co.il/movie/2642630/one-direction-all-for-one', 
  19             'display_id': 'one-direction-all-for-one', 
  21             'title': 'וואן דיירקשן: ההיסטריה', 
  22             'description': 'md5:de9e2512a92442574cdb0913c49bc4d8', 
  23             'thumbnail': r
're:^https?://.*\.jpg', 
  28             'skip_download': True, 
  36     def _real_extract(self
, url
): 
  37         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  38         video_id 
= mobj
.group('id') 
  39         display_id 
= mobj
.group('display_id') 
  41         video 
= self
._download
_xml
( 
  42             'http://video2.walla.co.il/?w=null/null/%s/@@/video/flv_pl' % video_id
, 
  45         item 
= video
.find('./items/item') 
  47         title 
= xpath_text(item
, './title', 'title') 
  48         description 
= xpath_text(item
, './synopsis', 'description') 
  49         thumbnail 
= xpath_text(item
, './preview_pic', 'thumbnail') 
  50         duration 
= int_or_none(xpath_text(item
, './duration', 'duration')) 
  53         for subtitle 
in item
.findall('./subtitles/subtitle'): 
  54             lang 
= xpath_text(subtitle
, './title') 
  55             subtitles
[self
._SUBTITLE
_LANGS
.get(lang
, lang
)] = [{ 
  57                 'url': xpath_text(subtitle
, './src'), 
  61         for quality 
in item
.findall('./qualities/quality'): 
  62             format_id 
= xpath_text(quality
, './title') 
  64                 'url': 'rtmp://wafla.walla.co.il/vod', 
  65                 'play_path': xpath_text(quality
, './src'), 
  66                 'player_url': 'http://isc.walla.co.il/w9/swf/video_swf/vod/WallaMediaPlayerAvod.swf', 
  69                 'format_id': xpath_text(quality
, './title'), 
  71             m 
= re
.search(r
'^(?P<height>\d+)[Pp]', format_id
) 
  73                 fmt
['height'] = int(m
.group('height')) 
  75         self
._sort
_formats
(formats
) 
  79             'display_id': display_id
, 
  81             'description': description
, 
  82             'thumbnail': thumbnail
, 
  85             'subtitles': subtitles
,