PEP8 applied
[youtube-dl] / youtube_dl / extractor / vidzi.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5
6
7 class VidziIE(InfoExtractor):
8     _VALID_URL = r'https?://(?:www\.)?vidzi\.tv/(?P<id>\w+)'
9     _TEST = {
10         'url': 'http://vidzi.tv/cghql9yq6emu.html',
11         'md5': '4f16c71ca0c8c8635ab6932b5f3f1660',
12         'info_dict': {
13             'id': 'cghql9yq6emu',
14             'ext': 'mp4',
15             'title': 'youtube-dl test video  1\\\\2\'3/4<5\\\\6ä7↭',
16         },
17     }
18
19     def _real_extract(self, url):
20         video_id = self._match_id(url)
21
22         webpage = self._download_webpage(url, video_id)
23         video_url = self._html_search_regex(
24             r'{\s*file\s*:\s*"([^"]+)"\s*}', webpage, 'video url')
25         title = self._html_search_regex(
26             r'(?s)<h2 class="video-title">(.*?)</h2>', webpage, 'title')
27
28         return {
29             'id': video_id,
30             'title': title,
31             'url': video_url,
32         }