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
):
10 _VALID_URL
= r
'https?://videos?\.tva\.ca/details/_(?P<id>\d+)'
12 'url': 'https://videos.tva.ca/details/_5596811470001',
14 'id': '5596811470001',
16 'title': 'Un extrait de l\'épisode du dimanche 8 octobre 2017 !',
17 'uploader_id': '5481942443001',
18 'upload_date': '20171003',
19 'timestamp': 1507064617,
23 'skip_download': True,
25 'skip': 'HTTP Error 404: Not Found',
27 'url': 'https://video.tva.ca/details/_5596811470001',
28 'only_matching': True,
30 BRIGHTCOVE_URL_TEMPLATE
= 'http://players.brightcove.net/5481942443001/default_default/index.html?videoId=%s'
32 def _real_extract(self
, url
):
33 video_id
= self
._match
_id
(url
)
36 '_type': 'url_transparent',
38 'url': smuggle_url(self
.BRIGHTCOVE_URL_TEMPLATE
% video_id
, {'geo_countries': ['CA']}
),
39 'ie_key': 'BrightcoveNew',
43 class QubIE(InfoExtractor
):
44 _VALID_URL
= r
'https?://(?:www\.)?qub\.ca/(?:[^/]+/)*[0-9a-z-]+-(?P<id>\d+)'
46 'url': 'https://www.qub.ca/tvaplus/tva/alerte-amber/saison-1/episode-01-1000036619',
47 'md5': '949490fd0e7aee11d0543777611fbd53',
49 'id': '6084352463001',
51 'title': 'Ép 01. Mon dernier jour',
52 'uploader_id': '5481942443001',
53 'upload_date': '20190907',
54 'timestamp': 1567899756,
55 'description': 'md5:9c0d7fbb90939420c651fd977df90145',
56 'thumbnail': r
're:https://.+\.jpg',
57 'episode': 'Ép 01. Mon dernier jour',
59 'tags': ['alerte amber', 'alerte amber saison 1', 'surdemande'],
63 'series': 'Alerte Amber',
67 'url': 'https://www.qub.ca/tele/video/lcn-ca-vous-regarde-rev-30s-ap369664-1009357943',
68 'only_matching': True,
70 # reference_id also works with old account_id(5481942443001)
71 # BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/5813221784001/default_default/index.html?videoId=ref:%s'
73 def _real_extract(self
, url
):
74 entity_id
= self
._match
_id
(url
)
75 webpage
= self
._download
_webpage
(url
, entity_id
)
76 entity
= self
._search
_nextjs
_data
(webpage
, entity_id
)['props']['initialProps']['pageProps']['fallbackData']
77 video_id
= entity
['videoId']
78 episode
= strip_or_none(entity
.get('name'))
81 '_type': 'url_transparent',
82 'url': f
'https://videos.tva.ca/details/_{video_id}',
83 'ie_key': TVAIE
.ie_key(),
87 **traverse_obj(entity
, {
88 'description': ('longDescription', {str}
),
89 'duration': ('durationMillis', {functools.partial(float_or_none, scale=1000)}
),
90 'channel': ('knownEntities', 'channel', 'name', {str}
),
91 'series': ('knownEntities', 'videoShow', 'name', {str}
),
92 'season_number': ('slug', {lambda x: re.search(r'/s(?:ai|ea)son-(\d+)/', x)}
, 1, {int_or_none}
),
93 'episode_number': ('episodeNumber', {int_or_none}
),