diff options
author | Sergey M․ <dstftw@gmail.com> | 2014-08-31 06:45:40 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2014-08-31 06:45:40 +0700 |
commit | be2dd0651e296a3bda264d96c4ae93f220d8dea9 (patch) | |
tree | 2178931a806149adfeafe91569087a7bf310aeee /youtube_dl | |
parent | 6a400a6339911333517bfa59f5f7c2a05d948f19 (diff) | |
parent | 17b0b8a1661e0f51e17d1ed74307d79eaab1ccfd (diff) |
Merge branch 'anysex' of https://github.com/peugeot/youtube-dl into peugeot-anysex
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/__init__.py | 1 | ||||
-rw-r--r-- | youtube_dl/extractor/anysex.py | 43 |
2 files changed, 44 insertions, 0 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 6d94984de..a306035f1 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -4,6 +4,7 @@ from .addanime import AddAnimeIE from .adultswim import AdultSwimIE from .aftonbladet import AftonbladetIE from .anitube import AnitubeIE +from .anysex import AnySexIE from .aol import AolIE from .allocine import AllocineIE from .aparat import AparatIE diff --git a/youtube_dl/extractor/anysex.py b/youtube_dl/extractor/anysex.py new file mode 100644 index 000000000..d578a1712 --- /dev/null +++ b/youtube_dl/extractor/anysex.py @@ -0,0 +1,43 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import int_or_none + +class AnySexIE(InfoExtractor): + _VALID_URL = r'http?://(?:www\.)?anysex\.com/(?P<id>\d+)/?' + _TEST = { + 'url': 'http://anysex.com/156592/', + 'md5': '023e9fbb7f7987f5529a394c34ad3d3d', + 'info_dict': { + 'id': '156592', + 'ext': 'mp4', + 'title': 'Busty and sexy blondie in her bikini strips for you', + 'duration': 270, + } + } + + 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>(.*?)</title>', webpage, 'title') + video_url = self._html_search_regex(r'video_url: \'(.*?)\',', webpage, 'video_url') + thumbnail = self._html_search_regex(r'preview_url: \'(.*?)\',', webpage, 'thumbnail') + + mobj = re.search(r'<b>Duration:</b> (?P<minutes>\d+):(?P<seconds>\d+)<', webpage) + duration = int(mobj.group('minutes')) * 60 + int(mobj.group('seconds')) if mobj else None + + view_count = self._html_search_regex(r'<b>Views:</b> (\d+)', webpage, 'view count', fatal=False) + + return { + 'id': video_id, + 'ext': 'mp4', + 'url': video_url, + 'title': title, + 'duration': int_or_none(duration), + 'view_count': int_or_none(view_count), + } |