]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/redtube.py
4295cf93a75188844bfe0838789e2efcb4363229
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
   8 class RedTubeIE(InfoExtractor
): 
   9     _VALID_URL 
= r
'http://(?:www\.)?redtube\.com/(?P<id>[0-9]+)' 
  11         'url': 'http://www.redtube.com/66418', 
  13         # md5 varies from time to time, as in 
  14         # https://travis-ci.org/rg3/youtube-dl/jobs/14052463#L295 
  15         #'md5': u'7b8c22b5e7098a3e1c09709df1126d2d', 
  17             "title": "Sucked on a toilet", 
  22     def _real_extract(self
, url
): 
  23         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  25         video_id 
= mobj
.group('id') 
  26         video_extension 
= 'mp4' 
  27         webpage 
= self
._download
_webpage
(url
, video_id
) 
  29         self
.report_extraction(video_id
) 
  31         video_url 
= self
._html
_search
_regex
( 
  32             r
'<source src="(.+?)" type="video/mp4">', webpage
, u
'video URL') 
  34         video_title 
= self
._html
_search
_regex
( 
  35             r
'<h1 class="videoTitle[^"]*">(.+?)</h1>', 
  38         video_thumbnail 
= self
._html
_search
_regex
( 
  39             r
'playerInnerHTML.+?<img\s+src="(.+?)"', 
  40             webpage
, u
'thumbnail', fatal
=False) 
  42         # No self-labeling, but they describe themselves as 
  43         # "Home of Videos Porno" 
  49             'ext': video_extension
, 
  51             'thumbnail': video_thumbnail
, 
  52             'age_limit': age_limit
,