[ie/wistia] Support password-protected videos (#11100)
[yt-dlp3.git] / yt_dlp / extractor / hellporno.py
blobfa32b27c8cf2e5a92703c7132d4f5b4fa6247eba
1 from .common import InfoExtractor
2 from ..utils import (
3 int_or_none,
4 merge_dicts,
5 remove_end,
6 unified_timestamp,
10 class HellPornoIE(InfoExtractor):
11 _VALID_URL = r'https?://(?:www\.)?hellporno\.(?:com/videos|net/v)/(?P<id>[^/]+)'
12 _TESTS = [{
13 'url': 'http://hellporno.com/videos/dixie-is-posing-with-naked-ass-very-erotic/',
14 'md5': 'f0a46ebc0bed0c72ae8fe4629f7de5f3',
15 'info_dict': {
16 'id': '149116',
17 'display_id': 'dixie-is-posing-with-naked-ass-very-erotic',
18 'ext': 'mp4',
19 'title': 'Dixie is posing with naked ass very erotic',
20 'description': 'md5:9a72922749354edb1c4b6e540ad3d215',
21 'categories': list,
22 'thumbnail': r're:https?://.*\.jpg$',
23 'duration': 240,
24 'timestamp': 1398762720,
25 'upload_date': '20140429',
26 'view_count': int,
27 'age_limit': 18,
29 }, {
30 'url': 'http://hellporno.net/v/186271/',
31 'only_matching': True,
34 def _real_extract(self, url):
35 display_id = self._match_id(url)
37 webpage = self._download_webpage(url, display_id)
39 title = remove_end(self._html_extract_title(webpage), ' - Hell Porno')
41 info = self._parse_html5_media_entries(url, webpage, display_id)[0]
43 video_id = self._search_regex(
44 (r'chs_object\s*=\s*["\'](\d+)',
45 r'params\[["\']video_id["\']\]\s*=\s*(\d+)'), webpage, 'video id',
46 default=display_id)
47 description = self._search_regex(
48 r'class=["\']desc_video_view_v2[^>]+>([^<]+)', webpage,
49 'description', fatal=False)
50 categories = [
51 c.strip()
52 for c in self._html_search_meta(
53 'keywords', webpage, 'categories', default='').split(',')
54 if c.strip()]
55 duration = int_or_none(self._og_search_property(
56 'video:duration', webpage, fatal=False))
57 timestamp = unified_timestamp(self._og_search_property(
58 'video:release_date', webpage, fatal=False))
59 view_count = int_or_none(self._search_regex(
60 r'>Views\s+(\d+)', webpage, 'view count', fatal=False))
62 return merge_dicts(info, {
63 'id': video_id,
64 'display_id': display_id,
65 'title': title,
66 'description': description,
67 'categories': categories,
68 'duration': duration,
69 'timestamp': timestamp,
70 'view_count': view_count,
71 'age_limit': 18,