diff options
author | peugeot <peugeot@psa.fr> | 2014-08-30 17:17:47 +0200 |
---|---|---|
committer | peugeot <peugeot@psa.fr> | 2014-08-30 17:17:47 +0200 |
commit | 676e3ecf245f230411c9d534b0a4e918c01f5d86 (patch) | |
tree | f6f5b5b54eb921bdb67b139d54ceca6ed129bd79 | |
parent | 08a36c35693d212405a50b490f7f1828830e60ee (diff) |
Add support for Vporn
-rw-r--r-- | youtube_dl/extractor/__init__.py | 1 | ||||
-rw-r--r-- | youtube_dl/extractor/vporn.py | 44 |
2 files changed, 45 insertions, 0 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 1479d998a..6d94984de 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -393,6 +393,7 @@ from .vine import ( from .viki import VikiIE from .vk import VKIE from .vodlocker import VodlockerIE +from .vporn import VpornIE from .vube import VubeIE from .vuclip import VuClipIE from .vulture import VultureIE diff --git a/youtube_dl/extractor/vporn.py b/youtube_dl/extractor/vporn.py new file mode 100644 index 000000000..bdbd7543d --- /dev/null +++ b/youtube_dl/extractor/vporn.py @@ -0,0 +1,44 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor + +class VpornIE(InfoExtractor): + _VALID_URL = r'http?://(?:www\.)?vporn\.com/[a-z]+/(?P<title_dash>[a-z-]+)/(?P<id>\d+)/?' + _TEST = { + 'url': 'http://www.vporn.com/masturbation/violet-on-her-th-birthday/497944/', + 'md5': 'facf37c1b86546fa0208058546842c55', + 'info_dict': { + 'id': '497944', + 'ext': 'mp4', + 'title': 'Violet On Her 19th Birthday', + 'description': 'Violet dances in front of the camera which is sure to get you horny.', + 'duration': 393, + 'thumbnail': 're:^https?://.*\.jpg$', + } + } + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + video_id = mobj.group('id') + + webpage = self._download_webpage(url, video_id) + title = self._html_search_regex(r'<title>(.*?) - Vporn Video</title>', webpage, 'title') + video_url = self._html_search_regex(r'flashvars.videoUrlMedium = "(.*?)"', webpage, 'video_url') + description = self._html_search_regex(r'<div class="description_txt">(.*?)</div>', webpage, 'description') + thumbnail = 'http://www.vporn.com' + self._html_search_regex(r'flashvars.imageUrl = "(.*?)"', webpage, 'description') + + mobj = re.search( + r'<span class="f_right">duration (?P<minutes>\d+) min (?P<seconds>\d+) sec </span>', webpage) + duration = int(mobj.group('minutes')) * 60 + int(mobj.group('seconds')) if mobj else None + + return { + 'id': video_id, + 'url': video_url, + 'thumbnail': thumbnail, + 'title': title, + 'description': description, + 'duration': duration, + } |