X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fhellporno.py;h=fae4251034da29dd252557f86528531b8fcb9235;hb=HEAD;hp=06f85127f206fb6303a6a1a112e4f38d166cbea3;hpb=6a1c4fbfcb57c138b8ace305127c2654844e8099;p=youtube-dl diff --git a/youtube_dl/extractor/hellporno.py b/youtube_dl/extractor/hellporno.py index 06f85127f..fae425103 100644 --- a/youtube_dl/extractor/hellporno.py +++ b/youtube_dl/extractor/hellporno.py @@ -1,56 +1,76 @@ from __future__ import unicode_literals -import re - from .common import InfoExtractor +from ..utils import ( + int_or_none, + merge_dicts, + remove_end, + unified_timestamp, +) + class HellPornoIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?hellporno\.com/videos/(?P[^/]+)' - _TEST = { + _VALID_URL = r'https?://(?:www\.)?hellporno\.(?:com/videos|net/v)/(?P[^/]+)' + _TESTS = [{ 'url': 'http://hellporno.com/videos/dixie-is-posing-with-naked-ass-very-erotic/', - 'md5': '1fee339c610d2049699ef2aa699439f1', + 'md5': 'f0a46ebc0bed0c72ae8fe4629f7de5f3', 'info_dict': { 'id': '149116', + 'display_id': 'dixie-is-posing-with-naked-ass-very-erotic', 'ext': 'mp4', 'title': 'Dixie is posing with naked ass very erotic', - 'description': 'md5:5ba02cbf31eff820147b3cc25306d89a', - 'categories': list, # NSFW - 'thumbnail': 're:https?://.*\.jpg$', + 'description': 'md5:9a72922749354edb1c4b6e540ad3d215', + 'categories': list, + 'thumbnail': r're:https?://.*\.jpg$', + 'duration': 240, + 'timestamp': 1398762720, + 'upload_date': '20140429', + 'view_count': int, 'age_limit': 18, - } - } + }, + }, { + 'url': 'http://hellporno.net/v/186271/', + 'only_matching': True, + }] def _real_extract(self, url): - webpage = self._download_webpage(url, 'main') - - video_id = self._html_search_regex(r'video_id:\s*\'([^\']+)\'', webpage, 'id') - - video_url = self._html_search_regex(r'video_url:\s*\'([^\']+)\'', webpage, 'video_url') - - ext = self._html_search_regex(r'postfix:\s*\'([^\']+)\'', webpage, 'ext')[1:] + display_id = self._match_id(url) - title = self._html_search_regex( - r'([^<]+)\s*-\s*Hell Porno', webpage, 'title') + webpage = self._download_webpage(url, display_id) - description = self._html_search_meta('description', webpage, 'description', fatal=False) + title = remove_end(self._html_search_regex( + r'([^<]+)', webpage, 'title'), ' - Hell Porno') - thumbnail = self._html_search_regex( - r'preview_url:\s*\'([^\']+)\'', - webpage, 'thumbnail', fatal=False) + info = self._parse_html5_media_entries(url, webpage, display_id)[0] + self._sort_formats(info['formats']) - categories_str = self._html_search_regex( - r']+>([^<]+)', webpage, + 'description', fatal=False) + categories = [ + c.strip() + for c in self._html_search_meta( + 'keywords', webpage, 'categories', default='').split(',') + if c.strip()] + duration = int_or_none(self._og_search_property( + 'video:duration', webpage, fatal=False)) + timestamp = unified_timestamp(self._og_search_property( + 'video:release_date', webpage, fatal=False)) + view_count = int_or_none(self._search_regex( + r'>Views\s+(\d+)', webpage, 'view count', fatal=False)) - return { + return merge_dicts(info, { 'id': video_id, - 'url': video_url, + 'display_id': display_id, 'title': title, - 'ext': ext, 'description': description, - 'thumbnail': thumbnail, 'categories': categories, + 'duration': duration, + 'timestamp': timestamp, + 'view_count': view_count, 'age_limit': 18, - } + })