]> Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/fczenit.py
debian/patches: Removed, they came from upstream.
[youtubedl] / youtube_dl / extractor / fczenit.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 import re
5
6 from .common import InfoExtractor
7
8
9 class FczenitIE(InfoExtractor):
10 _VALID_URL = r'https?://(?:www\.)?fc-zenit\.ru/video/gl(?P<id>[0-9]+)'
11 _TEST = {
12 'url': 'http://fc-zenit.ru/video/gl6785/',
13 'md5': '458bacc24549173fe5a5aa29174a5606',
14 'info_dict': {
15 'id': '6785',
16 'ext': 'mp4',
17 'title': '«Зенит-ТВ»: как Олег Шатов играл против «Урала»',
18 },
19 }
20
21 def _real_extract(self, url):
22 video_id = self._match_id(url)
23 webpage = self._download_webpage(url, video_id)
24
25 video_title = self._html_search_regex(r'<div class=\"photoalbum__title\">([^<]+)', webpage, 'title')
26
27 bitrates_raw = self._html_search_regex(r'bitrates:.*\n(.*)\]', webpage, 'video URL')
28 bitrates = re.findall(r'url:.?\'(.+?)\'.*?bitrate:.?([0-9]{3}?)', bitrates_raw)
29
30 formats = [{
31 'url': furl,
32 'tbr': tbr,
33 } for furl, tbr in bitrates]
34
35 self._sort_formats(formats)
36
37 return {
38 'id': video_id,
39 'title': video_title,
40 'formats': formats,
41 }