]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/xbef.py
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
  11 class XBefIE(InfoExtractor
): 
  12     _VALID_URL 
= r
'http://(?:www\.)?xbef\.com/video/(?P<id>[0-9]+)' 
  14         'url': 'http://xbef.com/video/5119-glamourous-lesbians-smoking-drinking-and-fucking', 
  15         'md5': 'a478b565baff61634a98f5e5338be995', 
  19             'title': 'md5:7358a9faef8b7b57acda7c04816f170e', 
  21             'thumbnail': 're:^http://.*\.jpg', 
  25     def _real_extract(self
, url
): 
  26         m 
= re
.match(self
._VALID
_URL
, url
) 
  27         video_id 
= m
.group('id') 
  29         webpage 
= self
._download
_webpage
(url
, video_id
) 
  30         title 
= self
._html
_search
_regex
( 
  31             r
'<h1[^>]*>(.*?)</h1>', webpage
, 'title') 
  33         config_url_enc 
= self
._download
_webpage
( 
  34             'http://xbef.com/Main/GetVideoURLEncoded/%s' % video_id
, video_id
, 
  35             note
='Retrieving config URL') 
  36         config_url 
= compat_urllib_parse
.unquote(config_url_enc
) 
  37         config 
= self
._download
_xml
( 
  38             config_url
, video_id
, note
='Retrieving config') 
  40         video_url 
= config
.find('./file').text
 
  41         thumbnail 
= config
.find('./image').text
 
  47             'thumbnail': thumbnail
,