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