]>
Commit | Line | Data |
---|---|---|
246fb276 | 1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
4 | import re | |
5 | ||
6 | from .common import InfoExtractor | |
7 | from ..utils import parse_iso8601 | |
8 | ||
9 | ||
10 | class BlackboardCollaborateIE(InfoExtractor): | |
11 | _VALID_URL = r'''(?x) | |
12 | https?:// | |
13 | (?P<region>[a-z-]+)\.bbcollab\.com/ | |
14 | (?: | |
15 | collab/ui/session/playback/load| | |
16 | recording | |
17 | )/ | |
18 | (?P<id>[^/]+)''' | |
19 | _TESTS = [ | |
20 | { | |
21 | 'url': 'https://us-lti.bbcollab.com/collab/ui/session/playback/load/0a633b6a88824deb8c918f470b22b256', | |
22 | 'md5': 'bb7a055682ee4f25fdb5838cdf014541', | |
23 | 'info_dict': { | |
24 | 'id': '0a633b6a88824deb8c918f470b22b256', | |
25 | 'title': 'HESI A2 Information Session - Thursday, May 6, 2021 - recording_1', | |
26 | 'ext': 'mp4', | |
27 | 'duration': 1896000, | |
28 | 'timestamp': 1620331399, | |
29 | 'upload_date': '20210506', | |
30 | }, | |
31 | }, | |
32 | { | |
33 | 'url': 'https://us.bbcollab.com/collab/ui/session/playback/load/76761522adfe4345a0dee6794bbcabda', | |
34 | 'only_matching': True, | |
35 | }, | |
36 | { | |
37 | 'url': 'https://ca.bbcollab.com/collab/ui/session/playback/load/b6399dcb44df4f21b29ebe581e22479d', | |
38 | 'only_matching': True, | |
39 | }, | |
40 | { | |
41 | 'url': 'https://eu.bbcollab.com/recording/51ed7b50810c4444a106e48cefb3e6b5', | |
42 | 'only_matching': True, | |
43 | }, | |
44 | { | |
45 | 'url': 'https://au.bbcollab.com/collab/ui/session/playback/load/2bccf7165d7c419ab87afc1ec3f3bb15', | |
46 | 'only_matching': True, | |
47 | }, | |
48 | ] | |
49 | ||
50 | def _real_extract(self, url): | |
51 | mobj = re.match(self._VALID_URL, url) | |
52 | region = mobj.group('region') | |
53 | video_id = mobj.group('id') | |
54 | info = self._download_json( | |
55 | 'https://{}.bbcollab.com/collab/api/csa/recordings/{}/data'.format(region, video_id), video_id) | |
56 | duration = info.get('duration') | |
57 | title = info['name'] | |
58 | upload_date = info.get('created') | |
59 | streams = info['streams'] | |
60 | formats = [{'format_id': k, 'url': url} for k, url in streams.items()] | |
61 | ||
62 | return { | |
63 | 'duration': duration, | |
64 | 'formats': formats, | |
65 | 'id': video_id, | |
66 | 'timestamp': parse_iso8601(upload_date), | |
67 | 'title': title, | |
68 | } |