From 4fc4cc266952b5daf526d98bcad88c7df0efe284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gregor=20D=C3=BCster?= Date: Sat, 18 Jan 2025 18:00:59 +0100 Subject: [PATCH] [ie/gotowebinar] Add extractor --- yt_dlp/extractor/_extractors.py | 1 + yt_dlp/extractor/gotowebinar.py | 55 +++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 yt_dlp/extractor/gotowebinar.py diff --git a/yt_dlp/extractor/_extractors.py b/yt_dlp/extractor/_extractors.py index d42bce21b247..82238b9e535b 100644 --- a/yt_dlp/extractor/_extractors.py +++ b/yt_dlp/extractor/_extractors.py @@ -784,6 +784,7 @@ from .gopro import GoProIE from .goshgay import GoshgayIE from .gotostage import GoToStageIE +from .gotowebinar import GoTo_WebinarIE from .gputechconf import GPUTechConfIE from .graspop import GraspopIE from .gronkh import ( diff --git a/yt_dlp/extractor/gotowebinar.py b/yt_dlp/extractor/gotowebinar.py new file mode 100644 index 000000000000..2936d0415367 --- /dev/null +++ b/yt_dlp/extractor/gotowebinar.py @@ -0,0 +1,55 @@ +from .common import InfoExtractor +from ..utils import ExtractorError + + +class GoTo_WebinarIE(InfoExtractor): + _VALID_URL = r'https?://(register|attendee)\.gotowebinar\.com/recording/viewRecording/(?P[0-9]+)/(?P[0-9]+)/(?P[^?]+)(?:\?registrantKey=(?P[0-9]+))?' + _TESTS = [ + { + # Source: https://community.intel.com/t5/Processors/Deriving-core-numbering-on-sockets-without-disabled-tiles/m-p/1263389 + 'url': 'https://register.gotowebinar.com/recording/viewRecording/8573274081823101697/1166504161772360449/mfratkin@tacc.utexas.edu?registrantKey=6636963737074316811&type=ATTENDEEEMAILRECORDINGLINK', + 'info_dict': { + 'id': '8573274081823101697-1166504161772360449', + 'title': 'Topology and Cache Coherence in Knights Landing and Skylake Xeon Processors', + 'description': 'md5:2d673910d31bfb4918a0605ea60561dd', + 'creators': 'IXPUG Committee', + 'ext': 'mp4', + }, + }, + ] + + def _real_extract(self, url): + webinar_key, recording_key, email, registrant_key = self._match_valid_url(url).group('webinar_key', 'recording_key', 'email', 'registrant_key') + video_id = f'{webinar_key}-{recording_key}' + + if not registrant_key: + registrant_metadata = self._download_json( + f'https://globalattspa.gotowebinar.com/api/webinars/{webinar_key}/registrants?email={email}', + video_id, + note='Downloading registrant metadata', + errnote='Unable to download registrant metadata') + if not (registrant_key := registrant_metadata.get('registrantKey')): + raise ExtractorError('Unable to retrieve registrant key') + + important_metadata = self._download_json( + f'https://api.services.gotomeeting.com/registrationservice/api/v1/webinars/{webinar_key}/registrants/{registrant_key}/recordingAssets?type=FOLLOWUPEMAILRECORDINGLINK&client=spa', + video_id, + note='Downloading important recording metadata', + errnote='Unable to important download recording metadata') + + non_important_metadata = self._download_json( + f'https://global.gotowebinar.com/api/webinars/{webinar_key}', + video_id, + note='Downloading non-important recording metadata', + errnote='Unable to non-important download recording metadata', + fatal=False) + + return { + 'id': video_id, + 'url': important_metadata.get('cdnLocation'), + 'ext': 'mp4', + 'is_live': False, + 'title': non_important_metadata.get('subject'), + 'description': non_important_metadata.get('description'), + 'creators': non_important_metadata.get('organizerName'), + }