mirror of
https://github.com/soimort/you-get.git
synced 2025-02-03 00:33:58 +03:00
update
This commit is contained in:
parent
81b9b23271
commit
148b14fd20
@ -11,9 +11,9 @@ import hashlib
|
||||
import base64
|
||||
import os
|
||||
|
||||
################################################################################
|
||||
from Crypto.Cipher import AES
|
||||
import codecs
|
||||
HEADER = {"Referer": "http://music.163.com/"}
|
||||
|
||||
|
||||
def aes_encrypt(text, secKey):
|
||||
@ -22,33 +22,19 @@ def aes_encrypt(text, secKey):
|
||||
encryptor = AES.new(secKey, 2, '0102030405060708')
|
||||
ciphertext = encryptor.encrypt(text)
|
||||
ciphertext = base64.b64encode(ciphertext)
|
||||
# return ciphertext
|
||||
return ciphertext.decode()
|
||||
|
||||
|
||||
def get_mp3_link(song_id):
|
||||
header = {
|
||||
'Referer': 'http://music.163.com/',
|
||||
'Host': 'music.163.com',
|
||||
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36',
|
||||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
|
||||
}
|
||||
def get_mp3_url(song_id):
|
||||
text = '{"ids":[%s], br:"320000",csrf_token:"csrf"}' % song_id
|
||||
nonce = '0CoJUm6Qyw8W8jud'
|
||||
nonce2 = 16 * 'F'
|
||||
params = aes_encrypt(aes_encrypt(text,nonce),nonce2)
|
||||
encSecKey = '257348aecb5e556c066de214e531faadd1c55d814f9be95fd06d6bff9f4c7a41f831f6394d5a3fd2e3881736d94a02ca919d952872e7d0a50ebfa1769a7a62d512f5f1ca21aec60bc3819a9c3ffca5eca9a0dba6d6f7249b06f5965ecfff3695b54e1c28f3f624750ed39e7de08fc8493242e26dbc4484a01c76f739e135637c'
|
||||
# data = {'params': self.create_params(song_id), 'encSecKey': self.__encSecKey}
|
||||
data = {'params': params, 'encSecKey': encSecKey}
|
||||
url = "http://music.163.com/weapi/song/enhance/player/url?csrf_token="
|
||||
try:
|
||||
req = loads(post_content(url, headers=header, post_data=data, decoded=True))
|
||||
return req['data'][0]['url']
|
||||
except Exception as e:
|
||||
raise
|
||||
################################################################################
|
||||
|
||||
|
||||
j = loads(post_content(url, headers=HEADER, post_data=data, decoded=True))
|
||||
return j['data'][0]['url']
|
||||
|
||||
|
||||
def netease_hymn():
|
||||
@ -147,7 +133,7 @@ def netease_video_download(vinfo, output_dir='.', info_only=False):
|
||||
|
||||
def netease_song_download(song, output_dir='.', info_only=False, playlist_prefix=""):
|
||||
title = "%s%s. %s" % (playlist_prefix, song['position'], song['name'])
|
||||
url_best = get_mp3_link(song['id'])
|
||||
url_best = get_mp3_url(song['id'])
|
||||
# songNet = 'p' + song['mp3Url'].split('/')[2][1:]
|
||||
|
||||
# if 'hMusic' in song and song['hMusic'] != None:
|
||||
|
Loading…
Reference in New Issue
Block a user