[ie/dplay] Fix extractors (#10471)
[yt-dlp3.git] / yt_dlp / extractor / cellebrite.py
blob54367c4d52c8dae6f85d7cdcc037fd04caf37593
1 from .vidyard import VidyardBaseIE, VidyardIE
2 from ..utils import ExtractorError, make_archive_id, url_basename
5 class CellebriteIE(VidyardBaseIE):
6 _VALID_URL = r'https?://cellebrite\.com/(?:\w+)?/(?P<id>[\w-]+)'
7 _TESTS = [{
8 'url': 'https://cellebrite.com/en/collect-data-from-android-devices-with-cellebrite-ufed/',
9 'info_dict': {
10 'id': 'ZqmUss3dQfEMGpauambPuH',
11 'display_id': '16025876',
12 'ext': 'mp4',
13 'title': 'Ask the Expert: Chat Capture - Collect Data from Android Devices in Cellebrite UFED',
14 'description': 'md5:dee48fe12bbae5c01fe6a053f7676da4',
15 'thumbnail': 'https://cellebrite.com/wp-content/uploads/2021/05/Chat-Capture-1024x559.png',
16 'duration': 455.979,
17 '_old_archive_ids': ['cellebrite 16025876'],
19 }, {
20 'url': 'https://cellebrite.com/en/how-to-lawfully-collect-the-maximum-amount-of-data-from-android-devices/',
21 'info_dict': {
22 'id': 'QV1U8a2yzcxigw7VFnqKyg',
23 'display_id': '29018255',
24 'ext': 'mp4',
25 'title': 'How to Lawfully Collect the Maximum Amount of Data From Android Devices',
26 'description': 'md5:0e943a9ac14c374d5d74faed634d773c',
27 'thumbnail': 'https://cellebrite.com/wp-content/uploads/2022/07/How-to-Lawfully-Collect-the-Maximum-Amount-of-Data-From-Android-Devices.png',
28 'duration': 134.315,
29 '_old_archive_ids': ['cellebrite 29018255'],
33 def _real_extract(self, url):
34 slug = self._match_id(url)
35 webpage = self._download_webpage(url, slug)
36 vidyard_url = next(VidyardIE._extract_embed_urls(url, webpage), None)
37 if not vidyard_url:
38 raise ExtractorError('No Vidyard video embeds found on page')
40 video_id = url_basename(vidyard_url)
41 info = self._process_video_json(self._fetch_video_json(video_id)['chapters'][0], video_id)
42 if info.get('display_id'):
43 info['_old_archive_ids'] = [make_archive_id(self, info['display_id'])]
44 if thumbnail := self._og_search_thumbnail(webpage, default=None):
45 info.setdefault('thumbnails', []).append({'url': thumbnail})
47 return {
48 'description': self._og_search_description(webpage, default=None),
49 **info,