update common.py

bilibili http466  因为 http://interface.bilibili.com/playurl没加ua导致接口返回数据里的链接是466, 修改之后就好了
This commit is contained in:
mq-liu 2018-01-03 09:58:29 +08:00 committed by GitHub
parent 6e17b0c7f9
commit 5748616994
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -404,7 +404,8 @@ def get_content(url, headers={}, decoded=True):
"""
logging.debug('get_content: %s' % url)
if 'User-Agent' not in headers.keys():
headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36'
req = request.Request(url, headers=headers)
if cookies:
cookies.add_cookie_header(req)