]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/vidzi.py
Merge pull request #8061 from dstftw/introduce-chapter-and-series-fields
[yt-dlp.git] / youtube_dl / extractor / vidzi.py
CommitLineData
5f6a1245 1# coding: utf-8
018e8355
PH
2from __future__ import unicode_literals
3
95ee8442 4from .common import InfoExtractor
5
018e8355 6
95ee8442 7class VidziIE(InfoExtractor):
8 _VALID_URL = r'https?://(?:www\.)?vidzi\.tv/(?P<id>\w+)'
9 _TEST = {
2c26df76
PH
10 'url': 'http://vidzi.tv/cghql9yq6emu.html',
11 'md5': '4f16c71ca0c8c8635ab6932b5f3f1660',
95ee8442 12 'info_dict': {
2c26df76 13 'id': 'cghql9yq6emu',
95ee8442 14 'ext': 'mp4',
2c26df76 15 'title': 'youtube-dl test video 1\\\\2\'3/4<5\\\\6ä7↭',
95ee8442 16 },
17 }
18
19 def _real_extract(self, url):
018e8355 20 video_id = self._match_id(url)
5f6a1245 21
018e8355 22 webpage = self._download_webpage(url, video_id)
ee223abb
MH
23 video_host = self._html_search_regex(
24 r'id=\'vplayer\'><img src="http://(.*?)/i', webpage,
25 'video host')
26 video_hash = self._html_search_regex(
27 r'\|([a-z0-9]+)\|hls\|type', webpage, 'video_hash')
28 ext = self._html_search_regex(
29 r'\|tracks\|([a-z0-9]+)\|', webpage, 'video ext')
30 video_url = 'http://' + video_host + '/' + video_hash + '/v.' + ext
018e8355 31 title = self._html_search_regex(
2c26df76 32 r'(?s)<h2 class="video-title">(.*?)</h2>', webpage, 'title')
5f6a1245 33
95ee8442 34 return {
35 'id': video_id,
36 'title': title,
37 'url': video_url,
95ee8442 38 }