From 3bd8910ffb1a85a3f70ddb312dbff9e9632f23fc Mon Sep 17 00:00:00 2001 From: MaxwellGoblin Date: Tue, 9 May 2017 10:17:42 +0800 Subject: [PATCH] [ximalaya] use fake_headers to fetch json --- src/you_get/extractors/ximalaya.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/you_get/extractors/ximalaya.py b/src/you_get/extractors/ximalaya.py index 58a158ba..58e2945c 100644 --- a/src/you_get/extractors/ximalaya.py +++ b/src/you_get/extractors/ximalaya.py @@ -15,7 +15,8 @@ stream_types = [ def ximalaya_download_by_id(id, title = None, output_dir = '.', info_only = False, stream_id = None): BASE_URL = 'http://www.ximalaya.com/tracks/' - json_data = json.loads(get_content(BASE_URL + id + '.json')) + json_url = BASE_URL + id + '.json' + json_data = json.loads(get_content(json_url, headers=fake_headers)) if 'res' in json_data: if json_data['res'] == False: raise ValueError('Server reported id %s is invalid' % id)