]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/redtube.py
   1 from __future__ 
import unicode_literals
 
   3 from .common 
import InfoExtractor
 
   4 from ..utils 
import ExtractorError
 
   7 class RedTubeIE(InfoExtractor
): 
   8     _VALID_URL 
= r
'http://(?:www\.)?redtube\.com/(?P<id>[0-9]+)' 
  10         'url': 'http://www.redtube.com/66418', 
  11         'md5': '7b8c22b5e7098a3e1c09709df1126d2d', 
  15             'title': 'Sucked on a toilet', 
  20     def _real_extract(self
, url
): 
  21         video_id 
= self
._match
_id
(url
) 
  22         webpage 
= self
._download
_webpage
(url
, video_id
) 
  24         if any(s 
in webpage 
for s 
in ['video-deleted-info', '>This video has been removed']): 
  25             raise ExtractorError('Video %s has been removed' % video_id
, expected
=True) 
  27         video_url 
= self
._html
_search
_regex
( 
  28             r
'<source src="(.+?)" type="video/mp4">', webpage
, 'video URL') 
  29         video_title 
= self
._html
_search
_regex
( 
  30             r
'<h1 class="videoTitle[^"]*">(.+?)</h1>', 
  32         video_thumbnail 
= self
._og
_search
_thumbnail
(webpage
) 
  34         # No self-labeling, but they describe themselves as 
  35         # "Home of Videos Porno" 
  43             'thumbnail': video_thumbnail
, 
  44             'age_limit': age_limit
,