1 from __future__ import unicode_literals
5 from .common import InfoExtractor
11 class NuvidIE(InfoExtractor):
12 _VALID_URL = r'https?://(?:www|m)\.nuvid\.com/video/(?P<id>[0-9]+)'
14 'url': 'http://m.nuvid.com/video/1310741/',
15 'md5': 'eab207b7ac4fccfb4e23c86201f11277',
19 'title': 'Horny babes show their awesome bodeis and',
25 def _real_extract(self, url):
26 video_id = self._match_id(url)
28 page_url = 'http://m.nuvid.com/video/%s' % video_id
29 webpage = self._download_webpage(
30 page_url, video_id, 'Downloading video page')
31 # When dwnld_speed exists and has a value larger than the MP4 file's
32 # bitrate, Nuvid returns the MP4 URL
33 # It's unit is 100bytes/millisecond, see mobile-nuvid-min.js for the algorithm
34 self._set_cookie('nuvid.com', 'dwnld_speed', '10.0')
35 mp4_webpage = self._download_webpage(
36 page_url, video_id, 'Downloading video page for MP4 format')
38 html5_video_re = r'(?s)<(?:video|audio)[^<]*(?:>.*?<source[^>]*)?\s+src=["\'](.*?)["\']',
39 video_url = self._html_search_regex(html5_video_re, webpage, video_id)
40 mp4_video_url = self._html_search_regex(html5_video_re, mp4_webpage, video_id)
44 if mp4_video_url != video_url:
49 title = self._html_search_regex(
50 [r'<span title="([^"]+)">',
51 r'<div class="thumb-holder video">\s*<h5[^>]*>([^<]+)</h5>',
52 r'<span[^>]+class="title_thumb">([^<]+)</span>'], webpage, 'title').strip()
56 } for thumb_url in re.findall(r'<img src="([^"]+)" alt="" />', webpage)
58 thumbnail = thumbnails[0]['url'] if thumbnails else None
59 duration = parse_duration(self._html_search_regex(
60 [r'<i class="fa fa-clock-o"></i>\s*(\d{2}:\d{2})',
61 r'<span[^>]+class="view_time">([^<]+)</span>'], webpage, 'duration', fatal=False))
66 'thumbnails': thumbnails,
67 'thumbnail': thumbnail,