diff options
author | remitamine <remitamine@gmail.com> | 2015-12-05 18:47:15 +0100 |
---|---|---|
committer | remitamine <remitamine@gmail.com> | 2015-12-05 18:47:15 +0100 |
commit | cb160dd531f328b2c741e4712fae560e1cec3f90 (patch) | |
tree | 4de9b1367806033517c9920a2a91e28fdabce0b2 /youtube_dl/extractor/nba.py | |
parent | 77334ccb44c06ea2d9308b334aecc612c2f3240e (diff) |
[nba] handle format info properly
Diffstat (limited to 'youtube_dl/extractor/nba.py')
-rw-r--r-- | youtube_dl/extractor/nba.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/youtube_dl/extractor/nba.py b/youtube_dl/extractor/nba.py index d8f901b55..5a3eb0833 100644 --- a/youtube_dl/extractor/nba.py +++ b/youtube_dl/extractor/nba.py @@ -77,14 +77,18 @@ class NBAIE(InfoExtractor): formats.extend(f4m_formats) else: key = video_file.attrib.get('bitrate') - mobj = re.search(r'(\d+)x(\d+)(?:_(\d+))?', key) - formats.append({ + format_info = { 'format_id': key, 'url': video_url, - 'width': int_or_none(mobj.group(1)), - 'height': int_or_none(mobj.group(2)), - 'tbr': int_or_none(mobj.group(3)), - }) + } + mobj = re.search(r'(\d+)x(\d+)(?:_(\d+))?', key) + if mobj: + format_info.update({ + 'width': int_or_none(mobj.group(1)), + 'height': int_or_none(mobj.group(2)), + 'tbr': int_or_none(mobj.group(3)), + }) + formats.append(format_info) self._sort_formats(formats) return { |