From ea755fa9ee703a57a30362136ff144e0b2dfa5d0 Mon Sep 17 00:00:00 2001 From: JChris246 <43832407+JChris246@users.noreply.github.com> Date: Thu, 24 Jan 2019 21:55:45 -0400 Subject: [PATCH 1/5] Fixed Extractor and added duration Fixed extractor to return the correct video url Extractor now pulls duration --- youtube_dl/extractor/yourporn.py | 35 +++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) 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 } From d279d07634832cc6a3d4c9bb1aaccae304f00fda Mon Sep 17 00:00:00 2001 From: JChris246 <43832407+JChris246@users.noreply.github.com> Date: Fri, 25 Jan 2019 11:41:05 -0400 Subject: [PATCH 2/5] changed to utils.parse_duration changed to utils.parse_duration removed striping # --- youtube_dl/extractor/yourporn.py | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/youtube_dl/extractor/yourporn.py b/youtube_dl/extractor/yourporn.py index ef32199bd..3cf91ecb9 100644 --- a/youtube_dl/extractor/yourporn.py +++ b/youtube_dl/extractor/yourporn.py @@ -1,5 +1,7 @@ from __future__ import unicode_literals +from youtube_dl import utils + from .common import InfoExtractor from ..utils import urljoin @@ -30,15 +32,6 @@ class YourPornIE(InfoExtractor): } }] - 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) @@ -53,15 +46,11 @@ class YourPornIE(InfoExtractor): 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')) - + duration = utils.parse_duration(self._search_regex(r'Video Info -> duration:([0-9:]+)', + webpage, 'duration')) return { 'id': video_id, 'url': video_url, From bb53839e100ea4e1e1a8ad4534878bd0c5d99e8b Mon Sep 17 00:00:00 2001 From: JChris246 <43832407+JChris246@users.noreply.github.com> Date: Sat, 26 Jan 2019 13:42:31 -0400 Subject: [PATCH 3/5] Fixed import --- youtube_dl/extractor/yourporn.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/youtube_dl/extractor/yourporn.py b/youtube_dl/extractor/yourporn.py index 3cf91ecb9..e58561854 100644 --- a/youtube_dl/extractor/yourporn.py +++ b/youtube_dl/extractor/yourporn.py @@ -1,9 +1,7 @@ from __future__ import unicode_literals -from youtube_dl import utils - from .common import InfoExtractor -from ..utils import urljoin +from ..utils import (urljoin, parse_duration) class YourPornIE(InfoExtractor): @@ -49,8 +47,8 @@ class YourPornIE(InfoExtractor): thumbnail = self._og_search_thumbnail(webpage) - duration = utils.parse_duration(self._search_regex(r'Video Info -> duration:([0-9:]+)', - webpage, 'duration')) + duration = parse_duration(self._search_regex(r'Video Info -> duration:([0-9:]+)', + webpage, 'duration')) return { 'id': video_id, 'url': video_url, @@ -58,4 +56,4 @@ class YourPornIE(InfoExtractor): 'duration': duration, 'thumbnail': thumbnail, 'age_limit': 18 - } + } \ No newline at end of file From 547471ead51924ce093c4ab8f1598601bf036819 Mon Sep 17 00:00:00 2001 From: JChris246 <43832407+JChris246@users.noreply.github.com> Date: Sat, 26 Jan 2019 13:50:51 -0400 Subject: [PATCH 4/5] Wont fail if description not found --- youtube_dl/extractor/yourporn.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/yourporn.py b/youtube_dl/extractor/yourporn.py index e58561854..0684d95a7 100644 --- a/youtube_dl/extractor/yourporn.py +++ b/youtube_dl/extractor/yourporn.py @@ -48,7 +48,7 @@ class YourPornIE(InfoExtractor): thumbnail = self._og_search_thumbnail(webpage) duration = parse_duration(self._search_regex(r'Video Info -> duration:([0-9:]+)', - webpage, 'duration')) + webpage, 'duration', default=None)) return { 'id': video_id, 'url': video_url, @@ -56,4 +56,4 @@ class YourPornIE(InfoExtractor): 'duration': duration, 'thumbnail': thumbnail, 'age_limit': 18 - } \ No newline at end of file + } From f0bc4aa39c771b8e6f03dcfb0d5a2985a745d0a9 Mon Sep 17 00:00:00 2001 From: JChris246 <43832407+JChris246@users.noreply.github.com> Date: Sat, 26 Jan 2019 18:30:17 -0400 Subject: [PATCH 5/5] Fixed requests Removed test sorted util imports edited duration regex --- youtube_dl/extractor/yourporn.py | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/youtube_dl/extractor/yourporn.py b/youtube_dl/extractor/yourporn.py index 0684d95a7..01e5f0c0e 100644 --- a/youtube_dl/extractor/yourporn.py +++ b/youtube_dl/extractor/yourporn.py @@ -1,12 +1,15 @@ from __future__ import unicode_literals from .common import InfoExtractor -from ..utils import (urljoin, parse_duration) +from ..utils import ( + parse_duration, + urljoin +) class YourPornIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?yourporn\.sexy/post/(?P[^/?#&.]+)' - _TESTS = [{ + _TEST = { 'url': 'https://yourporn.sexy/post/57ffcb2e1179b.html', 'md5': '6f8682b6464033d87acaa7a8ff0c092e', 'info_dict': { @@ -16,19 +19,7 @@ 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 _real_extract(self, url): video_id = self._match_id(url) @@ -47,7 +38,7 @@ class YourPornIE(InfoExtractor): thumbnail = self._og_search_thumbnail(webpage) - duration = parse_duration(self._search_regex(r'Video Info -> duration:([0-9:]+)', + duration = parse_duration(self._search_regex(r'duration:[^0-9]*([0-9:]+)', webpage, 'duration', default=None)) return { 'id': video_id,