Skip to content

Commit e6bd4a3

Browse files
authored
[ie/brightcove:new] Improve metadata extraction (yt-dlp#13461)
Authored by: doe1080
1 parent 5188748 commit e6bd4a3

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

yt_dlp/extractor/brightcove.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,6 @@ def _real_extract(self, url):
495495

496496
class BrightcoveNewBaseIE(AdobePassIE):
497497
def _parse_brightcove_metadata(self, json_data, video_id, headers={}):
498-
title = json_data['name'].strip()
499-
500498
formats, subtitles = [], {}
501499
sources = json_data.get('sources') or []
502500
for source in sources:
@@ -600,16 +598,18 @@ def build_format_id(kind):
600598

601599
return {
602600
'id': video_id,
603-
'title': title,
604-
'description': clean_html(json_data.get('description')),
605601
'thumbnails': thumbnails,
606602
'duration': duration,
607-
'timestamp': parse_iso8601(json_data.get('published_at')),
608-
'uploader_id': json_data.get('account_id'),
609603
'formats': formats,
610604
'subtitles': subtitles,
611-
'tags': json_data.get('tags', []),
612605
'is_live': is_live,
606+
**traverse_obj(json_data, {
607+
'title': ('name', {clean_html}),
608+
'description': ('description', {clean_html}),
609+
'tags': ('tags', ..., {str}, filter, all, filter),
610+
'timestamp': ('published_at', {parse_iso8601}),
611+
'uploader_id': ('account_id', {str}),
612+
}),
613613
}
614614

615615

@@ -645,10 +645,7 @@ class BrightcoveNewIE(BrightcoveNewBaseIE):
645645
'uploader_id': '4036320279001',
646646
'formats': 'mincount:39',
647647
},
648-
'params': {
649-
# m3u8 download
650-
'skip_download': True,
651-
},
648+
'skip': '404 Not Found',
652649
}, {
653650
# playlist stream
654651
'url': 'https://players.brightcove.net/1752604059001/S13cJdUBz_default/index.html?playlistId=5718313430001',
@@ -709,7 +706,6 @@ class BrightcoveNewIE(BrightcoveNewBaseIE):
709706
'ext': 'mp4',
710707
'title': 'TGD_01-032_5',
711708
'thumbnail': r're:^https?://.*\.jpg$',
712-
'tags': [],
713709
'timestamp': 1646078943,
714710
'uploader_id': '1569565978001',
715711
'upload_date': '20220228',
@@ -721,7 +717,6 @@ class BrightcoveNewIE(BrightcoveNewBaseIE):
721717
'ext': 'mp4',
722718
'title': 'TGD 01-087 (Airs 05.25.22)_Segment 5',
723719
'thumbnail': r're:^https?://.*\.jpg$',
724-
'tags': [],
725720
'timestamp': 1651604591,
726721
'uploader_id': '1569565978001',
727722
'upload_date': '20220503',

0 commit comments

Comments
 (0)