replace explicit dict gets with .get and blank fallback

This commit is contained in:
einstein95 2018-01-13 01:06:46 +13:00
parent 1c145357bf
commit 33118b603a

View File

@ -29,16 +29,16 @@ class RENTVIE(InfoExtractor):
config = self._parse_json(self._search_regex( config = self._parse_json(self._search_regex(
r'config\s*=\s*({.+});', webpage, 'config'), video_id) r'config\s*=\s*({.+});', webpage, 'config'), video_id)
formats = [] formats = []
for video in config['src']: for video in config.get('src', ''):
formats.append({ formats.append({
'url': video['src'] 'url': video.get('src', '')
}) })
self._sort_formats(formats) self._sort_formats(formats)
return { return {
'id': video_id, 'id': video_id,
'formats': formats, 'formats': formats,
'title': config['title'], 'title': config.get('title', ''),
'thumbnail': config['image'] 'thumbnail': config.get('image', '')
} }