aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2020-12-24 19:40:08 +0100
committerRemita Amine <remitamine@gmail.com>2020-12-24 19:40:08 +0100
commit7f3c90ab252e212c67c8aa80d2e83fb9b686ee6d (patch)
tree37780c487ac30fe5ac41357a9429434a2ed674ed /youtube_dl
parent1d3cd2973041afb42d9e903735a0fcee7bd8c447 (diff)
[ctv] Add new extractor (closes #27525)
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/ctv.py52
-rw-r--r--youtube_dl/extractor/extractors.py1
2 files changed, 53 insertions, 0 deletions
diff --git a/youtube_dl/extractor/ctv.py b/youtube_dl/extractor/ctv.py
new file mode 100644
index 000000000..756bcc2be
--- /dev/null
+++ b/youtube_dl/extractor/ctv.py
@@ -0,0 +1,52 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+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)
diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py
index 96fa3b39b..2e34c1d28 100644
--- a/youtube_dl/extractor/extractors.py
+++ b/youtube_dl/extractor/extractors.py
@@ -244,6 +244,7 @@ from .crunchyroll import (
)
from .cspan import CSpanIE
from .ctsnews import CtsNewsIE
+from .ctv import CTVIE
from .ctvnews import CTVNewsIE
from .cultureunplugged import CultureUnpluggedIE
from .curiositystream import (