]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/phoenix.py
2 from __future__
import unicode_literals
6 from .youtube
import YoutubeIE
7 from .zdf
import ZDFBaseIE
8 from ..compat
import compat_str
18 class PhoenixIE(ZDFBaseIE
):
19 IE_NAME
= 'phoenix.de'
20 _VALID_URL
= r
'https?://(?:www\.)?phoenix\.de/(?:[^/]+/)*[^/?#&]*-a-(?P<id>\d+)\.html'
22 # Same as https://www.zdf.de/politik/phoenix-sendungen/wohin-fuehrt-der-protest-in-der-pandemie-100.html
23 'url': 'https://www.phoenix.de/sendungen/ereignisse/corona-nachgehakt/wohin-fuehrt-der-protest-in-der-pandemie-a-2050630.html',
24 'md5': '34ec321e7eb34231fd88616c65c92db0',
26 'id': '210222_phx_nachgehakt_corona_protest',
28 'title': 'Wohin führt der Protest in der Pandemie?',
29 'description': 'md5:7d643fe7f565e53a24aac036b2122fbd',
31 'timestamp': 1613902500,
32 'upload_date': '20210221',
33 'uploader': 'Phoenix',
34 'series': 'corona nachgehakt',
35 'episode': 'Wohin führt der Protest in der Pandemie?',
39 'url': 'https://www.phoenix.de/sendungen/gespraeche/phoenix-streitgut-brennglas-corona-a-1965505.html',
43 'title': 'phoenix streitgut: Brennglas Corona - Wie gerecht ist unsere Gesellschaft?',
44 'description': 'md5:ac7a02e2eb3cb17600bc372e4ab28fdd',
46 'upload_date': '20201219',
47 'uploader': 'phoenix',
48 'uploader_id': 'phoenix',
51 'skip_download': True,
54 'url': 'https://www.phoenix.de/entwicklungen-in-russland-a-2044720.html',
55 'only_matching': True,
58 'url': 'https://www.phoenix.de/sendungen/dokumentationen/mit-dem-jumbo-durch-die-nacht-a-89625.html',
59 'only_matching': True,
61 # Same as https://www.zdf.de/politik/phoenix-sendungen/die-gesten-der-maechtigen-100.html
62 'url': 'https://www.phoenix.de/sendungen/dokumentationen/gesten-der-maechtigen-i-a-89468.html?ref=suche',
63 'only_matching': True,
66 def _real_extract(self
, url
):
67 article_id
= self
._match
_id
(url
)
69 article
= self
._download
_json
(
70 'https://www.phoenix.de/response/id/%s' % article_id
, article_id
,
71 'Downloading article JSON')
73 video
= article
['absaetze'][0]
74 title
= video
.get('titel') or article
.get('subtitel')
76 if video
.get('typ') == 'video-youtube':
77 video_id
= video
['id']
78 return self
.url_result(
79 video_id
, ie
=YoutubeIE
.ie_key(), video_id
=video_id
,
82 video_id
= compat_str(video
.get('basename') or video
.get('content'))
84 details
= self
._download
_json
(
85 'https://www.phoenix.de/php/mediaplayer/data/beitrags_details.php',
86 video_id
, 'Downloading details JSON', query
={
93 title
= title
or details
['title']
94 content_id
= details
['tracking']['nielsen']['content']['assetid']
96 info
= self
._extract
_ptmd
(
97 'https://tmd.phoenix.de/tmd/2/ngplayer_2_3/vod/ptmd/phoenix/%s' % content_id
,
98 content_id
, None, url
)
100 duration
= int_or_none(try_get(
101 details
, lambda x
: x
['tracking']['nielsen']['content']['length']))
102 timestamp
= unified_timestamp(details
.get('editorialDate'))
104 details
, lambda x
: x
['tracking']['nielsen']['content']['program'],
106 episode
= title
if details
.get('contentType') == 'episode' else None
109 teaser_images
= try_get(details
, lambda x
: x
['teaserImageRef']['layouts'], dict) or {}
110 for thumbnail_key
, thumbnail_url
in teaser_images
.items():
111 thumbnail_url
= urljoin(url
, thumbnail_url
)
112 if not thumbnail_url
:
115 'url': thumbnail_url
,
117 m
= re
.match('^([0-9]+)x([0-9]+)$', thumbnail_key
)
119 thumbnail
['width'] = int(m
.group(1))
120 thumbnail
['height'] = int(m
.group(2))
121 thumbnails
.append(thumbnail
)
123 return merge_dicts(info
, {
126 'description': details
.get('leadParagraph'),
127 'duration': duration
,
128 'thumbnails': thumbnails
,
129 'timestamp': timestamp
,
130 'uploader': details
.get('tvService'),