From 0cc4f8e3850e41dc5e3f237315a20eac5eb99f46 Mon Sep 17 00:00:00 2001 From: peugeot Date: Mon, 29 Dec 2014 11:31:22 +0100 Subject: [PATCH 1/2] [xxxymovies] new ectractor --- youtube_dl/extractor/__init__.py | 1 + youtube_dl/extractor/xxxymovies.py | 63 ++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 youtube_dl/extractor/xxxymovies.py diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index fd0ebffe3..c8a77616e 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -512,6 +512,7 @@ from .xminus import XMinusIE from .xnxx import XNXXIE from .xvideos import XVideosIE from .xtube import XTubeUserIE, XTubeIE +from .xxxymovies import XXXYMoviesIE from .yahoo import ( YahooIE, YahooSearchIE, diff --git a/youtube_dl/extractor/xxxymovies.py b/youtube_dl/extractor/xxxymovies.py new file mode 100644 index 000000000..4a9144661 --- /dev/null +++ b/youtube_dl/extractor/xxxymovies.py @@ -0,0 +1,63 @@ +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + parse_duration, + int_or_none, +) + + +class XXXYMoviesIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?xxxymovies\.com/videos/(?P\d+)/(?P[^/]+)' + _TEST = { + 'url': 'http://xxxymovies.com/videos/138669/ecstatic-orgasm-sofcore/', + 'md5': '810b1bdbbffff89dd13bdb369fe7be4b', + 'info_dict': { + 'id': '138669', + 'display_id': 'ecstatic-orgasm-sofcore', + 'ext': 'mp4', + 'title': 'Ecstatic Orgasm Sofcore', + 'duration': 931, + 'age_limit': 18, + } + } + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + + video_id = mobj.group('id') + display_id = mobj.group('display_id') + + webpage = self._download_webpage(url, video_id) + + video_url = self._html_search_regex( + r"video_url\s*:\s*'([^']+)'", webpage, 'video URL') + + title = self._html_search_regex( + r'(.*?)\s*-\s*XXXYMovies.com', webpage, 'title') + + thumbnail = self._html_search_regex( + r'preview_url\s*:\s*\'(.*?)\'', webpage, 'thumbnail', fatal=False) + + categories = self._html_search_meta( + 'keywords', webpage, 'categories', default='').split(',') + + duration = parse_duration(self._search_regex( + r'Duration:\s*(\d+:\d+)', webpage, 'duration', fatal=False)) + + view_count = int_or_none(self._html_search_regex( + r'
\s*(\d+)', webpage, 'view count', fatal=False)) + + return { + 'id': video_id, + 'display_id': display_id, + 'url': video_url, + 'title': title, + 'thumbnail': thumbnail, + 'categories': categories, + 'duration': duration, + 'view_count': view_count, + 'age_limit': 18, + } From 6343a5f68e6dbf5a4fc1b0c7d0bec9e1ddc57143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergey=20M=E2=80=A4?= Date: Mon, 29 Dec 2014 21:05:21 +0600 Subject: [PATCH 2/2] [xxxymovies] Improve --- youtube_dl/extractor/xxxymovies.py | 36 ++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/youtube_dl/extractor/xxxymovies.py b/youtube_dl/extractor/xxxymovies.py index 4a9144661..5c8f17eb2 100644 --- a/youtube_dl/extractor/xxxymovies.py +++ b/youtube_dl/extractor/xxxymovies.py @@ -20,35 +20,51 @@ class XXXYMoviesIE(InfoExtractor): 'ext': 'mp4', 'title': 'Ecstatic Orgasm Sofcore', 'duration': 931, + 'categories': list, + 'view_count': int, + 'like_count': int, + 'dislike_count': int, 'age_limit': 18, } } def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) - video_id = mobj.group('id') display_id = mobj.group('display_id') - webpage = self._download_webpage(url, video_id) + webpage = self._download_webpage(url, display_id) - video_url = self._html_search_regex( + video_url = self._search_regex( r"video_url\s*:\s*'([^']+)'", webpage, 'video URL') title = self._html_search_regex( - r'(.*?)\s*-\s*XXXYMovies.com', webpage, 'title') + [r'
\s*

([^<]+)

', + r'(.*?)\s*-\s*XXXYMovies\.com'], + webpage, 'title') - thumbnail = self._html_search_regex( - r'preview_url\s*:\s*\'(.*?)\'', webpage, 'thumbnail', fatal=False) + thumbnail = self._search_regex( + r"preview_url\s*:\s*'([^']+)'", + webpage, 'thumbnail', fatal=False) categories = self._html_search_meta( 'keywords', webpage, 'categories', default='').split(',') duration = parse_duration(self._search_regex( - r'Duration:\s*(\d+:\d+)', webpage, 'duration', fatal=False)) + r'Duration:\s*(\d+:\d+)', + webpage, 'duration', fatal=False)) view_count = int_or_none(self._html_search_regex( - r'
\s*(\d+)', webpage, 'view count', fatal=False)) + r'
\s*(\d+)', + webpage, 'view count', fatal=False)) + like_count = int_or_none(self._search_regex( + r'>\s*Likes? \((\d+)\)', + webpage, 'like count', fatal=False)) + dislike_count = int_or_none(self._search_regex( + r'>\s*Dislike \((\d+)\)', + webpage, 'dislike count', fatal=False)) + + age_limit = self._rta_search(webpage) return { 'id': video_id, @@ -59,5 +75,7 @@ class XXXYMoviesIE(InfoExtractor): 'categories': categories, 'duration': duration, 'view_count': view_count, - 'age_limit': 18, + 'like_count': like_count, + 'dislike_count': dislike_count, + 'age_limit': age_limit, }