X-Git-Url: https://git.rapsys.eu/.gitweb.cgi/youtubedl/blobdiff_plain/af478477605bdf3f5d57562035885cfee905f379..c512650955de0b16d37e7fa7fb29ea0985e415bb:/youtube_dl/extractor/nuvid.py diff --git a/youtube_dl/extractor/nuvid.py b/youtube_dl/extractor/nuvid.py new file mode 100644 index 0000000..e3db9fe --- /dev/null +++ b/youtube_dl/extractor/nuvid.py @@ -0,0 +1,48 @@ +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor + + +class NuvidIE(InfoExtractor): + _VALID_URL = r'^https?://(?:www|m)\.nuvid\.com/video/(?P[0-9]+)' + _TEST = { + 'url': 'http://m.nuvid.com/video/1310741/', + 'md5': 'eab207b7ac4fccfb4e23c86201f11277', + 'info_dict': { + 'id': '1310741', + 'ext': 'mp4', + "title": "Horny babes show their awesome bodeis and", + "age_limit": 18, + } + } + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + video_id = mobj.group('id') + + murl = url.replace('://www.', '://m.') + webpage = self._download_webpage(murl, video_id) + + title = self._html_search_regex( + r'
\s+]*>([^<]+)', + webpage, 'title').strip() + + url_end = self._html_search_regex( + r'href="(/[^"]+)"[^>]*data-link_type="mp4"', + webpage, 'video_url') + video_url = 'http://m.nuvid.com' + url_end + + thumbnail = self._html_search_regex( + r'href="(/thumbs/[^"]+)"[^>]*data-link_type="thumbs"', + webpage, 'thumbnail URL', fatal=False) + + return { + 'id': video_id, + 'url': video_url, + 'ext': 'mp4', + 'title': title, + 'thumbnail': thumbnail, + 'age_limit': 18, + }