From fe168c63bb3147365358f7b19ddd68e448b3537d Mon Sep 17 00:00:00 2001 From: JChris246 Date: Tue, 30 Jun 2020 00:36:00 -0400 Subject: [PATCH 1/3] [sexlikereal] Add new extractor --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/sexlikereal.py | 61 +++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 youtube_dl/extractor/sexlikereal.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 4b3092028..efa4595c4 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -989,6 +989,7 @@ from .senateisvp import SenateISVPIE from .sendtonews import SendtoNewsIE from .servus import ServusIE from .sevenplus import SevenPlusIE +from .sexlikereal import SexLikeRealIE from .sexu import SexuIE from .seznamzpravy import ( SeznamZpravyIE, diff --git a/youtube_dl/extractor/sexlikereal.py b/youtube_dl/extractor/sexlikereal.py new file mode 100644 index 000000000..ada2721dc --- /dev/null +++ b/youtube_dl/extractor/sexlikereal.py @@ -0,0 +1,61 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + determine_ext, + js_to_json, +) + + +class SexLikeRealIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?sexlikereal\.com/scenes/(?P[^/]*)-(?P\d+)' + _TEST = { + 'url': 'https://www.sexlikereal.com/scenes/wet-college-student-7208', + 'md5': '48e3ac422b783ececec418b12e2ccb56', + 'info_dict': { + 'id': '7208', + 'ext': 'mp4', + 'title': 'Wet College Student', + 'thumbnail': 'https://cdn-vr.sexlikereal.com/images/7208/vr-porn-Wet-College-Student-cover-app.jpg', + 'display_id': "wet-college-student", + 'duration': 122, + } + } + + def _real_extract(self, url): + video_id = self._match_id(url) + + mobj = re.match(self._VALID_URL, url) + display_id = mobj.group('display_id') + webpage = self._download_webpage(url, video_id) + + # TODO more code goes here, for example ... + + video_data = self._parse_json( + self._search_regex( + r'window\.vrPlayerSettings\s*=\s*({[^;]+});', + webpage, 'video_data'), + video_id, transform_source=js_to_json)["videoData"] + + title = video_data.get("title") + + formats = [] + for quality in video_data['src']: + formats.append({ + 'url': quality['url'], + 'ext': determine_ext(quality['mimeType'], 'mp4'), + 'format_id': quality['quality'] + }) + + return { + 'id': video_id, + 'display_id': display_id, + 'title': title, + 'thumbnail': video_data.get('posterURL'), + 'like_count': video_data.get('likes'), + 'duration': video_data.get('duration'), + 'formats': formats, + } From f17bcef1925ee27329a1a78ea8e1e038b87f4366 Mon Sep 17 00:00:00 2001 From: JChris246 Date: Tue, 30 Jun 2020 20:13:54 -0400 Subject: [PATCH 2/3] Made some changes to conform with coding conventions --- youtube_dl/extractor/sexlikereal.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/youtube_dl/extractor/sexlikereal.py b/youtube_dl/extractor/sexlikereal.py index ada2721dc..62c708ed9 100644 --- a/youtube_dl/extractor/sexlikereal.py +++ b/youtube_dl/extractor/sexlikereal.py @@ -6,6 +6,8 @@ import re from .common import InfoExtractor from ..utils import ( determine_ext, + float_or_none, + int_or_none, js_to_json, ) @@ -32,15 +34,15 @@ class SexLikeRealIE(InfoExtractor): display_id = mobj.group('display_id') webpage = self._download_webpage(url, video_id) - # TODO more code goes here, for example ... - video_data = self._parse_json( self._search_regex( r'window\.vrPlayerSettings\s*=\s*({[^;]+});', - webpage, 'video_data'), - video_id, transform_source=js_to_json)["videoData"] + webpage, 'video_data' + ), video_id, transform_source=js_to_json + )["videoData"] - title = video_data.get("title") + title = (video_data["title"] or (self._html_search_meta('twitter:title', + webpage, 'description')).split('-')[0].strip()) formats = [] for quality in video_data['src']: @@ -50,12 +52,15 @@ class SexLikeRealIE(InfoExtractor): 'format_id': quality['quality'] }) + like_count = int_or_none(video_data.get('likes')) + duration = float_or_none(video_data.get('duration')) + return { 'id': video_id, 'display_id': display_id, 'title': title, 'thumbnail': video_data.get('posterURL'), - 'like_count': video_data.get('likes'), - 'duration': video_data.get('duration'), + 'like_count': like_count, + 'duration': duration, 'formats': formats, } From 96d526a2893f19bb55224701f3c9e454ed6ae08a Mon Sep 17 00:00:00 2001 From: JChris246 Date: Tue, 30 Jun 2020 20:21:14 -0400 Subject: [PATCH 3/3] Added description extraction --- youtube_dl/extractor/sexlikereal.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/sexlikereal.py b/youtube_dl/extractor/sexlikereal.py index 62c708ed9..cdf0d3272 100644 --- a/youtube_dl/extractor/sexlikereal.py +++ b/youtube_dl/extractor/sexlikereal.py @@ -42,7 +42,7 @@ class SexLikeRealIE(InfoExtractor): )["videoData"] title = (video_data["title"] or (self._html_search_meta('twitter:title', - webpage, 'description')).split('-')[0].strip()) + webpage, 'title')).split('-')[0].strip()) formats = [] for quality in video_data['src']: @@ -55,6 +55,10 @@ class SexLikeRealIE(InfoExtractor): like_count = int_or_none(video_data.get('likes')) duration = float_or_none(video_data.get('duration')) + description = self._html_search_meta( + ['description', 'twitter:description'], webpage, 'description' + ) + return { 'id': video_id, 'display_id': display_id, @@ -62,5 +66,6 @@ class SexLikeRealIE(InfoExtractor): 'thumbnail': video_data.get('posterURL'), 'like_count': like_count, 'duration': duration, + 'description': description, 'formats': formats, }