]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[neteasemusic] Use float_or_none
authorYen Chi Hsuan <yan12125@gmail.com>
Tue, 19 Jan 2016 20:21:51 +0000 (04:21 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Tue, 19 Jan 2016 20:21:51 +0000 (04:21 +0800)
youtube_dl/extractor/neteasemusic.py

index 435cd8e2eeceb59f716f2871521595918cc9eb54..7830616f8fb9498c058504d52c199c6a69a9d98b 100644 (file)
@@ -12,7 +12,10 @@ from ..compat import (
     compat_str,
     compat_itertools_count,
 )
-from ..utils import sanitized_Request
+from ..utils import (
+    sanitized_Request,
+    float_or_none,
+)
 
 
 class NetEaseMusicBaseIE(InfoExtractor):
@@ -52,7 +55,7 @@ class NetEaseMusicBaseIE(InfoExtractor):
                     formats.append({
                         'url': song_url,
                         'ext': details.get('extension'),
-                        'abr': details.get('bitrate', 0) / 1000,
+                        'abr': float_or_none(details.get('bitrate'), scale=1000),
                         'format_id': song_format,
                         'filesize': details.get('size'),
                         'asr': details.get('sr')