X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fhornbunny.py;h=5b6efb27eedfe0097cc47d96f3f287ab1858e9e8;hb=ff81c4c99c333fad4e84f1035a4f9f01c2ed9e78;hp=d07105d66749aa154f3a952eef4137a0feccd0b2;hpb=9b330db7f00bd6f4755507cc9f687958acdd2c87;p=youtube-dl diff --git a/youtube_dl/extractor/hornbunny.py b/youtube_dl/extractor/hornbunny.py index d07105d66..5b6efb27e 100644 --- a/youtube_dl/extractor/hornbunny.py +++ b/youtube_dl/extractor/hornbunny.py @@ -4,7 +4,11 @@ from __future__ import unicode_literals import re from .common import InfoExtractor -from ..utils import int_or_none +from ..utils import ( + int_or_none, + parse_duration, +) + class HornBunnyIE(InfoExtractor): _VALID_URL = r'http?://(?:www\.)?hornbunny\.com/videos/(?P[a-z-]+)-(?P\d+)\.html' @@ -24,16 +28,22 @@ class HornBunnyIE(InfoExtractor): mobj = re.match(self._VALID_URL, url) video_id = mobj.group('id') - webpage = self._download_webpage(url, video_id) - title = self._html_search_regex(r'class="title">(.*?)', webpage, 'title') - redirect_url = self._html_search_regex(r'pg&settings=(.*?)\|0"\);', webpage, 'title') + webpage = self._download_webpage( + url, video_id, note='Downloading initial webpage') + title = self._html_search_regex( + r'class="title">(.*?)', webpage, 'title') + redirect_url = self._html_search_regex( + r'pg&settings=(.*?)\|0"\);', webpage, 'title') webpage2 = self._download_webpage(redirect_url, video_id) - video_url = self._html_search_regex(r'flvMask:(.*?);', webpage2, 'video_url') - - mobj = re.search(r'Runtime: (?P\d+):(?P\d+)', webpage) - duration = int(mobj.group('minutes')) * 60 + int(mobj.group('seconds')) if mobj else None + video_url = self._html_search_regex( + r'flvMask:(.*?);', webpage2, 'video_url') - view_count = self._html_search_regex(r'Views: (\d+)', webpage, 'view count', fatal=False) + duration = parse_duration(self._search_regex( + r'Runtime:\s*([0-9:]+)', + webpage, 'duration', fatal=False)) + view_count = int_or_none(self._search_regex( + r'Views:\s*(\d+)', + webpage, 'view count', fatal=False)) return { 'id': video_id, @@ -41,6 +51,6 @@ class HornBunnyIE(InfoExtractor): 'title': title, 'ext': 'flv', 'duration': duration, - 'view_count': int_or_none(view_count), + 'view_count': view_count, 'age_limit': 18, }