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