[ie/dropout] Fix extraction (#12102)
[yt-dlp.git] / yt_dlp / extractor / drtalks.py
blob5ea7f75807edb9b1da82d7b42f43742c7dfec081
1 from .brightcove import BrightcoveNewIE
2 from .common import InfoExtractor
3 from ..utils import url_or_none
4 from ..utils.traversal import traverse_obj
7 class DrTalksIE(InfoExtractor):
8 _VALID_URL = r'https?://(?:www\.)?drtalks\.com/videos/(?P<id>[\w-]+)'
9 _TESTS = [{
10 'url': 'https://drtalks.com/videos/six-pillars-of-resilience-tools-for-managing-stress-and-flourishing/',
11 'info_dict': {
12 'id': '6366193757112',
13 'ext': 'mp4',
14 'uploader_id': '6314452011001',
15 'tags': ['resilience'],
16 'description': 'md5:9c6805aee237ee6de8052461855b9dda',
17 'timestamp': 1734546659,
18 'thumbnail': 'https://drtalks.com/wp-content/uploads/2024/12/Episode-82-Eva-Selhub-DrTalks-Thumbs.jpg',
19 'title': 'Six Pillars of Resilience: Tools for Managing Stress and Flourishing',
20 'duration': 2800.682,
21 'upload_date': '20241218',
23 }, {
24 'url': 'https://drtalks.com/videos/the-pcos-puzzle-mastering-metabolic-health-with-marcelle-pick/',
25 'info_dict': {
26 'id': '6364699891112',
27 'ext': 'mp4',
28 'title': 'The PCOS Puzzle: Mastering Metabolic Health with Marcelle Pick',
29 'description': 'md5:e87cbe00ca50135d5702787fc4043aaa',
30 'thumbnail': 'https://drtalks.com/wp-content/uploads/2024/11/Episode-34-Marcelle-Pick-OBGYN-NP-DrTalks.jpg',
31 'duration': 3515.2,
32 'tags': ['pcos'],
33 'upload_date': '20241114',
34 'timestamp': 1731592119,
35 'uploader_id': '6314452011001',
39 def _real_extract(self, url):
40 video_id = self._match_id(url)
41 webpage = self._download_webpage(url, video_id)
42 next_data = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['data']['video']
44 return self.url_result(
45 next_data['videos']['brightcoveVideoLink'], BrightcoveNewIE, video_id,
46 url_transparent=True,
47 **traverse_obj(next_data, {
48 'title': ('title', {str}),
49 'description': ('videos', 'summury', {str}),
50 'thumbnail': ('featuredImage', 'node', 'sourceUrl', {url_or_none}),
51 }))