1 from .common
import InfoExtractor
5 get_element_text_and_html_by_tag
,
12 from ..utils
.traversal
import traverse_obj
15 class DuoplayIE(InfoExtractor
):
16 _VALID_URL
= r
'https?://duoplay\.ee/(?P<id>\d+)/[\w-]+/?(?:\?(?:[^#]+&)?ep=(?P<ep>\d+))?'
18 'note': 'Siberi võmm S02E12',
19 'url': 'https://duoplay.ee/4312/siberi-vomm?ep=24',
20 'md5': '1ff59d535310ac9c5cf5f287d8f91b2d',
24 'title': 'Operatsioon "Öö"',
25 'thumbnail': r
're:https://.+\.jpg(?:\?c=\d+)?$',
26 'description': 'md5:8ef98f38569d6b8b78f3d350ccc6ade8',
27 'upload_date': '20170523',
28 'timestamp': 1495567800,
29 'series': 'Siberi võmm',
33 'episode': 'Operatsioon "Öö"',
38 'note': 'Empty title',
39 'url': 'https://duoplay.ee/17/uhikarotid?ep=14',
40 'md5': '6aca68be71112314738dd17cced7f8bf',
44 'title': 'Ühikarotid',
45 'thumbnail': r
're:https://.+\.jpg(?:\?c=\d+)?$',
46 'description': 'md5:4719b418e058c209def41d48b601276e',
47 'upload_date': '20100916',
48 'timestamp': 1284661800,
49 'series': 'Ühikarotid',
57 'note': 'Movie without expiry',
58 'url': 'https://duoplay.ee/5501/pilvede-all.-neljas-ode',
59 'md5': '7abf63d773a49ef7c39f2c127842b8fd',
63 'title': 'Pilvede all. Neljas õde',
64 'thumbnail': r
're:https://.+\.jpg(?:\?c=\d+)?$',
65 'description': 'md5:d86a70f8f31e82c369d4d4f4c79b1279',
67 'upload_date': '20221214',
68 'timestamp': 1671054000,
73 def _real_extract(self
, url
):
74 telecast_id
, episode
= self
._match
_valid
_url
(url
).group('id', 'ep')
75 video_id
= join_nonempty(telecast_id
, episode
, delim
='_')
76 webpage
= self
._download
_webpage
(url
, video_id
)
77 video_player
= try_call(lambda: extract_attributes(
78 get_element_text_and_html_by_tag('video-player', webpage
)[1]))
79 if not video_player
or not video_player
.get('manifest-url'):
80 raise ExtractorError('No video found', expected
=True)
82 episode_attr
= self
._parse
_json
(video_player
.get(':episode') or '', video_id
, fatal
=False) or {}
86 'formats': self
._extract
_m
3u8_formats
(video_player
['manifest-url'], video_id
, 'mp4'),
87 **traverse_obj(episode_attr
, {
89 'description': 'synopsis',
90 'thumbnail': ('images', 'original'),
91 'timestamp': ('airtime', {lambda x
: unified_timestamp(x
+ ' +0200')}),
92 'cast': ('cast', {lambda x
: x
.split(', ')}),
93 'release_year': ('year', {int_or_none}
),
95 **(traverse_obj(episode_attr
, {
96 'title': (None, ('subtitle', ('episode_nr', {lambda x
: f
'Episode {x}' if x
else None}))),
98 'series_id': ('telecast_id', {str_or_none}
),
99 'season_number': ('season_id', {int_or_none}
),
100 'episode': 'subtitle',
101 'episode_number': ('episode_nr', {int_or_none}
),
102 'episode_id': ('episode_id', {str_or_none}
),
103 }, get_all
=False) if episode_attr
.get('category') != 'movies' else {}),