3 from .brightcove
import BrightcoveNewIE
4 from .common
import InfoExtractor
5 from ..utils
import float_or_none
, int_or_none
, smuggle_url
, strip_or_none
6 from ..utils
.traversal
import traverse_obj
9 class TVAIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?tvaplus\.ca/(?:[^/?#]+/)*[\w-]+-(?P<id>\d+)(?:$|[#?])'
14 'url': 'https://www.tvaplus.ca/tva/alerte-amber/saison-1/episode-01-1000036619',
15 'md5': '949490fd0e7aee11d0543777611fbd53',
17 'id': '6084352463001',
19 'title': 'Mon dernier jour',
20 'uploader_id': '5481942443001',
21 'upload_date': '20190907',
22 'timestamp': 1567899756,
23 'description': 'md5:9c0d7fbb90939420c651fd977df90145',
24 'thumbnail': r
're:https://.+\.jpg',
25 'episode': 'Mon dernier jour',
27 'tags': ['alerte amber', 'alerte amber saison 1', 'surdemande'],
31 'series': 'Alerte Amber',
35 'url': 'https://www.tvaplus.ca/tva/le-baiser-du-barbu/le-baiser-du-barbu-886644190',
37 'id': '6354448043112',
39 'title': 'Le Baiser du barbu',
40 'uploader_id': '5481942443001',
41 'upload_date': '20240606',
42 'timestamp': 1717694023,
43 'description': 'md5:025b1219086c1cbf4bc27e4e034e8b57',
44 'thumbnail': r
're:https://.+\.jpg',
45 'episode': 'Le Baiser du barbu',
46 'tags': ['fullepisode', 'films'],
48 'series': 'Le Baiser du barbu',
52 _BC_URL_TMPL
= 'https://players.brightcove.net/5481942443001/default_default/index.html?videoId={}'
54 def _real_extract(self
, url
):
55 entity_id
= self
._match
_id
(url
)
56 webpage
= self
._download
_webpage
(url
, entity_id
)
57 entity
= self
._search
_nextjs
_data
(webpage
, entity_id
)['props']['pageProps']['staticEntity']
58 video_id
= entity
['videoId']
59 episode
= strip_or_none(entity
.get('name'))
62 '_type': 'url_transparent',
63 'url': smuggle_url(self
._BC
_URL
_TMPL
.format(video_id
), {'geo_countries': ['CA']}),
64 'ie_key': BrightcoveNewIE
.ie_key(),
68 **traverse_obj(entity
, {
69 'description': ('longDescription', {str}
),
70 'duration': ('durationMillis', {float_or_none(scale
=1000)}),
71 'channel': ('knownEntities', 'channel', 'name', {str}
),
72 'series': ('knownEntities', 'videoShow', 'name', {str}
),
73 'season_number': ('slug', {lambda x
: re
.search(r
'/s(?:ai|ea)son-(\d+)/', x
)}, 1, {int_or_none}
),
74 'episode_number': ('episodeNumber', {int_or_none}
),