3 from .youtube
import YoutubeIE
4 from .zdf
import ZDFBaseIE
14 class PhoenixIE(ZDFBaseIE
):
15 IE_NAME
= 'phoenix.de'
16 _VALID_URL
= r
'https?://(?:www\.)?phoenix\.de/(?:[^/]+/)*[^/?#&]*-a-(?P<id>\d+)\.html'
18 # Same as https://www.zdf.de/politik/phoenix-sendungen/wohin-fuehrt-der-protest-in-der-pandemie-100.html
19 'url': 'https://www.phoenix.de/sendungen/ereignisse/corona-nachgehakt/wohin-fuehrt-der-protest-in-der-pandemie-a-2050630.html',
20 'md5': '34ec321e7eb34231fd88616c65c92db0',
22 'id': '210222_phx_nachgehakt_corona_protest',
24 'title': 'Wohin führt der Protest in der Pandemie?',
25 'description': 'md5:7d643fe7f565e53a24aac036b2122fbd',
27 'timestamp': 1613902500,
28 'upload_date': '20210221',
29 'uploader': 'Phoenix',
30 'series': 'corona nachgehakt',
31 'episode': 'Wohin führt der Protest in der Pandemie?',
35 'url': 'https://www.phoenix.de/sendungen/gespraeche/phoenix-streitgut-brennglas-corona-a-1965505.html',
39 'title': 'phoenix streitgut: Brennglas Corona - Wie gerecht ist unsere Gesellschaft?',
40 'description': 'md5:ac7a02e2eb3cb17600bc372e4ab28fdd',
42 'upload_date': '20201219',
43 'uploader': 'phoenix',
44 'uploader_id': 'phoenix',
47 'skip_download': True,
50 'url': 'https://www.phoenix.de/entwicklungen-in-russland-a-2044720.html',
51 'only_matching': True,
54 'url': 'https://www.phoenix.de/sendungen/dokumentationen/mit-dem-jumbo-durch-die-nacht-a-89625.html',
55 'only_matching': True,
57 # Same as https://www.zdf.de/politik/phoenix-sendungen/die-gesten-der-maechtigen-100.html
58 'url': 'https://www.phoenix.de/sendungen/dokumentationen/gesten-der-maechtigen-i-a-89468.html?ref=suche',
59 'only_matching': True,
62 def _real_extract(self
, url
):
63 article_id
= self
._match
_id
(url
)
65 article
= self
._download
_json
(
66 f
'https://www.phoenix.de/response/id/{article_id}', article_id
,
67 'Downloading article JSON')
69 video
= article
['absaetze'][0]
70 title
= video
.get('titel') or article
.get('subtitel')
72 if video
.get('typ') == 'video-youtube':
73 video_id
= video
['id']
74 return self
.url_result(
75 video_id
, ie
=YoutubeIE
.ie_key(), video_id
=video_id
,
78 video_id
= str(video
.get('basename') or video
.get('content'))
80 details
= self
._download
_json
(
81 'https://www.phoenix.de/php/mediaplayer/data/beitrags_details.php',
82 video_id
, 'Downloading details JSON', query
={
89 title
= title
or details
['title']
90 content_id
= details
['tracking']['nielsen']['content']['assetid']
92 info
= self
._extract
_ptmd
(
93 f
'https://tmd.phoenix.de/tmd/2/ngplayer_2_3/vod/ptmd/phoenix/{content_id}',
94 content_id
, None, url
)
96 duration
= int_or_none(try_get(
97 details
, lambda x
: x
['tracking']['nielsen']['content']['length']))
98 timestamp
= unified_timestamp(details
.get('editorialDate'))
100 details
, lambda x
: x
['tracking']['nielsen']['content']['program'],
102 episode
= title
if details
.get('contentType') == 'episode' else None
105 teaser_images
= try_get(details
, lambda x
: x
['teaserImageRef']['layouts'], dict) or {}
106 for thumbnail_key
, thumbnail_url
in teaser_images
.items():
107 thumbnail_url
= urljoin(url
, thumbnail_url
)
108 if not thumbnail_url
:
111 'url': thumbnail_url
,
113 m
= re
.match('^([0-9]+)x([0-9]+)$', thumbnail_key
)
115 thumbnail
['width'] = int(m
.group(1))
116 thumbnail
['height'] = int(m
.group(2))
117 thumbnails
.append(thumbnail
)
119 return merge_dicts(info
, {
122 'description': details
.get('leadParagraph'),
123 'duration': duration
,
124 'thumbnails': thumbnails
,
125 'timestamp': timestamp
,
126 'uploader': details
.get('tvService'),