mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-01 02:37:29 +01:00
[bbccouk] Make more robust (Closes #6345)
This commit is contained in:
parent
f3f0b8e403
commit
d97f5cd795
@ -210,12 +210,12 @@ def _extract_connections(self, media):
|
|||||||
|
|
||||||
def _extract_video(self, media, programme_id):
|
def _extract_video(self, media, programme_id):
|
||||||
formats = []
|
formats = []
|
||||||
vbr = int(media.get('bitrate'))
|
vbr = int_or_none(media.get('bitrate'))
|
||||||
vcodec = media.get('encoding')
|
vcodec = media.get('encoding')
|
||||||
service = media.get('service')
|
service = media.get('service')
|
||||||
width = int(media.get('width'))
|
width = int_or_none(media.get('width'))
|
||||||
height = int(media.get('height'))
|
height = int_or_none(media.get('height'))
|
||||||
file_size = int(media.get('media_file_size'))
|
file_size = int_or_none(media.get('media_file_size'))
|
||||||
for connection in self._extract_connections(media):
|
for connection in self._extract_connections(media):
|
||||||
conn_formats = self._extract_connection(connection, programme_id)
|
conn_formats = self._extract_connection(connection, programme_id)
|
||||||
for format in conn_formats:
|
for format in conn_formats:
|
||||||
@ -232,7 +232,7 @@ def _extract_video(self, media, programme_id):
|
|||||||
|
|
||||||
def _extract_audio(self, media, programme_id):
|
def _extract_audio(self, media, programme_id):
|
||||||
formats = []
|
formats = []
|
||||||
abr = int(media.get('bitrate'))
|
abr = int_or_none(media.get('bitrate'))
|
||||||
acodec = media.get('encoding')
|
acodec = media.get('encoding')
|
||||||
service = media.get('service')
|
service = media.get('service')
|
||||||
for connection in self._extract_connections(media):
|
for connection in self._extract_connections(media):
|
||||||
@ -300,7 +300,7 @@ def _download_playlist(self, playlist_id):
|
|||||||
if kind != 'programme' and kind != 'radioProgramme':
|
if kind != 'programme' and kind != 'radioProgramme':
|
||||||
continue
|
continue
|
||||||
programme_id = item.get('vpid')
|
programme_id = item.get('vpid')
|
||||||
duration = int(item.get('duration'))
|
duration = int_or_none(item.get('duration'))
|
||||||
formats, subtitles = self._download_media_selector(programme_id)
|
formats, subtitles = self._download_media_selector(programme_id)
|
||||||
return programme_id, title, description, duration, formats, subtitles
|
return programme_id, title, description, duration, formats, subtitles
|
||||||
except ExtractorError as ee:
|
except ExtractorError as ee:
|
||||||
@ -332,7 +332,7 @@ def _download_playlist(self, playlist_id):
|
|||||||
title = playlist.find('./{http://bbc.co.uk/2008/emp/playlist}title').text
|
title = playlist.find('./{http://bbc.co.uk/2008/emp/playlist}title').text
|
||||||
description = playlist.find('./{http://bbc.co.uk/2008/emp/playlist}summary').text
|
description = playlist.find('./{http://bbc.co.uk/2008/emp/playlist}summary').text
|
||||||
programme_id = item.get('identifier')
|
programme_id = item.get('identifier')
|
||||||
duration = int(item.get('duration'))
|
duration = int_or_none(item.get('duration'))
|
||||||
formats, subtitles = self._download_media_selector(programme_id)
|
formats, subtitles = self._download_media_selector(programme_id)
|
||||||
|
|
||||||
return programme_id, title, description, duration, formats, subtitles
|
return programme_id, title, description, duration, formats, subtitles
|
||||||
|
Loading…
Reference in New Issue
Block a user