From a1447448afa3ce7a0a4b1c69457bdcc0d2dcd13e Mon Sep 17 00:00:00 2001 From: Malcolm Boyd Date: Sun, 7 Aug 2016 09:49:29 -0500 Subject: [PATCH 1/2] [porn] Addded new extractor for porn.com --- youtube_dl/extractor/extractors.py | 2 ++ youtube_dl/extractor/porn.py | 53 ++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 youtube_dl/extractor/porn.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 8b866ed57..23285c349 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -643,6 +643,8 @@ from .pornhub import ( PornHubPlaylistIE, PornHubUserVideosIE, ) + +from .porn import PornIE from .pornotube import PornotubeIE from .pornovoisines import PornoVoisinesIE from .pornoxo import PornoXOIE diff --git a/youtube_dl/extractor/porn.py b/youtube_dl/extractor/porn.py new file mode 100644 index 000000000..7839287e5 --- /dev/null +++ b/youtube_dl/extractor/porn.py @@ -0,0 +1,53 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +import re + + +class PornIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?porn\.com/videos/.+' + _TEST = { + + 'url': 'http://www.porn.com/videos/marsha-may-rides-seth-on-top-of-his-thick-cock-2658067', + 'info_dict': { + 'id': '2658067', + 'ext': 'mp4', + 'title': 'Marsha May rides Seth on top of his thick cock', + # TODO more properties, either as: + # * A value + # * MD5 checksum; start the string with md5: + # * A regular expression; start the string with re: + # * Any Python type (for example int or float) + + } + } + + def _real_extract(self, url): + video_id = self._search_regex(r'(?:\w-)+(\d+)', url, 'video_id') + webpage = self._download_webpage(url, video_id) + + video_urls = re.findall('"([^"]*(?=mp4).*?)"', webpage) + title = self._search_regex(r'title:"([^title"].*?)"', webpage, 'video_title') + + formats = [] + for vid in video_urls: + + match = re.match('.*_(\d{3})\.mp4.*', vid) + if match: + resolution = match.group(1) + 'p' + else: + resolution = "" + + a_format = { + 'id': video_id, + 'url': vid, + 'resolution': resolution, + } + formats.append(a_format) + + return { + 'id': video_id, + 'title': title, + 'formats': formats + } From 2b8d709bad1ff71d261d854de8c30bd500276038 Mon Sep 17 00:00:00 2001 From: Malcolm Boyd Date: Sun, 7 Aug 2016 09:58:30 -0500 Subject: [PATCH 2/2] [porn] Removed unneeded comments and fixed import location --- youtube_dl/extractor/extractors.py | 2 +- youtube_dl/extractor/porn.py | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 23285c349..46fd5e5ac 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -636,6 +636,7 @@ from .pluralsight import ( ) from .podomatic import PodomaticIE from .polskieradio import PolskieRadioIE +from .porn import PornIE from .porn91 import Porn91IE from .pornhd import PornHdIE from .pornhub import ( @@ -644,7 +645,6 @@ from .pornhub import ( PornHubUserVideosIE, ) -from .porn import PornIE from .pornotube import PornotubeIE from .pornovoisines import PornoVoisinesIE from .pornoxo import PornoXOIE diff --git a/youtube_dl/extractor/porn.py b/youtube_dl/extractor/porn.py index 7839287e5..a1f95ed91 100644 --- a/youtube_dl/extractor/porn.py +++ b/youtube_dl/extractor/porn.py @@ -14,12 +14,6 @@ class PornIE(InfoExtractor): 'id': '2658067', 'ext': 'mp4', 'title': 'Marsha May rides Seth on top of his thick cock', - # TODO more properties, either as: - # * A value - # * MD5 checksum; start the string with md5: - # * A regular expression; start the string with re: - # * Any Python type (for example int or float) - } }