aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormzbaulhaque <11481344+mzbaulhaque@users.noreply.github.com>2021-08-10 02:33:12 +0600
committerGitHub <noreply@github.com>2021-08-10 02:03:12 +0530
commit246fb276e0d9ffd407a962c494f265d5d88c0ff3 (patch)
treef399491f715bebacc0b01712c43ba297ae9a73da
parent6e6e0d95b32029b0d14843ffacc18305555e2230 (diff)
downloadhypervideo-pre-246fb276e0d9ffd407a962c494f265d5d88c0ff3.tar.lz
hypervideo-pre-246fb276e0d9ffd407a962c494f265d5d88c0ff3.tar.xz
hypervideo-pre-246fb276e0d9ffd407a962c494f265d5d88c0ff3.zip
[blackboardcollaborate] Add new extractor (#646)
Authored by: Ashish0804
-rw-r--r--yt_dlp/extractor/blackboardcollaborate.py68
-rw-r--r--yt_dlp/extractor/extractors.py1
2 files changed, 69 insertions, 0 deletions
diff --git a/yt_dlp/extractor/blackboardcollaborate.py b/yt_dlp/extractor/blackboardcollaborate.py
new file mode 100644
index 000000000..95d581c1c
--- /dev/null
+++ b/yt_dlp/extractor/blackboardcollaborate.py
@@ -0,0 +1,68 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import parse_iso8601
+
+
+class BlackboardCollaborateIE(InfoExtractor):
+ _VALID_URL = r'''(?x)
+ https?://
+ (?P<region>[a-z-]+)\.bbcollab\.com/
+ (?:
+ collab/ui/session/playback/load|
+ recording
+ )/
+ (?P<id>[^/]+)'''
+ _TESTS = [
+ {
+ 'url': 'https://us-lti.bbcollab.com/collab/ui/session/playback/load/0a633b6a88824deb8c918f470b22b256',
+ 'md5': 'bb7a055682ee4f25fdb5838cdf014541',
+ 'info_dict': {
+ 'id': '0a633b6a88824deb8c918f470b22b256',
+ 'title': 'HESI A2 Information Session - Thursday, May 6, 2021 - recording_1',
+ 'ext': 'mp4',
+ 'duration': 1896000,
+ 'timestamp': 1620331399,
+ 'upload_date': '20210506',
+ },
+ },
+ {
+ 'url': 'https://us.bbcollab.com/collab/ui/session/playback/load/76761522adfe4345a0dee6794bbcabda',
+ 'only_matching': True,
+ },
+ {
+ 'url': 'https://ca.bbcollab.com/collab/ui/session/playback/load/b6399dcb44df4f21b29ebe581e22479d',
+ 'only_matching': True,
+ },
+ {
+ 'url': 'https://eu.bbcollab.com/recording/51ed7b50810c4444a106e48cefb3e6b5',
+ 'only_matching': True,
+ },
+ {
+ 'url': 'https://au.bbcollab.com/collab/ui/session/playback/load/2bccf7165d7c419ab87afc1ec3f3bb15',
+ 'only_matching': True,
+ },
+ ]
+
+ def _real_extract(self, url):
+ mobj = re.match(self._VALID_URL, url)
+ region = mobj.group('region')
+ video_id = mobj.group('id')
+ info = self._download_json(
+ 'https://{}.bbcollab.com/collab/api/csa/recordings/{}/data'.format(region, video_id), video_id)
+ duration = info.get('duration')
+ title = info['name']
+ upload_date = info.get('created')
+ streams = info['streams']
+ formats = [{'format_id': k, 'url': url} for k, url in streams.items()]
+
+ return {
+ 'duration': duration,
+ 'formats': formats,
+ 'id': video_id,
+ 'timestamp': parse_iso8601(upload_date),
+ 'title': title,
+ }
diff --git a/yt_dlp/extractor/extractors.py b/yt_dlp/extractor/extractors.py
index df0d83359..48c05a075 100644
--- a/yt_dlp/extractor/extractors.py
+++ b/yt_dlp/extractor/extractors.py
@@ -151,6 +151,7 @@ from .bitwave import (
BitwaveStreamIE,
)
from .biqle import BIQLEIE
+from .blackboardcollaborate import BlackboardCollaborateIE
from .bleacherreport import (
BleacherReportIE,
BleacherReportCMSIE,