]> jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/pornoxo.py
[ie/youtube] Suppress "Unavailable videos are hidden" warning (#10159)
[yt-dlp.git] / yt_dlp / extractor / pornoxo.py
1 from .common import InfoExtractor
2 from ..utils import (
3 str_to_int,
4 )
5
6
7 class PornoXOIE(InfoExtractor):
8 _WORKING = False
9 _VALID_URL = r'https?://(?:www\.)?pornoxo\.com/videos/(?P<id>\d+)/(?P<display_id>[^/]+)\.html'
10 _TEST = {
11 'url': 'http://www.pornoxo.com/videos/7564/striptease-from-sexy-secretary.html',
12 'md5': '582f28ecbaa9e6e24cb90f50f524ce87',
13 'info_dict': {
14 'id': '7564',
15 'ext': 'flv',
16 'title': 'Striptease From Sexy Secretary!',
17 'display_id': 'striptease-from-sexy-secretary',
18 'description': 'md5:0ee35252b685b3883f4a1d38332f9980',
19 'categories': list, # NSFW
20 'thumbnail': r're:https?://.*\.jpg$',
21 'age_limit': 18,
22 },
23 }
24
25 def _real_extract(self, url):
26 mobj = self._match_valid_url(url)
27 video_id, display_id = mobj.groups()
28
29 webpage = self._download_webpage(url, video_id)
30 video_data = self._extract_jwplayer_data(webpage, video_id, require_title=False)
31
32 title = self._html_search_regex(
33 r'<title>([^<]+)\s*-\s*PornoXO', webpage, 'title')
34
35 view_count = str_to_int(self._html_search_regex(
36 r'[vV]iews:\s*([0-9,]+)', webpage, 'view count', fatal=False))
37
38 categories_str = self._html_search_regex(
39 r'<meta name="description" content=".*featuring\s*([^"]+)"',
40 webpage, 'categories', fatal=False)
41 categories = (
42 None if categories_str is None
43 else categories_str.split(','))
44
45 video_data.update({
46 'id': video_id,
47 'title': title,
48 'display_id': display_id,
49 'description': self._html_search_meta('description', webpage),
50 'categories': categories,
51 'view_count': view_count,
52 'age_limit': 18,
53 })
54
55 return video_data