From 89c50fda5031b0a0c96942aec06db1b48372ee14 Mon Sep 17 00:00:00 2001 From: v-delta Date: Thu, 29 Aug 2019 16:23:39 +0200 Subject: [PATCH 1/3] [yourporn] Drop support for yourporn.sexy and fix support for sxyprn.com --- youtube_dl/extractor/yourporn.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/youtube_dl/extractor/yourporn.py b/youtube_dl/extractor/yourporn.py index 8a2d5f63b..8193bcf23 100644 --- a/youtube_dl/extractor/yourporn.py +++ b/youtube_dl/extractor/yourporn.py @@ -2,15 +2,14 @@ from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( - parse_duration, - urljoin, + parse_duration ) class YourPornIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?(?:yourporn\.sexy|sxyprn\.com)/post/(?P[^/?#&.]+)' + _VALID_URL = r'https?://(?:www\.)?sxyprn\.com/post/(?P[^/?#&.]+)' _TESTS = [{ - 'url': 'https://yourporn.sexy/post/57ffcb2e1179b.html', + 'url': 'https://sxyprn.com/post/57ffcb2e1179b.html', 'md5': '6f8682b6464033d87acaa7a8ff0c092e', 'info_dict': { 'id': '57ffcb2e1179b', @@ -33,11 +32,13 @@ class YourPornIE(InfoExtractor): webpage = self._download_webpage(url, video_id) - video_url = urljoin(url, self._parse_json( - self._search_regex( - r'data-vnfo=(["\'])(?P{.+?})\1', webpage, 'data info', - group='data'), - video_id)[video_id]).replace('/cdn/', '/cdn5/') + url_parts = self._parse_json(self._search_regex( + r'data-vnfo=(["\'])(?P{.+?})\1', webpage, 'data info', group='data'), video_id)[video_id].split("/") + + aid = self._search_regex(r'data-aid=\'(.*?)\'', webpage, 'aid') + + video_url = 'https://' + url_parts[2] + '.trafficdeposit.com/video/' + url_parts[3] + '/' + url_parts[ + 4] + '/' + url_parts[5] + '/' + aid + '/' + video_id + '.mp4' title = (self._search_regex( r'<[^>]+\bclass=["\']PostEditTA[^>]+>([^<]+)', webpage, 'title', From 6ebbe7e29b944a1304f5443031f9c13b5654a146 Mon Sep 17 00:00:00 2001 From: v-delta Date: Mon, 2 Sep 2019 08:54:02 +0200 Subject: [PATCH 2/3] Respect coding conventions better --- youtube_dl/extractor/yourporn.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/yourporn.py b/youtube_dl/extractor/yourporn.py index 8193bcf23..402da7656 100644 --- a/youtube_dl/extractor/yourporn.py +++ b/youtube_dl/extractor/yourporn.py @@ -33,12 +33,15 @@ class YourPornIE(InfoExtractor): webpage = self._download_webpage(url, video_id) url_parts = self._parse_json(self._search_regex( - r'data-vnfo=(["\'])(?P{.+?})\1', webpage, 'data info', group='data'), video_id)[video_id].split("/") + r'data-vnfo=(["\'])(?P{.+?})\1', webpage, 'data info', + group='data'), video_id)[video_id].split('/') - aid = self._search_regex(r'data-aid=\'(.*?)\'', webpage, 'aid') + aid = self._search_regex(r'data-aid=["\'](?P.+?)["\']', + webpage, 'aid') - video_url = 'https://' + url_parts[2] + '.trafficdeposit.com/video/' + url_parts[3] + '/' + url_parts[ - 4] + '/' + url_parts[5] + '/' + aid + '/' + video_id + '.mp4' + video_url = 'https://' + url_parts[2] + '.trafficdeposit.com/video/'\ + + url_parts[3] + '/' + url_parts[4] + '/' + url_parts[5]\ + + '/' + aid + '/' + video_id + '.mp4' title = (self._search_regex( r'<[^>]+\bclass=["\']PostEditTA[^>]+>([^<]+)', webpage, 'title', From fbfc2abd50f039cb14bf500f012417b2dc47a42c Mon Sep 17 00:00:00 2001 From: v-delta Date: Sun, 8 Sep 2019 18:58:34 +0200 Subject: [PATCH 3/3] [yourporn] Fix video_url with epoch and set filename extension to 'mp4' --- youtube_dl/extractor/yourporn.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/youtube_dl/extractor/yourporn.py b/youtube_dl/extractor/yourporn.py index 402da7656..b97ae9b47 100644 --- a/youtube_dl/extractor/yourporn.py +++ b/youtube_dl/extractor/yourporn.py @@ -1,5 +1,7 @@ from __future__ import unicode_literals +import time + from .common import InfoExtractor from ..utils import ( parse_duration @@ -39,9 +41,11 @@ class YourPornIE(InfoExtractor): aid = self._search_regex(r'data-aid=["\'](?P.+?)["\']', webpage, 'aid') - video_url = 'https://' + url_parts[2] + '.trafficdeposit.com/video/'\ - + url_parts[3] + '/' + url_parts[4] + '/' + url_parts[5]\ - + '/' + aid + '/' + video_id + '.mp4' + epoch = int(time.time() + 3600) + + video_url = 'https://' + url_parts[2] + '.trafficdeposit.com/vidi/' \ + + url_parts[3] + '/' + url_parts[4] + '/' + str(epoch) \ + + '/' + aid + '/' + video_id + '.vid' title = (self._search_regex( r'<[^>]+\bclass=["\']PostEditTA[^>]+>([^<]+)', webpage, 'title', @@ -58,4 +62,5 @@ class YourPornIE(InfoExtractor): 'thumbnail': thumbnail, 'duration': duration, 'age_limit': 18, + 'ext': 'mp4', }