[vidzi] Fix extraction
[youtube-dl] / youtube_dl / extractor / vidzi.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from ..utils import smuggle_url
6
7
8 class VidziIE(InfoExtractor):
9     _VALID_URL = r'https?://(?:www\.)?vidzi\.tv/(?P<id>\w+)'
10     _TEST = {
11         'url': 'http://vidzi.tv/cghql9yq6emu.html',
12         'md5': '4f16c71ca0c8c8635ab6932b5f3f1660',
13         'info_dict': {
14             'id': 'cghql9yq6emu',
15             'ext': 'mp4',
16             'title': 'youtube-dl test video  1\\\\2\'3/4<5\\\\6ä7↭',
17         },
18     }
19
20     def _real_extract(self, url):
21         video_id = self._match_id(url)
22
23         webpage = self._download_webpage(url, video_id)
24         title = self._html_search_regex(
25             r'(?s)<h2 class="video-title">(.*?)</h2>', webpage, 'title')
26
27         # Vidzi now uses jwplayer, which can be handled by GenericIE
28         return {
29             '_type': 'url_transparent',
30             'id': video_id,
31             'title': title,
32             'url': smuggle_url(url, {'to_generic': True}),
33             'ie_key': 'Generic',
34         }