mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-14 01:05:06 +00:00
86e5f3ed2e
Using https://github.com/asottile/pyupgrade 1. `__future__` imports and `coding: utf-8` were removed 2. Files were rewritten with `pyupgrade --py36-plus --keep-percent-format` 3. f-strings were cherry-picked from `pyupgrade --py36-plus` Extractors are left untouched (except removing header) to avoid unnecessary merge conflicts
49 lines
1.7 KiB
Python
49 lines
1.7 KiB
Python
from .common import InfoExtractor
|
|
|
|
|
|
class CTVIE(InfoExtractor):
|
|
_VALID_URL = r'https?://(?:www\.)?ctv\.ca/(?P<id>(?:show|movie)s/[^/]+/[^/?#&]+)'
|
|
_TESTS = [{
|
|
'url': 'https://www.ctv.ca/shows/your-morning/wednesday-december-23-2020-s5e88',
|
|
'info_dict': {
|
|
'id': '2102249',
|
|
'ext': 'flv',
|
|
'title': 'Wednesday, December 23, 2020',
|
|
'thumbnail': r're:^https?://.*\.jpg$',
|
|
'description': 'Your Morning delivers original perspectives and unique insights into the headlines of the day.',
|
|
'timestamp': 1608732000,
|
|
'upload_date': '20201223',
|
|
'series': 'Your Morning',
|
|
'season': '2020-2021',
|
|
'season_number': 5,
|
|
'episode_number': 88,
|
|
'tags': ['Your Morning'],
|
|
'categories': ['Talk Show'],
|
|
'duration': 7467.126,
|
|
},
|
|
}, {
|
|
'url': 'https://www.ctv.ca/movies/adam-sandlers-eight-crazy-nights/adam-sandlers-eight-crazy-nights',
|
|
'only_matching': True,
|
|
}]
|
|
|
|
def _real_extract(self, url):
|
|
display_id = self._match_id(url)
|
|
content = self._download_json(
|
|
'https://www.ctv.ca/space-graphql/graphql', display_id, query={
|
|
'query': '''{
|
|
resolvedPath(path: "/%s") {
|
|
lastSegment {
|
|
content {
|
|
... on AxisContent {
|
|
axisId
|
|
videoPlayerDestCode
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}''' % display_id,
|
|
})['data']['resolvedPath']['lastSegment']['content']
|
|
video_id = content['axisId']
|
|
return self.url_result(
|
|
'9c9media:%s:%s' % (content['videoPlayerDestCode'], video_id),
|
|
'NineCNineMedia', video_id)
|