mirror of
https://github.com/soimort/you-get.git
synced 2025-02-09 11:42:30 +03:00
fixed kugou download failure
This commit is contained in:
parent
fc10ea1d06
commit
2578958692
@ -144,6 +144,7 @@ fake_headers = {
|
|||||||
'Accept-Charset': 'UTF-8,*;q=0.5',
|
'Accept-Charset': 'UTF-8,*;q=0.5',
|
||||||
'Accept-Encoding': 'gzip,deflate,sdch',
|
'Accept-Encoding': 'gzip,deflate,sdch',
|
||||||
'Accept-Language': 'en-US,en;q=0.8',
|
'Accept-Language': 'en-US,en;q=0.8',
|
||||||
|
'Cookie': 'kg_mid=6b51749a6a9be5b85f19623d46ea8c0b;',
|
||||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Firefox/60.0', # noqa
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Firefox/60.0', # noqa
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ def kugou_download_by_hash(url,output_dir = '.', merge = True, info_only = False
|
|||||||
#url_sample:http://www.kugou.com/song/#hash=93F7D2FC6E95424739448218B591AEAF&album_id=9019462
|
#url_sample:http://www.kugou.com/song/#hash=93F7D2FC6E95424739448218B591AEAF&album_id=9019462
|
||||||
hash_val = match1(url,'hash=(\w+)')
|
hash_val = match1(url,'hash=(\w+)')
|
||||||
album_id = match1(url,'album_id=(\d+)')
|
album_id = match1(url,'album_id=(\d+)')
|
||||||
html = get_html("http://www.kugou.com/yy/index.php?r=play/getdata&hash={}&album_id={}".format(hash_val,album_id))
|
html = get_html("http://www.kugou.com/yy/index.php?r=play/getdata&hash={}&album_id={}".format(hash_val,album_id), None, True)
|
||||||
j =loads(html)
|
j =loads(html)
|
||||||
url = j['data']['play_url']
|
url = j['data']['play_url']
|
||||||
title = j['data']['audio_name']
|
title = j['data']['audio_name']
|
||||||
|
@ -8,6 +8,7 @@ from you_get.extractors import (
|
|||||||
youtube,
|
youtube,
|
||||||
bilibili,
|
bilibili,
|
||||||
toutiao,
|
toutiao,
|
||||||
|
kugou,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -31,6 +32,11 @@ class YouGetTests(unittest.TestCase):
|
|||||||
'http://www.youtube.com/attribution_link?u=/watch?v%3DldAKIzq7bvs%26feature%3Dshare', # noqa
|
'http://www.youtube.com/attribution_link?u=/watch?v%3DldAKIzq7bvs%26feature%3Dshare', # noqa
|
||||||
info_only=True
|
info_only=True
|
||||||
)
|
)
|
||||||
|
def test_kugou(self):
|
||||||
|
kugou.download(
|
||||||
|
'http://www.kugou.com/song/#hash=7841D696F28B57B3BA91CB23BC080A24&album_id=566329', # noqa
|
||||||
|
info_only=True
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
Reference in New Issue
Block a user