2021-03-02 09:05:59 +01:00
|
|
|
# coding: utf-8
|
2014-10-27 02:43:59 +01:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2021-03-02 09:05:59 +01:00
|
|
|
import re
|
2014-10-27 02:43:59 +01:00
|
|
|
|
2021-03-02 09:05:59 +01:00
|
|
|
from .youtube import YoutubeIE
|
|
|
|
from .zdf import ZDFBaseIE
|
|
|
|
from ..compat import compat_str
|
|
|
|
from ..utils import (
|
|
|
|
int_or_none,
|
|
|
|
merge_dicts,
|
2021-05-20 17:38:49 +02:00
|
|
|
try_get,
|
2021-03-02 09:05:59 +01:00
|
|
|
unified_timestamp,
|
2021-05-20 17:38:49 +02:00
|
|
|
urljoin,
|
2021-03-02 09:05:59 +01:00
|
|
|
)
|
2019-08-23 11:42:12 +02:00
|
|
|
|
2021-03-02 09:05:59 +01:00
|
|
|
|
|
|
|
class PhoenixIE(ZDFBaseIE):
|
2015-12-29 12:00:52 +01:00
|
|
|
IE_NAME = 'phoenix.de'
|
2021-03-02 09:05:59 +01:00
|
|
|
_VALID_URL = r'https?://(?:www\.)?phoenix\.de/(?:[^/]+/)*[^/?#&]*-a-(?P<id>\d+)\.html'
|
|
|
|
_TESTS = [{
|
|
|
|
# Same as https://www.zdf.de/politik/phoenix-sendungen/wohin-fuehrt-der-protest-in-der-pandemie-100.html
|
|
|
|
'url': 'https://www.phoenix.de/sendungen/ereignisse/corona-nachgehakt/wohin-fuehrt-der-protest-in-der-pandemie-a-2050630.html',
|
|
|
|
'md5': '34ec321e7eb34231fd88616c65c92db0',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '210222_phx_nachgehakt_corona_protest',
|
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'Wohin führt der Protest in der Pandemie?',
|
|
|
|
'description': 'md5:7d643fe7f565e53a24aac036b2122fbd',
|
|
|
|
'duration': 1691,
|
2021-05-20 17:38:49 +02:00
|
|
|
'timestamp': 1613902500,
|
2021-03-02 09:05:59 +01:00
|
|
|
'upload_date': '20210221',
|
|
|
|
'uploader': 'Phoenix',
|
2021-05-20 17:38:49 +02:00
|
|
|
'series': 'corona nachgehakt',
|
|
|
|
'episode': 'Wohin führt der Protest in der Pandemie?',
|
2015-03-30 17:15:08 +02:00
|
|
|
},
|
2021-03-02 09:05:59 +01:00
|
|
|
}, {
|
|
|
|
# Youtube embed
|
|
|
|
'url': 'https://www.phoenix.de/sendungen/gespraeche/phoenix-streitgut-brennglas-corona-a-1965505.html',
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'hMQtqFYjomk',
|
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'phoenix streitgut: Brennglas Corona - Wie gerecht ist unsere Gesellschaft?',
|
|
|
|
'description': 'md5:ac7a02e2eb3cb17600bc372e4ab28fdd',
|
|
|
|
'duration': 3509,
|
|
|
|
'upload_date': '20201219',
|
|
|
|
'uploader': 'phoenix',
|
|
|
|
'uploader_id': 'phoenix',
|
2015-03-30 17:15:08 +02:00
|
|
|
},
|
2021-03-02 09:05:59 +01:00
|
|
|
'params': {
|
|
|
|
'skip_download': True,
|
|
|
|
},
|
|
|
|
}, {
|
|
|
|
'url': 'https://www.phoenix.de/entwicklungen-in-russland-a-2044720.html',
|
|
|
|
'only_matching': True,
|
|
|
|
}, {
|
|
|
|
# no media
|
|
|
|
'url': 'https://www.phoenix.de/sendungen/dokumentationen/mit-dem-jumbo-durch-die-nacht-a-89625.html',
|
|
|
|
'only_matching': True,
|
|
|
|
}, {
|
|
|
|
# Same as https://www.zdf.de/politik/phoenix-sendungen/die-gesten-der-maechtigen-100.html
|
|
|
|
'url': 'https://www.phoenix.de/sendungen/dokumentationen/gesten-der-maechtigen-i-a-89468.html?ref=suche',
|
|
|
|
'only_matching': True,
|
|
|
|
}]
|
2019-08-23 11:42:12 +02:00
|
|
|
|
2014-10-27 02:43:59 +01:00
|
|
|
def _real_extract(self, url):
|
2021-03-02 09:05:59 +01:00
|
|
|
article_id = self._match_id(url)
|
|
|
|
|
|
|
|
article = self._download_json(
|
|
|
|
'https://www.phoenix.de/response/id/%s' % article_id, article_id,
|
|
|
|
'Downloading article JSON')
|
|
|
|
|
|
|
|
video = article['absaetze'][0]
|
|
|
|
title = video.get('titel') or article.get('subtitel')
|
|
|
|
|
|
|
|
if video.get('typ') == 'video-youtube':
|
|
|
|
video_id = video['id']
|
|
|
|
return self.url_result(
|
|
|
|
video_id, ie=YoutubeIE.ie_key(), video_id=video_id,
|
|
|
|
video_title=title)
|
|
|
|
|
|
|
|
video_id = compat_str(video.get('basename') or video.get('content'))
|
|
|
|
|
2021-05-20 17:38:49 +02:00
|
|
|
details = self._download_json(
|
2021-03-02 09:05:59 +01:00
|
|
|
'https://www.phoenix.de/php/mediaplayer/data/beitrags_details.php',
|
2021-05-20 17:38:49 +02:00
|
|
|
video_id, 'Downloading details JSON', query={
|
2021-03-02 09:05:59 +01:00
|
|
|
'ak': 'web',
|
|
|
|
'ptmd': 'true',
|
|
|
|
'id': video_id,
|
|
|
|
'profile': 'player2',
|
|
|
|
})
|
|
|
|
|
2021-05-20 17:38:49 +02:00
|
|
|
title = title or details['title']
|
|
|
|
content_id = details['tracking']['nielsen']['content']['assetid']
|
2021-03-02 09:05:59 +01:00
|
|
|
|
|
|
|
info = self._extract_ptmd(
|
|
|
|
'https://tmd.phoenix.de/tmd/2/ngplayer_2_3/vod/ptmd/phoenix/%s' % content_id,
|
|
|
|
content_id, None, url)
|
|
|
|
|
2021-05-20 17:38:49 +02:00
|
|
|
duration = int_or_none(try_get(
|
|
|
|
details, lambda x: x['tracking']['nielsen']['content']['length']))
|
|
|
|
timestamp = unified_timestamp(details.get('editorialDate'))
|
|
|
|
series = try_get(
|
|
|
|
details, lambda x: x['tracking']['nielsen']['content']['program'],
|
|
|
|
compat_str)
|
|
|
|
episode = title if details.get('contentType') == 'episode' else None
|
2021-03-02 09:05:59 +01:00
|
|
|
|
|
|
|
thumbnails = []
|
2021-05-20 17:38:49 +02:00
|
|
|
teaser_images = try_get(details, lambda x: x['teaserImageRef']['layouts'], dict) or {}
|
|
|
|
for thumbnail_key, thumbnail_url in teaser_images.items():
|
|
|
|
thumbnail_url = urljoin(url, thumbnail_url)
|
2021-03-02 09:05:59 +01:00
|
|
|
if not thumbnail_url:
|
|
|
|
continue
|
|
|
|
thumbnail = {
|
|
|
|
'url': thumbnail_url,
|
|
|
|
}
|
2021-05-20 17:38:49 +02:00
|
|
|
m = re.match('^([0-9]+)x([0-9]+)$', thumbnail_key)
|
|
|
|
if m:
|
|
|
|
thumbnail['width'] = int(m.group(1))
|
|
|
|
thumbnail['height'] = int(m.group(2))
|
2021-03-02 09:05:59 +01:00
|
|
|
thumbnails.append(thumbnail)
|
|
|
|
|
|
|
|
return merge_dicts(info, {
|
|
|
|
'id': content_id,
|
|
|
|
'title': title,
|
2021-05-20 17:38:49 +02:00
|
|
|
'description': details.get('leadParagraph'),
|
|
|
|
'duration': duration,
|
2021-03-02 09:05:59 +01:00
|
|
|
'thumbnails': thumbnails,
|
|
|
|
'timestamp': timestamp,
|
2021-05-20 17:38:49 +02:00
|
|
|
'uploader': details.get('tvService'),
|
|
|
|
'series': series,
|
|
|
|
'episode': episode,
|
2021-03-02 09:05:59 +01:00
|
|
|
})
|