diff --git a/youtube_dl/extractor/yourporn.py b/youtube_dl/extractor/yourporn.py index c8dc29bd8..ef32199bd 100644 --- a/youtube_dl/extractor/yourporn.py +++ b/youtube_dl/extractor/yourporn.py @@ -6,7 +6,7 @@ from ..utils import urljoin class YourPornIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?yourporn\.sexy/post/(?P[^/?#&.]+)' - _TEST = { + _TESTS = [{ 'url': 'https://yourporn.sexy/post/57ffcb2e1179b.html', 'md5': '6f8682b6464033d87acaa7a8ff0c092e', 'info_dict': { @@ -16,7 +16,28 @@ class YourPornIE(InfoExtractor): 'thumbnail': r're:^https?://.*\.jpg$', 'age_limit': 18 }, - } + }, { + 'url': 'https://yourporn.sexy/post/5c2d2fde03bc5.html', + 'md5': '3b2323fb429d3f559a11b3f22f4754af', + 'info_dict': { + 'id': '5c2d2fde03bc5', + 'ext': 'mp4', + 'title': 'Busty 7 - Nubile Films (2018) - Chanel Preston, ' + 'Crystal Swift, Jennifer Amton, Shay Evan', + 'thumbnail': r're:^https?://.*\.jpg$', + 'age_limit': 18, + 'duration': 5403 + } + }] + + def _parse_duration(self, s): + duration = 0 + size = len(s.split(":")) + j = size - 1 + for i in range(size): + duration += int(s.split(":")[i]) * (60 ** j) + j = j - 1 + return duration def _real_extract(self, url): video_id = self._match_id(url) @@ -27,17 +48,25 @@ class YourPornIE(InfoExtractor): self._search_regex( r'data-vnfo=(["\'])(?P{.+?})\1', webpage, 'data info', group='data'), - video_id)[video_id]).replace('/cdn/', '/cdn3/') + video_id)[video_id]).replace('/cdn/', '/cdn4/') title = (self._search_regex( r'<[^>]+\bclass=["\']PostEditTA[^>]+>([^<]+)', webpage, 'title', default=None) or self._og_search_description(webpage)).strip() + if '#' in title: + title = title[0:title.index('#')].strip() + thumbnail = self._og_search_thumbnail(webpage) + duration = self._parse_duration(self._search_regex( + r'Video Info -> duration:([0-9:]+)', + webpage, 'duration')) + return { 'id': video_id, 'url': video_url, 'title': title, + 'duration': duration, 'thumbnail': thumbnail, 'age_limit': 18 }