]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/oktoberfesttv.py
[extractor] Standardize `_live_title`
[yt-dlp.git] / yt_dlp / extractor / oktoberfesttv.py
CommitLineData
dcdb292f 1# coding: utf-8
394599f4
PH
2from __future__ import unicode_literals
3
4from .common import InfoExtractor
5
6
7class OktoberfestTVIE(InfoExtractor):
92519402 8 _VALID_URL = r'https?://(?:www\.)?oktoberfest-tv\.de/[^/]+/[^/]+/video/(?P<id>[^/?#]+)'
394599f4
PH
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}$',
ec85ded8 16 'thumbnail': r're:^https?://.*\.jpg$',
394599f4
PH
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
39ca3b5c 28 title = self._html_search_regex(
29 r'<h1><strong>.*?</strong>(.*?)</h1>', webpage, 'title')
394599f4
PH
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 }