[reverbnation] The 'uploader_id' field must be a string

This commit is contained in:
Jaime Marquínez Ferrándiz 2014-08-10 11:00:14 +02:00
parent 511c4325dc
commit 40a90862f4
2 changed files with 6 additions and 3 deletions

View file

@ -3,7 +3,7 @@ from __future__ import unicode_literals
import re import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import strip_jsonp from ..utils import str_or_none
class ReverbNationIE(InfoExtractor): class ReverbNationIE(InfoExtractor):
@ -16,7 +16,7 @@ class ReverbNationIE(InfoExtractor):
"ext": "mp3", "ext": "mp3",
"title": "MONA LISA", "title": "MONA LISA",
"uploader": "ALKILADOS", "uploader": "ALKILADOS",
"uploader_id": 216429, "uploader_id": "216429",
"thumbnail": "re:^https://gp1\.wac\.edgecastcdn\.net/.*?\.jpg$" "thumbnail": "re:^https://gp1\.wac\.edgecastcdn\.net/.*?\.jpg$"
}, },
}] }]
@ -36,7 +36,7 @@ class ReverbNationIE(InfoExtractor):
'title': api_res.get('name'), 'title': api_res.get('name'),
'url': api_res.get('url'), 'url': api_res.get('url'),
'uploader': api_res.get('artist', {}).get('name'), 'uploader': api_res.get('artist', {}).get('name'),
'uploader_id': api_res.get('artist', {}).get('id'), 'uploader_id': str_or_none(api_res.get('artist', {}).get('id')),
'thumbnail': self._proto_relative_url( 'thumbnail': self._proto_relative_url(
api_res.get('image', api_res.get('thumbnail'))), api_res.get('image', api_res.get('thumbnail'))),
'ext': 'mp3', 'ext': 'mp3',

View file

@ -1275,6 +1275,9 @@ def int_or_none(v, scale=1, default=None, get_attr=None, invscale=1):
v = getattr(v, get_attr, None) v = getattr(v, get_attr, None)
return default if v is None else (int(v) * invscale // scale) return default if v is None else (int(v) * invscale // scale)
def str_or_none(v, default=None):
return default if v is None else compat_str(v)
def str_to_int(int_str): def str_to_int(int_str):
if int_str is None: if int_str is None: