mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-12-23 12:40:11 +09:00
[pornoxo] Use JWPlatform to improve metadata extraction
This commit is contained in:
parent
e295618f9e
commit
567a5996ca
@ -2,13 +2,13 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .jwplatform import JWPlatformBaseIE
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
str_to_int,
|
str_to_int,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class PornoXOIE(InfoExtractor):
|
class PornoXOIE(JWPlatformBaseIE):
|
||||||
_VALID_URL = r'https?://(?:www\.)?pornoxo\.com/videos/(?P<id>\d+)/(?P<display_id>[^/]+)\.html'
|
_VALID_URL = r'https?://(?:www\.)?pornoxo\.com/videos/(?P<id>\d+)/(?P<display_id>[^/]+)\.html'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://www.pornoxo.com/videos/7564/striptease-from-sexy-secretary.html',
|
'url': 'http://www.pornoxo.com/videos/7564/striptease-from-sexy-secretary.html',
|
||||||
@ -17,7 +17,8 @@ class PornoXOIE(InfoExtractor):
|
|||||||
'id': '7564',
|
'id': '7564',
|
||||||
'ext': 'flv',
|
'ext': 'flv',
|
||||||
'title': 'Striptease From Sexy Secretary!',
|
'title': 'Striptease From Sexy Secretary!',
|
||||||
'description': 'Striptease From Sexy Secretary!',
|
'display_id': 'striptease-from-sexy-secretary',
|
||||||
|
'description': 'md5:0ee35252b685b3883f4a1d38332f9980',
|
||||||
'categories': list, # NSFW
|
'categories': list, # NSFW
|
||||||
'thumbnail': 're:https?://.*\.jpg$',
|
'thumbnail': 're:https?://.*\.jpg$',
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
@ -26,23 +27,14 @@ class PornoXOIE(InfoExtractor):
|
|||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group('id')
|
video_id, display_id = mobj.groups()
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
video_data = self._extract_jwplayer_data(webpage, video_id, require_title=False)
|
||||||
video_url = self._html_search_regex(
|
|
||||||
r'\'file\'\s*:\s*"([^"]+)"', webpage, 'video_url')
|
|
||||||
|
|
||||||
title = self._html_search_regex(
|
title = self._html_search_regex(
|
||||||
r'<title>([^<]+)\s*-\s*PornoXO', webpage, 'title')
|
r'<title>([^<]+)\s*-\s*PornoXO', webpage, 'title')
|
||||||
|
|
||||||
description = self._html_search_regex(
|
|
||||||
r'<meta name="description" content="([^"]+)\s*featuring',
|
|
||||||
webpage, 'description', fatal=False)
|
|
||||||
|
|
||||||
thumbnail = self._html_search_regex(
|
|
||||||
r'\'image\'\s*:\s*"([^"]+)"', webpage, 'thumbnail', fatal=False)
|
|
||||||
|
|
||||||
view_count = str_to_int(self._html_search_regex(
|
view_count = str_to_int(self._html_search_regex(
|
||||||
r'[vV]iews:\s*([0-9,]+)', webpage, 'view count', fatal=False))
|
r'[vV]iews:\s*([0-9,]+)', webpage, 'view count', fatal=False))
|
||||||
|
|
||||||
@ -53,13 +45,14 @@ class PornoXOIE(InfoExtractor):
|
|||||||
None if categories_str is None
|
None if categories_str is None
|
||||||
else categories_str.split(','))
|
else categories_str.split(','))
|
||||||
|
|
||||||
return {
|
video_data.update({
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
|
||||||
'title': title,
|
'title': title,
|
||||||
'description': description,
|
'display_id': display_id,
|
||||||
'thumbnail': thumbnail,
|
'description': self._html_search_meta('description', webpage),
|
||||||
'categories': categories,
|
'categories': categories,
|
||||||
'view_count': view_count,
|
'view_count': view_count,
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
}
|
})
|
||||||
|
|
||||||
|
return video_data
|
||||||
|
Loading…
Reference in New Issue
Block a user