]> Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/servus.py
New upstream version 2017.11.06
[youtubedl] / youtube_dl / extractor / servus.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5
6
7 class ServusIE(InfoExtractor):
8 _VALID_URL = r'https?://(?:www\.)?servus\.com/(?:at|de)/p/[^/]+/(?P<id>AA-\w+|\d+-\d+)'
9 _TESTS = [{
10 'url': 'https://www.servus.com/de/p/Die-Gr%C3%BCnen-aus-Sicht-des-Volkes/AA-1T6VBU5PW1W12/',
11 'md5': '046dee641cda1c4cabe13baef3be2c1c',
12 'info_dict': {
13 'id': 'AA-1T6VBU5PW1W12',
14 'ext': 'mp4',
15 'title': 'Die Grünen aus Volkssicht',
16 'description': 'md5:052b5da1cb2cd7d562ef1f19be5a5cba',
17 'thumbnail': r're:^https?://.*\.jpg$',
18 }
19 }, {
20 'url': 'https://www.servus.com/at/p/Wie-das-Leben-beginnt/1309984137314-381415152/',
21 'only_matching': True,
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._og_search_title(webpage)
29 description = self._og_search_description(webpage)
30 thumbnail = self._og_search_thumbnail(webpage)
31
32 formats = self._extract_m3u8_formats(
33 'https://stv.rbmbtnx.net/api/v1/manifests/%s.m3u8' % video_id,
34 video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls')
35 self._sort_formats(formats)
36
37 return {
38 'id': video_id,
39 'title': title,
40 'description': description,
41 'thumbnail': thumbnail,
42 'formats': formats,
43 }