mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-01-07 17:16:08 +00:00
[spankbang] Fix and improve metadata extraction
This commit is contained in:
parent
5f562bd4bb
commit
f9eeeda31c
|
@ -5,6 +5,7 @@ import re
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
|
merge_dicts,
|
||||||
orderedSet,
|
orderedSet,
|
||||||
parse_duration,
|
parse_duration,
|
||||||
parse_resolution,
|
parse_resolution,
|
||||||
|
@ -26,6 +27,8 @@ class SpankBangIE(InfoExtractor):
|
||||||
'description': 'dillion harper masturbates on a bed',
|
'description': 'dillion harper masturbates on a bed',
|
||||||
'thumbnail': r're:^https?://.*\.jpg$',
|
'thumbnail': r're:^https?://.*\.jpg$',
|
||||||
'uploader': 'silly2587',
|
'uploader': 'silly2587',
|
||||||
|
'timestamp': 1422571989,
|
||||||
|
'upload_date': '20150129',
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
@ -113,26 +116,29 @@ class SpankBangIE(InfoExtractor):
|
||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
info = self._search_json_ld(webpage, video_id, default={})
|
||||||
|
|
||||||
title = self._html_search_regex(
|
title = self._html_search_regex(
|
||||||
r'(?s)<h1[^>]*>(.+?)</h1>', webpage, 'title')
|
r'(?s)<h1[^>]*>(.+?)</h1>', webpage, 'title', default=None)
|
||||||
description = self._search_regex(
|
description = self._search_regex(
|
||||||
r'<div[^>]+\bclass=["\']bottom[^>]+>\s*<p>[^<]*</p>\s*<p>([^<]+)',
|
r'<div[^>]+\bclass=["\']bottom[^>]+>\s*<p>[^<]*</p>\s*<p>([^<]+)',
|
||||||
webpage, 'description', fatal=False)
|
webpage, 'description', default=None)
|
||||||
thumbnail = self._og_search_thumbnail(webpage)
|
thumbnail = self._og_search_thumbnail(webpage, default=None)
|
||||||
uploader = self._search_regex(
|
uploader = self._html_search_regex(
|
||||||
r'class="user"[^>]*><img[^>]+>([^<]+)',
|
(r'(?s)<li[^>]+class=["\']profile[^>]+>(.+?)</a>',
|
||||||
|
r'class="user"[^>]*><img[^>]+>([^<]+)'),
|
||||||
webpage, 'uploader', default=None)
|
webpage, 'uploader', default=None)
|
||||||
duration = parse_duration(self._search_regex(
|
duration = parse_duration(self._search_regex(
|
||||||
r'<div[^>]+\bclass=["\']right_side[^>]+>\s*<span>([^<]+)',
|
r'<div[^>]+\bclass=["\']right_side[^>]+>\s*<span>([^<]+)',
|
||||||
webpage, 'duration', fatal=False))
|
webpage, 'duration', default=None))
|
||||||
view_count = str_to_int(self._search_regex(
|
view_count = str_to_int(self._search_regex(
|
||||||
r'([\d,.]+)\s+plays', webpage, 'view count', fatal=False))
|
r'([\d,.]+)\s+plays', webpage, 'view count', default=None))
|
||||||
|
|
||||||
age_limit = self._rta_search(webpage)
|
age_limit = self._rta_search(webpage)
|
||||||
|
|
||||||
return {
|
return merge_dicts({
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': title,
|
'title': title or video_id,
|
||||||
'description': description,
|
'description': description,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
'uploader': uploader,
|
'uploader': uploader,
|
||||||
|
@ -140,7 +146,8 @@ class SpankBangIE(InfoExtractor):
|
||||||
'view_count': view_count,
|
'view_count': view_count,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'age_limit': age_limit,
|
'age_limit': age_limit,
|
||||||
}
|
}, info
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class SpankBangPlaylistIE(InfoExtractor):
|
class SpankBangPlaylistIE(InfoExtractor):
|
||||||
|
|
Loading…
Reference in a new issue