]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/nuvid.py
debian/watch: Make use of the signing key from upstream.
[youtubedl] / youtube_dl / extractor / nuvid.py
1 from __future__ import unicode_literals
2
3 import re
4
5 from .common import InfoExtractor
6
7
8 class NuvidIE(InfoExtractor):
9 _VALID_URL = r'^https?://(?:www|m)\.nuvid\.com/video/(?P<id>[0-9]+)'
10 _TEST = {
11 'url': 'http://m.nuvid.com/video/1310741/',
12 'md5': 'eab207b7ac4fccfb4e23c86201f11277',
13 'info_dict': {
14 'id': '1310741',
15 'ext': 'mp4',
16 "title": "Horny babes show their awesome bodeis and",
17 "age_limit": 18,
18 }
19 }
20
21 def _real_extract(self, url):
22 mobj = re.match(self._VALID_URL, url)
23 video_id = mobj.group('id')
24
25 murl = url.replace('://www.', '://m.')
26 webpage = self._download_webpage(murl, video_id)
27
28 title = self._html_search_regex(
29 r'<div class="title">\s+<h2[^>]*>([^<]+)</h2>',
30 webpage, 'title').strip()
31
32 url_end = self._html_search_regex(
33 r'href="(/[^"]+)"[^>]*data-link_type="mp4"',
34 webpage, 'video_url')
35 video_url = 'http://m.nuvid.com' + url_end
36
37 thumbnail = self._html_search_regex(
38 r'href="(/thumbs/[^"]+)"[^>]*data-link_type="thumbs"',
39 webpage, 'thumbnail URL', fatal=False)
40
41 return {
42 'id': video_id,
43 'url': video_url,
44 'ext': 'mp4',
45 'title': title,
46 'thumbnail': thumbnail,
47 'age_limit': 18,
48 }