]>
Commit | Line | Data |
---|---|---|
e1d168e5 AS |
1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
55b8588f S |
4 | import re |
5 | ||
e1d168e5 AS |
6 | from .common import InfoExtractor |
7 | ||
8 | ||
9 | class ServusIE(InfoExtractor): | |
55b8588f | 10 | _VALID_URL = r'https?://(?:www\.)?servus\.com/(?:(?:at|de)/p/[^/]+|tv/videos)/(?P<id>[aA]{2}-\w+|\d+-\d+)' |
e1d168e5 AS |
11 | _TESTS = [{ |
12 | 'url': 'https://www.servus.com/de/p/Die-Gr%C3%BCnen-aus-Sicht-des-Volkes/AA-1T6VBU5PW1W12/', | |
55b8588f | 13 | 'md5': '3e1dd16775aa8d5cbef23628cfffc1f4', |
e1d168e5 AS |
14 | 'info_dict': { |
15 | 'id': 'AA-1T6VBU5PW1W12', | |
16 | 'ext': 'mp4', | |
55b8588f S |
17 | 'title': 'Die Grünen aus Sicht des Volkes', |
18 | 'description': 'md5:1247204d85783afe3682644398ff2ec4', | |
19 | 'thumbnail': r're:^https?://.*\.jpg', | |
e1d168e5 AS |
20 | } |
21 | }, { | |
22 | 'url': 'https://www.servus.com/at/p/Wie-das-Leben-beginnt/1309984137314-381415152/', | |
23 | 'only_matching': True, | |
55b8588f S |
24 | }, { |
25 | 'url': 'https://www.servus.com/tv/videos/aa-1t6vbu5pw1w12/', | |
26 | 'only_matching': True, | |
27 | }, { | |
28 | 'url': 'https://www.servus.com/tv/videos/1380889096408-1235196658/', | |
29 | 'only_matching': True, | |
e1d168e5 AS |
30 | }] |
31 | ||
32 | def _real_extract(self, url): | |
55b8588f | 33 | video_id = self._match_id(url).upper() |
e1d168e5 AS |
34 | webpage = self._download_webpage(url, video_id) |
35 | ||
55b8588f S |
36 | title = self._search_regex( |
37 | (r'videoLabel\s*=\s*(["\'])(?P<title>(?:(?!\1).)+)\1', | |
38 | r'<h\d+[^>]+\bclass=["\']heading--(?:one|two)["\'][^>]*>(?P<title>[^<]+)'), | |
39 | webpage, 'title', default=None, | |
40 | group='title') or self._og_search_title(webpage) | |
41 | title = re.sub(r'\s*-\s*Servus TV\s*$', '', title) | |
e1d168e5 AS |
42 | description = self._og_search_description(webpage) |
43 | thumbnail = self._og_search_thumbnail(webpage) | |
44 | ||
45 | formats = self._extract_m3u8_formats( | |
46 | 'https://stv.rbmbtnx.net/api/v1/manifests/%s.m3u8' % video_id, | |
47 | video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls') | |
48 | self._sort_formats(formats) | |
49 | ||
50 | return { | |
51 | 'id': video_id, | |
52 | 'title': title, | |
53 | 'description': description, | |
54 | 'thumbnail': thumbnail, | |
55 | 'formats': formats, | |
56 | } |