1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-22 16:44:32 +01:00

Update bbc.py

This commit is contained in:
ajj8 2020-10-21 15:23:10 +01:00 committed by GitHub
parent 40caf37ad0
commit 009cf65c74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -916,16 +916,16 @@ class BBCIE(BBCCoUkIE):
for key in initial_data['data']: for key in initial_data['data']:
data = initial_data['data'][key].get('data') data = initial_data['data'][key].get('data')
if data and isinstance(data, dict): if data and isinstance(data, dict):
mediaItem = None mediaItems = []
initialItem = data.get('initialItem') initialItem = data.get('initialItem')
blocks = data.get('blocks') blocks = data.get('blocks')
if initialItem: if initialItem:
mediaItem = initialItem.get('mediaItem') mediaItems.append(initialItem.get('mediaItem'))
elif blocks: if blocks:
for block in blocks: for block in blocks:
if block.get('type') == 'media': if block.get('type') == 'media':
mediaItem = block.get('model') mediaItems.append(block.get('model'))
if mediaItem: for mediaItem in mediaItems:
title = mediaItem['title']['content'] if mediaItem.get('title') else mediaItem.get('caption') title = mediaItem['title']['content'] if mediaItem.get('title') else mediaItem.get('caption')
description = '\n'.join([block['model']['text'] for block in mediaItem['summary']['blocks']]) if mediaItem.get('summary') else None description = '\n'.join([block['model']['text'] for block in mediaItem['summary']['blocks']]) if mediaItem.get('summary') else None
programme_id = mediaItem['media']['items'][0]['id'] programme_id = mediaItem['media']['items'][0]['id']