Skip to content

Commit

Permalink
[spankbang] Fix and improve metadata extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
dstftw committed Jul 13, 2019
1 parent 5f562bd commit f9eeeda
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions youtube_dl/extractor/spankbang.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from .common import InfoExtractor
from ..utils import (
ExtractorError,
merge_dicts,
orderedSet,
parse_duration,
parse_resolution,
Expand All @@ -26,6 +27,8 @@ class SpankBangIE(InfoExtractor):
'description': 'dillion harper masturbates on a bed',
'thumbnail': r're:^https?://.*\.jpg$',
'uploader': 'silly2587',
'timestamp': 1422571989,
'upload_date': '20150129',
'age_limit': 18,
}
}, {
Expand Down Expand Up @@ -113,34 +116,38 @@ def extract_format(format_id, format_url):

self._sort_formats(formats)

info = self._search_json_ld(webpage, video_id, default={})

title = self._html_search_regex(
r'(?s)<h1[^>]*>(.+?)</h1>', webpage, 'title')
r'(?s)<h1[^>]*>(.+?)</h1>', webpage, 'title', default=None)
description = self._search_regex(
r'<div[^>]+\bclass=["\']bottom[^>]+>\s*<p>[^<]*</p>\s*<p>([^<]+)',
webpage, 'description', fatal=False)
thumbnail = self._og_search_thumbnail(webpage)
uploader = self._search_regex(
r'class="user"[^>]*><img[^>]+>([^<]+)',
webpage, 'description', default=None)
thumbnail = self._og_search_thumbnail(webpage, default=None)
uploader = self._html_search_regex(
(r'(?s)<li[^>]+class=["\']profile[^>]+>(.+?)</a>',
r'class="user"[^>]*><img[^>]+>([^<]+)'),
webpage, 'uploader', default=None)
duration = parse_duration(self._search_regex(
r'<div[^>]+\bclass=["\']right_side[^>]+>\s*<span>([^<]+)',
webpage, 'duration', fatal=False))
webpage, 'duration', default=None))
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)

return {
return merge_dicts({
'id': video_id,
'title': title,
'title': title or video_id,
'description': description,
'thumbnail': thumbnail,
'uploader': uploader,
'duration': duration,
'view_count': view_count,
'formats': formats,
'age_limit': age_limit,
}
}, info
)


class SpankBangPlaylistIE(InfoExtractor):
Expand Down

0 comments on commit f9eeeda

Please sign in to comment.