]> Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/oktoberfesttv.py
debian/changelog: Annotate the log with bugs to close.
[youtubedl] / youtube_dl / extractor / oktoberfesttv.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5
6
7 class OktoberfestTVIE(InfoExtractor):
8 _VALID_URL = r'https?://(?:www\.)?oktoberfest-tv\.de/[^/]+/[^/]+/video/(?P<id>[^/?#]+)'
9
10 _TEST = {
11 'url': 'http://www.oktoberfest-tv.de/de/kameras/video/hb-zelt',
12 'info_dict': {
13 'id': 'hb-zelt',
14 'ext': 'mp4',
15 'title': 're:^Live-Kamera: Hofbräuzelt [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
16 'thumbnail': r're:^https?://.*\.jpg$',
17 'is_live': True,
18 },
19 'params': {
20 'skip_download': True,
21 }
22 }
23
24 def _real_extract(self, url):
25 video_id = self._match_id(url)
26 webpage = self._download_webpage(url, video_id)
27
28 title = self._live_title(self._html_search_regex(
29 r'<h1><strong>.*?</strong>(.*?)</h1>', webpage, 'title'))
30
31 clip = self._search_regex(
32 r"clip:\s*\{\s*url:\s*'([^']+)'", webpage, 'clip')
33 ncurl = self._search_regex(
34 r"netConnectionUrl:\s*'([^']+)'", webpage, 'rtmp base')
35 video_url = ncurl + clip
36 thumbnail = self._search_regex(
37 r"canvas:\s*\{\s*backgroundImage:\s*'url\(([^)]+)\)'", webpage,
38 'thumbnail', fatal=False)
39
40 return {
41 'id': video_id,
42 'title': title,
43 'url': video_url,
44 'ext': 'mp4',
45 'is_live': True,
46 'thumbnail': thumbnail,
47 }