From 00ed500f21b6a39e522935966cf6df187eb3adea Mon Sep 17 00:00:00 2001 From: Celthi Date: Tue, 29 Dec 2015 09:12:02 +0800 Subject: [PATCH 1/3] [pornorama] Add new extractor --- youtube_dl/extractor/__init__.py | 1 + youtube_dl/extractor/pornorama.py | 54 +++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 youtube_dl/extractor/pornorama.py diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 68c9c1288..a5ba01235 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -519,6 +519,7 @@ from .pornhub import ( PornHubIE, PornHubPlaylistIE, ) +form .pornorama import PornoramaIE from .pornotube import PornotubeIE from .pornovoisines import PornoVoisinesIE from .pornoxo import PornoXOIE diff --git a/youtube_dl/extractor/pornorama.py b/youtube_dl/extractor/pornorama.py new file mode 100644 index 000000000..a1a8d3487 --- /dev/null +++ b/youtube_dl/extractor/pornorama.py @@ -0,0 +1,54 @@ +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..compat import compat_urllib_parse_unquote +from ..utils import ( + clean_html, + ExtractorError +) + + +class PornoramaIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?pornorama\.com/video(?P[0-9]+)(?:.*)' + _TEST = { + 'url': 'http://www.pornorama.com/video1416287/amy_my_neighbor_fucked', + 'md5': '', + 'info_dict': { + 'id': '1416287', + 'ext': 'flv', + 'title': 'amy_my_neighbor_fucked', + 'age_limit': 18, + } + } + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + + mobj = re.search(r'

(.+?)

', webpage) + if mobj: + raise ExtractorError('%s said: %s' % (self.IE_NAME, clean_html(mobj.group(1))), expected=True) + + video_url = compat_urllib_parse_unquote( + self._search_regex(r'flv_url=(.+?)&', webpage, 'video URL')) + video_title = self._html_search_regex( + r'(.*?)\s+-\s+PORNORAMA', webpage, 'title') + video_thumbnail = self._search_regex( + r'url_bigthumb=(.+?)&', webpage, 'thumbnail', fatal=False) + + formats = [{ + 'url': video_url, + }] + + self._sort_formats(formats) + + return { + 'id': video_id, + 'formats': formats, + 'title': video_title, + 'ext': 'flv', + 'thumbnail': video_thumbnail, + 'age_limit': 18, + } From a9d6b4250836f75d74ce4a3c2e5a793890a96fcb Mon Sep 17 00:00:00 2001 From: Celthi <txtlu0@gmail.com> Date: Tue, 29 Dec 2015 09:25:01 +0800 Subject: [PATCH 2/3] [pornorama] Add new extractor --- youtube_dl/extractor/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index a5ba01235..9b54da09a 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -519,7 +519,7 @@ from .pornhub import ( PornHubIE, PornHubPlaylistIE, ) -form .pornorama import PornoramaIE +from .pornorama import PornoramaIE from .pornotube import PornotubeIE from .pornovoisines import PornoVoisinesIE from .pornoxo import PornoXOIE From 0da17730295695585b0ac98564128bb59202aee6 Mon Sep 17 00:00:00 2001 From: Celthi <txtlu0@gmail.com> Date: Tue, 29 Dec 2015 09:30:33 +0800 Subject: [PATCH 3/3] [pornoram] Add new extractor --- youtube_dl/extractor/pornorama.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/youtube_dl/extractor/pornorama.py b/youtube_dl/extractor/pornorama.py index a1a8d3487..ac560ddab 100644 --- a/youtube_dl/extractor/pornorama.py +++ b/youtube_dl/extractor/pornorama.py @@ -27,10 +27,6 @@ class PornoramaIE(InfoExtractor): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) - mobj = re.search(r'<h1 class="inlineError">(.+?)</h1>', webpage) - if mobj: - raise ExtractorError('%s said: %s' % (self.IE_NAME, clean_html(mobj.group(1))), expected=True) - video_url = compat_urllib_parse_unquote( self._search_regex(r'flv_url=(.+?)&', webpage, 'video URL')) video_title = self._html_search_regex(