From f901daedf6a30454bfa65f418bfcb5d6e8e4a4a7 Mon Sep 17 00:00:00 2001 From: Kevin Laube Date: Tue, 7 Jan 2020 13:44:59 +0100 Subject: [PATCH 1/4] regex fix for newer urls --- youtube_dl/extractor/youporn.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/youporn.py b/youtube_dl/extractor/youporn.py index d4eccb4b2..3c4e579ca 100644 --- a/youtube_dl/extractor/youporn.py +++ b/youtube_dl/extractor/youporn.py @@ -119,8 +119,9 @@ class YouPornIE(InfoExtractor): # Video URL's path looks like this: # /201012/17/505835/720p_1500k_505835/YouPorn%20-%20Sex%20Ed%20Is%20It%20Safe%20To%20Masturbate%20Daily.mp4 # /201012/17/505835/vl_240p_240k_505835/YouPorn%20-%20Sex%20Ed%20Is%20It%20Safe%20To%20Masturbate%20Daily.mp4 + # /201909/10/247477171/720P_1500K_247477171.mp4?rate=350k&burst=1600k&validfrom=1578384700&validto=1578399100&hash=0pse1EbrOQbQF%2FJjZgeLX4K%2F0qw%3D # We will benefit from it by extracting some metadata - mobj = re.search(r'(?P\d{3,4})[pP]_(?P\d+)[kK]_\d+/', video_url) + mobj = re.search(r'(?P\d{3,4})[pP]_(?P\d+)[kK]_\d+', video_url) if mobj: height = int(mobj.group('height')) bitrate = int(mobj.group('bitrate')) From 748df3d606dddf9f80c767a285e4894f55398e2f Mon Sep 17 00:00:00 2001 From: Kevin Laube Date: Mon, 13 Jan 2020 09:58:15 +0100 Subject: [PATCH 2/4] added test case; fixed upload date extraction regex --- youtube_dl/extractor/youporn.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/youporn.py b/youtube_dl/extractor/youporn.py index 3c4e579ca..425d70f2f 100644 --- a/youtube_dl/extractor/youporn.py +++ b/youtube_dl/extractor/youporn.py @@ -57,7 +57,27 @@ class YouPornIE(InfoExtractor): 'params': { 'skip_download': True, }, - }] + }, { + # the source urls in the "formats" array of newer videos might have a new format + 'url': 'https://www.youporn.com/watch/15573378/visit-x-unschuldiges-deutsches-luder-bekommt-hintern-versohlen/', + 'md5': '3744d24c50438cf5b6f6d59feb5055c2', + 'info_dict': { + 'id': '15573378', + 'display_id': 'visit-x-unschuldiges-deutsches-luder-bekommt-hintern-versohlen', + 'ext': 'mp4', + 'title': 'VISIT-X | Unschuldiges deutsches Luder bekommt Hintern versohlen', + 'description': 'Watch VISIT-X | Unschuldiges deutsches Luder bekommt Hintern versohlen online on YouPorn.com. YouPorn is the largest Blowjob porn video site with the hottest selection of free, high quality german movies. Enjoy our HD porno videos on any device of your choosing!', + 'thumbnail': r're:^https?://.*\.jpg$', + 'uploader': 'Visit-X', + 'upload_date': '20190910', + 'average_rating': int, + 'view_count': int, + 'comment_count': int, + 'categories': list, + 'tags': list, + 'age_limit': 18, + }, + }] def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) @@ -147,7 +167,7 @@ class YouPornIE(InfoExtractor): webpage, 'uploader', fatal=False) upload_date = unified_strdate(self._html_search_regex( [r'Date\s+[Aa]dded:\s*([^<]+)', - r'(?s)]+class=["\']videoInfo(?:Date|Time)["\'][^>]*>(.+?)'], + r'(?s)]+class=["\']video-uploaded["\'][^>]*>[^<]+?([^<]+)'], webpage, 'upload date', fatal=False)) age_limit = self._rta_search(webpage) From 38fd4dea75932dc0b50003e94326b5585102f03c Mon Sep 17 00:00:00 2001 From: Kevin Laube Date: Wed, 15 Jan 2020 07:36:39 +0100 Subject: [PATCH 3/4] added old upload_date pattern --- youtube_dl/extractor/youporn.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/youporn.py b/youtube_dl/extractor/youporn.py index 425d70f2f..953099053 100644 --- a/youtube_dl/extractor/youporn.py +++ b/youtube_dl/extractor/youporn.py @@ -167,7 +167,8 @@ class YouPornIE(InfoExtractor): webpage, 'uploader', fatal=False) upload_date = unified_strdate(self._html_search_regex( [r'Date\s+[Aa]dded:\s*([^<]+)', - r'(?s)]+class=["\']video-uploaded["\'][^>]*>[^<]+?([^<]+)'], + r'(?s)]+class=["\']video-uploaded["\'][^>]*>[^<]+?([^<]+)', + r'(?s)]+class=["\']videoInfo(?:Date|Time)["\'][^>]*>(.+?)'], webpage, 'upload date', fatal=False)) age_limit = self._rta_search(webpage) From 2d6b7beec1efdd8a6efc32335843f7edc5b35f3b Mon Sep 17 00:00:00 2001 From: Kevin Laube Date: Wed, 15 Jan 2020 07:57:36 +0100 Subject: [PATCH 4/4] fixed indentation --- youtube_dl/extractor/youporn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/youporn.py b/youtube_dl/extractor/youporn.py index 953099053..93ca7dc16 100644 --- a/youtube_dl/extractor/youporn.py +++ b/youtube_dl/extractor/youporn.py @@ -77,7 +77,7 @@ class YouPornIE(InfoExtractor): 'tags': list, 'age_limit': 18, }, - }] + }] def _real_extract(self, url): mobj = re.match(self._VALID_URL, url)