]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/puls4.py
[cleanup] Consistent style for file heads
[yt-dlp.git] / yt_dlp / extractor / puls4.py
CommitLineData
9d54b02b 1from .prosiebensat1 import ProSiebenSat1BaseIE
6c87c2ee 2from ..utils import (
6c87c2ee 3 unified_strdate,
9d54b02b
RA
4 parse_duration,
5 compat_str,
6c87c2ee 6)
7862ad88
H
7
8
9d54b02b 9class Puls4IE(ProSiebenSat1BaseIE):
74394b5e 10 _VALID_URL = r'https?://(?:www\.)?puls4\.com/(?P<id>[^?#&]+)'
7862ad88 11 _TESTS = [{
9d54b02b
RA
12 'url': 'http://www.puls4.com/2-minuten-2-millionen/staffel-3/videos/2min2miotalk/Tobias-Homberger-von-myclubs-im-2min2miotalk-118118',
13 'md5': 'fd3c6b0903ac72c9d004f04bc6bb3e03',
7862ad88 14 'info_dict': {
9d54b02b
RA
15 'id': '118118',
16 'ext': 'flv',
17 'title': 'Tobias Homberger von myclubs im #2min2miotalk',
18 'description': 'md5:f9def7c5e8745d6026d8885487d91955',
19 'upload_date': '20160830',
6c87c2ee
S
20 'uploader': 'PULS_4',
21 },
74394b5e
S
22 }, {
23 'url': 'http://www.puls4.com/pro-und-contra/wer-wird-prasident/Ganze-Folgen/Wer-wird-Praesident.-Norbert-Hofer',
24 'only_matching': True,
25 }, {
26 'url': 'http://www.puls4.com/pro-und-contra/wer-wird-prasident/Ganze-Folgen/Wer-wird-Praesident-Analyse-des-Interviews-mit-Norbert-Hofer-416598',
27 'only_matching': True,
6c87c2ee 28 }]
9d54b02b
RA
29 _TOKEN = 'puls4'
30 _SALT = '01!kaNgaiNgah1Ie4AeSha'
31 _CLIENT_NAME = ''
7862ad88
H
32
33 def _real_extract(self, url):
9d54b02b
RA
34 path = self._match_id(url)
35 content_path = self._download_json(
36 'http://www.puls4.com/api/json-fe/page/' + path, path)['content'][0]['url']
37 media = self._download_json(
38 'http://www.puls4.com' + content_path,
39 content_path)['mediaCurrent']
40 player_content = media['playerContent']
41 info = self._extract_video_info(url, player_content['id'])
42 info.update({
43 'id': compat_str(media['objectId']),
44 'title': player_content['title'],
45 'description': media.get('description'),
46 'thumbnail': media.get('previewLink'),
47 'upload_date': unified_strdate(media.get('date')),
48 'duration': parse_duration(player_content.get('duration')),
49 'episode': player_content.get('episodePartName'),
50 'show': media.get('channel'),
51 'season_id': player_content.get('seasonId'),
52 'uploader': player_content.get('sourceCompany'),
53 })
54 return info