]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/xvideos.py
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
  15 class XVideosIE(InfoExtractor
): 
  16     _VALID_URL 
= r
'https?://(?:www\.)?xvideos\.com/video(?P<id>[0-9]+)(?:.*)' 
  18         'url': 'http://www.xvideos.com/video4588838/biker_takes_his_girl', 
  19         'md5': '4b46ae6ea5e6e9086e714d883313c0c9', 
  23             'title': 'Biker Takes his Girl', 
  28     def _real_extract(self
, url
): 
  29         video_id 
= self
._match
_id
(url
) 
  30         webpage 
= self
._download
_webpage
(url
, video_id
) 
  32         mobj 
= re
.search(r
'<h1 class="inlineError">(.+?)</h1>', webpage
) 
  34             raise ExtractorError('%s said: %s' % (self
.IE_NAME
, clean_html(mobj
.group(1))), expected
=True) 
  36         video_url 
= compat_urllib_parse
.unquote( 
  37             self
._search
_regex
(r
'flv_url=(.+?)&', webpage
, 'video URL')) 
  38         video_title 
= self
._html
_search
_regex
( 
  39             r
'<title>(.*?)\s+-\s+XVID', webpage
, 'title') 
  40         video_thumbnail 
= self
._search
_regex
( 
  41             r
'url_bigthumb=(.+?)&', webpage
, 'thumbnail', fatal
=False) 
  48             'thumbnail': video_thumbnail
,