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