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