From 13d26842633bb213c402f44d391b2feb220cca50 Mon Sep 17 00:00:00 2001 From: df Date: Mon, 5 Apr 2021 11:37:30 +0100 Subject: [PATCH] Support BBC World (etc) pages with data in SIMORGH_DATA JSON --- youtube_dl/extractor/bbc.py | 103 +++++++++++++++++++++++++++++++++--- 1 file changed, 97 insertions(+), 6 deletions(-) diff --git a/youtube_dl/extractor/bbc.py b/youtube_dl/extractor/bbc.py index e8d000bbb..d6aa7bfa2 100644 --- a/youtube_dl/extractor/bbc.py +++ b/youtube_dl/extractor/bbc.py @@ -23,6 +23,7 @@ from ..utils import ( get_element_by_class, int_or_none, js_to_json, + parse_bitrate, parse_duration, parse_iso8601, try_get, @@ -635,9 +636,7 @@ class BBCIE(BBCCoUkIE): 'skip_download': True, } }, { - # article with single video embedded with data-playable containing XML playlist - # with direct video links as progressiveDownloadUrl (for now these are extracted) - # and playlist with f4m and m3u8 as streamingUrl + # article with single video (formerly) embedded, now using SIMORGH_DATA JSON 'url': 'http://www.bbc.com/turkce/haberler/2015/06/150615_telabyad_kentin_cogu', 'info_dict': { 'id': '150615_telabyad_kentin_cogu', @@ -649,12 +648,13 @@ class BBCIE(BBCCoUkIE): }, 'params': { 'skip_download': True, - } + }, + 'skip': 'Video no longer embedded, 2021', }, { - # single video embedded with data-playable containing XML playlists (regional section) + # single video embedded, legacy media, in promo object of SIMORGH_DATA JSON 'url': 'http://www.bbc.com/mundo/video_fotos/2015/06/150619_video_honduras_militares_hospitales_corrupcion_aw', 'info_dict': { - 'id': '150619_video_honduras_militares_hospitales_corrupcion_aw', + 'id': '39275083', 'ext': 'mp4', 'title': 'Honduras militariza sus hospitales por nuevo escándalo de corrupción', 'description': 'md5:1525f17448c4ee262b64b8f0c9ce66c8', @@ -812,6 +812,18 @@ class BBCIE(BBCCoUkIE): 'upload_date': '20190604', 'categories': ['Psychology'], }, + }, { + # BBC World Service etc: media nested in content object of SIMORGH_DATA JSON + 'url': 'http://www.bbc.co.uk/scotland/articles/cm49v4x1r9lo', + 'info_dict': { + 'id': 'p06p040v', + 'ext': 'mp4', + 'title': 'Five things ants can teach us about management', + 'description': 'They may be tiny, but us humans could learn a thing or two from ants.', + 'duration': 191, + 'thumbnail': r're:https?://.+/p06p0qzv.jpg', + 'upload_date': '20181016', + }, }] @classmethod @@ -1074,6 +1086,85 @@ class BBCIE(BBCCoUkIE): 'subtitles': subtitles, } + # simorgh-based playlist (see https://github.com/bbc/simorgh) + # JSON assigned to window.SIMORGH_DATA in a