From d97f5cd795b0bd8b6bd636b899bdbc8b10d5907b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergey=20M=E2=80=A4?= Date: Fri, 24 Jul 2015 02:56:54 +0600 Subject: [PATCH] [bbccouk] Make more robust (Closes #6345) --- youtube_dl/extractor/bbccouk.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/youtube_dl/extractor/bbccouk.py b/youtube_dl/extractor/bbccouk.py index 5825d2867..b2e5f7418 100644 --- a/youtube_dl/extractor/bbccouk.py +++ b/youtube_dl/extractor/bbccouk.py @@ -210,12 +210,12 @@ def _extract_connections(self, media): def _extract_video(self, media, programme_id): formats = [] - vbr = int(media.get('bitrate')) + vbr = int_or_none(media.get('bitrate')) vcodec = media.get('encoding') service = media.get('service') - width = int(media.get('width')) - height = int(media.get('height')) - file_size = int(media.get('media_file_size')) + width = int_or_none(media.get('width')) + height = int_or_none(media.get('height')) + file_size = int_or_none(media.get('media_file_size')) for connection in self._extract_connections(media): conn_formats = self._extract_connection(connection, programme_id) for format in conn_formats: @@ -232,7 +232,7 @@ def _extract_video(self, media, programme_id): def _extract_audio(self, media, programme_id): formats = [] - abr = int(media.get('bitrate')) + abr = int_or_none(media.get('bitrate')) acodec = media.get('encoding') service = media.get('service') for connection in self._extract_connections(media): @@ -300,7 +300,7 @@ def _download_playlist(self, playlist_id): if kind != 'programme' and kind != 'radioProgramme': continue 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) return programme_id, title, description, duration, formats, subtitles 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 description = playlist.find('./{http://bbc.co.uk/2008/emp/playlist}summary').text 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) return programme_id, title, description, duration, formats, subtitles