mirror of https://github.com/yt-dlp/yt-dlp.git
[ie/Qub] Fix extractor (#7019)
Closes #4989 Authored by: alexhuot1, dirkf
This commit is contained in:
parent
c4b87dd885
commit
6b54cccdcb
|
@ -1,10 +1,9 @@
|
||||||
|
import functools
|
||||||
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import float_or_none, int_or_none, smuggle_url, strip_or_none
|
||||||
float_or_none,
|
from ..utils.traversal import traverse_obj
|
||||||
int_or_none,
|
|
||||||
smuggle_url,
|
|
||||||
strip_or_none,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class TVAIE(InfoExtractor):
|
class TVAIE(InfoExtractor):
|
||||||
|
@ -49,11 +48,20 @@ class QubIE(InfoExtractor):
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '6084352463001',
|
'id': '6084352463001',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Épisode 01',
|
'title': 'Ép 01. Mon dernier jour',
|
||||||
'uploader_id': '5481942443001',
|
'uploader_id': '5481942443001',
|
||||||
'upload_date': '20190907',
|
'upload_date': '20190907',
|
||||||
'timestamp': 1567899756,
|
'timestamp': 1567899756,
|
||||||
'description': 'md5:9c0d7fbb90939420c651fd977df90145',
|
'description': 'md5:9c0d7fbb90939420c651fd977df90145',
|
||||||
|
'thumbnail': r're:https://.+\.jpg',
|
||||||
|
'episode': 'Ép 01. Mon dernier jour',
|
||||||
|
'episode_number': 1,
|
||||||
|
'tags': ['alerte amber', 'alerte amber saison 1', 'surdemande'],
|
||||||
|
'duration': 2625.963,
|
||||||
|
'season': 'Season 1',
|
||||||
|
'season_number': 1,
|
||||||
|
'series': 'Alerte Amber',
|
||||||
|
'channel': 'TVA',
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://www.qub.ca/tele/video/lcn-ca-vous-regarde-rev-30s-ap369664-1009357943',
|
'url': 'https://www.qub.ca/tele/video/lcn-ca-vous-regarde-rev-30s-ap369664-1009357943',
|
||||||
|
@ -64,22 +72,24 @@ class QubIE(InfoExtractor):
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
entity_id = self._match_id(url)
|
entity_id = self._match_id(url)
|
||||||
entity = self._download_json(
|
webpage = self._download_webpage(url, entity_id)
|
||||||
'https://www.qub.ca/proxy/pfu/content-delivery-service/v1/entities',
|
entity = self._search_nextjs_data(webpage, entity_id)['props']['initialProps']['pageProps']['fallbackData']
|
||||||
entity_id, query={'id': entity_id})
|
|
||||||
video_id = entity['videoId']
|
video_id = entity['videoId']
|
||||||
episode = strip_or_none(entity.get('name'))
|
episode = strip_or_none(entity.get('name'))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'_type': 'url_transparent',
|
'_type': 'url_transparent',
|
||||||
|
'url': f'https://videos.tva.ca/details/_{video_id}',
|
||||||
|
'ie_key': TVAIE.ie_key(),
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': episode,
|
'title': episode,
|
||||||
# 'url': self.BRIGHTCOVE_URL_TEMPLATE % entity['referenceId'],
|
|
||||||
'url': 'https://videos.tva.ca/details/_' + video_id,
|
|
||||||
'description': entity.get('longDescription'),
|
|
||||||
'duration': float_or_none(entity.get('durationMillis'), 1000),
|
|
||||||
'episode': episode,
|
'episode': episode,
|
||||||
'episode_number': int_or_none(entity.get('episodeNumber')),
|
**traverse_obj(entity, {
|
||||||
# 'ie_key': 'BrightcoveNew',
|
'description': ('longDescription', {str}),
|
||||||
'ie_key': TVAIE.ie_key(),
|
'duration': ('durationMillis', {functools.partial(float_or_none, scale=1000)}),
|
||||||
|
'channel': ('knownEntities', 'channel', 'name', {str}),
|
||||||
|
'series': ('knownEntities', 'videoShow', 'name', {str}),
|
||||||
|
'season_number': ('slug', {lambda x: re.search(r'/s(?:ai|ea)son-(\d+)/', x)}, 1, {int_or_none}),
|
||||||
|
'episode_number': ('episodeNumber', {int_or_none}),
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue