]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/hornbunny.py
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
  13 class HornBunnyIE(InfoExtractor
): 
  14     _VALID_URL 
= r
'http?://(?:www\.)?hornbunny\.com/videos/(?P<title_dash>[a-z-]+)-(?P<id>\d+)\.html' 
  16         'url': 'http://hornbunny.com/videos/panty-slut-jerk-off-instruction-5227.html', 
  17         'md5': '95e40865aedd08eff60272b704852ad7', 
  21             'title': 'panty slut jerk off instruction', 
  27     def _real_extract(self
, url
): 
  28         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  29         video_id 
= mobj
.group('id') 
  31         webpage 
= self
._download
_webpage
( 
  32             url
, video_id
, note
='Downloading initial webpage') 
  33         title 
= self
._html
_search
_regex
( 
  34             r
'class="title">(.*?)</h2>', webpage
, 'title') 
  35         redirect_url 
= self
._html
_search
_regex
( 
  36             r
'pg&settings=(.*?)\|0"\);', webpage
, 'title') 
  37         webpage2 
= self
._download
_webpage
(redirect_url
, video_id
) 
  38         video_url 
= self
._html
_search
_regex
( 
  39             r
'flvMask:(.*?);', webpage2
, 'video_url') 
  41         duration 
= parse_duration(self
._search
_regex
( 
  42             r
'<strong>Runtime:</strong>\s*([0-9:]+)</div>', 
  43             webpage
, 'duration', fatal
=False)) 
  44         view_count 
= int_or_none(self
._search
_regex
( 
  45             r
'<strong>Views:</strong>\s*(\d+)</div>', 
  46             webpage
, 'view count', fatal
=False)) 
  54             'view_count': view_count
,