youtube-dl

Another place where youtube-dl lives on
git clone git://git.oshgnacknak.de/youtube-dl.git
Log | Files | Refs | README | LICENSE

hornbunny.py (1527B)


      1 # coding: utf-8
      2 from __future__ import unicode_literals
      3 
      4 from .common import InfoExtractor
      5 from ..utils import (
      6     int_or_none,
      7     parse_duration,
      8 )
      9 
     10 
     11 class HornBunnyIE(InfoExtractor):
     12     _VALID_URL = r'http?://(?:www\.)?hornbunny\.com/videos/(?P<title_dash>[a-z-]+)-(?P<id>\d+)\.html'
     13     _TEST = {
     14         'url': 'http://hornbunny.com/videos/panty-slut-jerk-off-instruction-5227.html',
     15         'md5': 'e20fd862d1894b67564c96f180f43924',
     16         'info_dict': {
     17             'id': '5227',
     18             'ext': 'mp4',
     19             'title': 'panty slut jerk off instruction',
     20             'duration': 550,
     21             'age_limit': 18,
     22             'view_count': int,
     23             'thumbnail': r're:^https?://.*\.jpg$',
     24         }
     25     }
     26 
     27     def _real_extract(self, url):
     28         video_id = self._match_id(url)
     29 
     30         webpage = self._download_webpage(url, video_id)
     31         title = self._og_search_title(webpage)
     32         info_dict = self._parse_html5_media_entries(url, webpage, video_id)[0]
     33 
     34         duration = parse_duration(self._search_regex(
     35             r'<strong>Runtime:</strong>\s*([0-9:]+)</div>',
     36             webpage, 'duration', fatal=False))
     37         view_count = int_or_none(self._search_regex(
     38             r'<strong>Views:</strong>\s*(\d+)</div>',
     39             webpage, 'view count', fatal=False))
     40 
     41         info_dict.update({
     42             'id': video_id,
     43             'title': title,
     44             'duration': duration,
     45             'view_count': view_count,
     46             'age_limit': 18,
     47         })
     48 
     49         return info_dict