欢迎光临
我们一直在努力

Python爬虫实战 QQ音乐爬取全部歌曲

前景介绍

最近小伙伴们听歌的兴趣大涨,网抑云综合症已经遍布各地。
咱们再来抬高一波QQ音乐的热度吧。
私信小编01即可获取大量Python学习资料


爬它!

目标:歌手列表
任务:将A到Z的歌手以及全部页数的歌存到本地和数据库

观察网页url结构

当我们进入网页时发现此时是一个无参数的html网页加载。

 

 

寻找我们想要拿到的位置寻找变化,但我们点击A开头的网页跳转时,发现 url 改变了,index 参数应该是首字母,page 参数应该是页数变化。

 

?
这样的话就减少一个找参数的时间啦。

找到XML

还是习惯的点开检查按键,找到首字母的作者提供的XML都需要什么参数,随便点点A-Z发现 XML 有一个请求蹦出来,里面返回了是个 json 数据集,都点开看看发现找到了每个作者的参数了。成功了一小半!

 

?

既然拿到了XML的网站,POST请求是一定的啦,接下来就该分析分析网站所需要的参数都是什么了,大致猜测一下,这么多数据中sign和data参数有点诡异,不像是正常的参数,加密参数也找到了。

 

?

破解sign加密参数

search 找一下sign都在哪里。因为sign应该是个变量,所以说在他后面加个=会查找的更精确一些。找到一个sign参数的位置,这应该是个JavaScript代码,那就应该是这里面了。点进去!

 

?
在JavaScript中找到了 sign 的位置,找到了一个JavaScript调用的网站,我们进去看看是什么代码在里面。

 

?
当我们进入网站之后,代码有点乱我们在线格式化一下看看里面是什么。

 

?
格式化代码后发现这个里面含有sign参数。这个应该是sign的加密算法,但是其中传了一个参数进入,我们需要了解一下他传了什么参数,这样我们的sign就出来了。

 

?
回到我们调用JavaScript网站的文件中,继续往下看,我们发现 sign 传数值就在他的下部。我们看到了传了个data给这个sign加密函数,点断点看看data参数是什么。这data值看的好眼熟,这不是一开始很奇怪那个参数data么。原来data弄出来了sign就能给出来的。

 

?
我们继续找刚才的sign。点击下一次跳转我们发现我们找到另一个函数在里面,产生了一种疑惑,这个函数是做什么的,他为什么会跳向这里。

 

?
那我们先看看我们格式化出来的JavaScript到底能不能运行吧。说不定能运行呢。

 

?
哦吼,能运行,那就好办了,看看他返回的参数到底是啥,在开头定义一个sign=null,将t返回给sign,再把sign打印出来。这是刚才的那个跳转过去的方法。

 

?
原来如此,那我们将sign调用一下加个(),我们就能发现sign的值就出现了。但我们重复运行发现我们无法得到他的加密值,因为这些都是一样的。

 

?
回想我们刚才说的话,他需要加一个data参数才可以获得加密参数,那好再改一下。

 

?
首先我们先下载一个python调用JavaScript的库。pip install PyExecJS
开始写python代码

import execjs

def get_sign(data):
    with open('a.js','r',encoding='utf-8') as f:
        text = f.read()
    js_data = execjs.compile(text)
    sign = js_data.call('get_sign',data)
    return sign
    
if __name__ == "__main__":
    data = '{"comm":{"ct":24,"cv":0},"singerList":{"module":"Music.SingerListServer","method":"get_singer_list","param":{"area":-100,"sex":-100,"genre":-100,"index":2,"sin":0,"cur_page":1}}}'
    sign = get_sign(data)
    print(data)
    print(sign)

这是多次调用代码的结果,发现data传入成功了。

 

?

获取歌手个数以及页数

个数其实一开始我们已经拿到了,只不过那时候没介绍,仔细的童鞋们应该是看到了总数到底为多少个。我们点开刚才的返回json结果就能看到total已经给出来当前的个数了。

 

?
现在该分析一下data参数,盲猜一通估计page和index都在data里面,要不然这个参数传不上去呀。好的分析一下data到底有啥,咱拿过来看看。data里面看到了get_singer_list这个应该是主要的东西。

# 这个是 A开头 第一页
#{"comm":{"ct":24,"cv":0},"singerList":{"module":"Music.SingerListServer","method":"get_singer_list","param":{"area":-100,"sex":-100,"genre":-100,"index":1,"sin":0,"cur_page":1}}}
# 这个是 B开头 第一页
#{"comm":{"ct":24,"cv":0},"singerList":{"module":"Music.SingerListServer","method":"get_singer_list","param":{"area":-100,"sex":-100,"genre":-100,"index":2,"sin":0,"cur_page":1}}}
# 这个是 B开头 第二页
#{"comm":{"ct":24,"cv":0},"singerList":{"module":"Music.SingerListServer","method":"get_singer_list","param":{"area":-100,"sex":-100,"genre":-100,"index":2,"sin":80,"cur_page":2}}}
# 这个是 B开头 第三页
#{"comm":{"ct":24,"cv":0},"singerList":{"module":"Music.SingerListServer","method":"get_singer_list","param":{"area":-100,"sex":-100,"genre":-100,"index":2,"sin":160,"cur_page":3}}}

大致我们能分析出来。

  • 字母的变化在 index 处,也就是A到Z以及后面的# 应该是一共27个在里面,也就是index从1到27我们需要传给他。
  • 页数的变化在 sin 这里,第一页是0,第二页就是80,第三页是160,冷静分析一下应该是从0开始以80为公差的等差数列。这个八十应该是代表每一页都含有八十个歌手。
  • cur_page应该就是当前页数的意思。那咱们跟着sin一起改变。

那在这我们拿到了总数,加上每一页总共能展示多少,因为多出来的个数需要占一页才可以,我们使用向下取整

获取作者名字以及id号

我们根据上述写出来爬虫代码后,就可以成功获取 json 的返回值了,在里面我们能看到一个歌手的参数一共有五个,其中 singer_mid 和 singer_name 是我们所需要的。拿到这两个值后可以进入网站下载当前歌手的歌曲。

 

?

寻找歌手的歌曲

我们随意点进去一个歌手,进去后寻找XML的网站,我在这里找好了是 getSingerSong 变量。
在这里能获取歌手的每首歌的所能拿到的结果。

 

?
我们看一下里面都需要什么参数,好像和上次的差不多哦。sign已经获取到了,data是给定的变量。单纯的data有点变化,但问题不大。那说明还是能正常访问这个XML的。
data中有点变化的位置就是 singerMid ,这个参数我们在刚才已经获取到了。直接在里面引用一下就好了。begin的参数是一个歌手歌的页数,num是一页中包括多少歌曲。其实我们传参数可以将这个参数改一下的。把num的值改到一个很大的值,我们就可以不需要改变begin的参数就能拿到所有的歌曲结果。

 

?
我们仔细找一下 json 里面的参数,点击音乐链接进入发现是https://y.qq.com/n/yqq/song/002MQlds19S8qy.html,我们能发现,在这个歌曲里面的 mid 参数就是每首歌的格式化位置。

 

?

寻找下载歌曲的m4a链接

我们点入播放中。寻找里面的m4a链接看看都包含什么参数,发现存在七个链接都是。但我们仔细一看歌曲的大小我们就会发现,前几个都是有问题的发包,一首歌怎么可能只有几kb呢。毫不犹豫点进去最后一个。

 

?
哦吼,这回参数不一样了哦。那我们在重新分析一下下吧别懒了。

 

?
我们先查找一下他给出来的一些包,看看能不能找到一个非加密参数出来。
果然,功夫不负有心人。vkey 就不是个加密参数!

 

?

破解参数前先学会"投机取巧"

我不知道刚才有没有仔细看这个位置,发现这个也是个很长的字符串,但是他很特殊,特殊到它和m4a的url是一样的。

 

?
为了让你们看到,我在这里把这俩写出来,发现到他们差了什么。不变的字符串前缀。。

# C400002wiewH40saXM.m4a?guid=9232644380&vkey=A6F8B706468C0ECFE0F8B6E5E8AAD783D5F852ED0CA66692EB1033B209080BE61208609BEBC2EAF66FA86AC887C8C9F03C02A152E2EF4E24&uin=0&fromtag=66
# https://isure.stream.qqmusic.qq.com/C400002wiewH40saXM.m4a?guid=9232644380&vkey=A6F8B706468C0ECFE0F8B6E5E8AAD783D5F852ED0CA66692EB1033B209080BE61208609BEBC2EAF66FA86AC887C8C9F03C02A152E2EF4E24&uin=0&fromtag=66

那我们先看看vkey到底需要什么参数给进去。其他参数还是都那些,还是差了一个data需要给进去的。咱们分析一下data都需要给啥吧。

 

?

# {"req":{"module":"CDN.SrfCdnDispatchServer","method":"GetCdnDispatch","param":{"guid":"9232644380","calltype":0,"userip":""}},"req_0":{"module":"vkey.GetVkeyServer","method":"CgiGetVkey","param":{"guid":"9232644380","songmid":["002MQlds19S8qy"],"songtype":[0],"uin":"0","loginflag":1,"platform":"20"}},"comm":{"uin":0,"format":"json","ct":24,"cv":0}}

大致分析了一下

  • guid是个无用参数。
  • songmid 是歌曲的 mid,我们刚才已经获取了
  • uin 需要加入一个qq号才可以获取,如果未登陆默认为0
  • 其他都是定死的参数

m4a文件是一个二进制文件。所以说我们写代码一定要写入二进制文件才可以。

代码优化

  1. 因为数据量过大,日常存入数据库
  2. 因为数据下载量大,使用多进程爬取。将A-Z及#各开一个进程
  3. 防止存入数据库在多线程阶段同时占用,上锁

全部代码

crawl.py

#Python3.7 
#encoding = utf-8
import execjs,requests,math,os,threading
from urllib import parse
from concurrent.futures import ThreadPoolExecutor,ProcessPoolExecutor
from db import SQLsession,Song
lock = threading.Lock()
headers = {
    'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36',
    'Referer':'https://y.qq.com/portal/singer_list.html',
}
session = SQLsession()
def get_sign(data):
    with open('./QQ音乐/get_sign.js','r',encoding='utf-8') as f:
        text = f.read()
    js_data = execjs.compile(text)
    sign = js_data.call('get_sign',data)
    return sign
def myProcess():
    #把歌手按照首字母分为27类
    with ProcessPoolExecutor(max_workers = 2) as p:#创建27个进程
        for i in range(1,28):
            p.submit(get_singer_mid,i)
def get_singer_mid(index):
    #index =  1-----27
    #打开歌手列表页面,找出singerList,找出所有歌手的数目,除于80,构造后续页面获取page歌手
    #找出mid, 用于歌手详情页
    data = '{"comm":{"ct":24,"cv":0},"singerList":'
        '{"module":"Music.SingerListServer","method":"get_singer_list","param":'
        '{"area":-100,"sex":-100,"genre":-100,"index":%s,"sin":0,"cur_page":1}}}'%(str(index))
    sign = get_sign(data)
    url = 'https://u.y.qq.com/cgi-bin/musics.fcg?-=getUCGI6720748185279282&g_tk=5381'
        '&sign={}'
        '&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8'
        '?ice=0&platform=yqq.json&needNewCode=0'
        '&data={}'.format(sign,parse.quote(data)) 
    html = requests.get(url,headers = headers).json()
    total = html['singerList']['data']['total']#多少个歌手
    pages = int(math.floor(int(total)/80))#向下取整
    thread_number = pages
    Thread = ThreadPoolExecutor(max_workers = thread_number)
    sin = 0
    #分页迭代每一个字母下的所有页面歌手
    for page in range(1,pages+2):
        data = '{"comm":{"ct":24,"cv":0},"singerList":{"module":"Music.SingerListServer","method":"get_singer_list","param":{"area":-100,"sex":-100,"genre":-100,"index":%s,"sin":%s,"cur_page":%s}}}'%(str(index),str(sin),str(page))
        sign = get_sign(data)
        url = 'https://u.y.qq.com/cgi-bin/musics.fcg?-=getUCGI6720748185279282&g_tk=5381'
            '&sign={}'
            '&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8'
            '?ice=0&platform=yqq.json&needNewCode=0'
            '&data={}'.format(sign,parse.quote(data)) 
        html = requests.get(url,headers = headers).json()
        sings = html['singerList']['data']['singerlist']
        for sing in sings:
            singer_name = sing['singer_name']   #获取歌手名字
            mid = sing['singer_mid']            #获取歌手mid
            Thread.submit(get_singer_data,mid = mid,
                            singer_name = singer_name,)
        sin+=80
#获取歌手信息
def get_singer_data(mid,singer_name):
    #获取歌手mid,进入歌手详情页,也就是每一个歌手歌曲所在页面
    #找出歌手的歌曲信息页
    data = '{"comm":{"ct":24,"cv":0},"singerSongList":{"method":"GetSingerSongList","param":'
            '{"order":1,"singerMid":"%s","begin":0,"num":10}'
            ',"module":"musichall.song_list_server"}}'%(str(mid))
    sign = get_sign(data)
    url = 'https://u.y.qq.com/cgi-bin/musics.fcg?-=getSingerSong4707786209273719'
        '&g_tk=5381&sign={}&loginUin=0'
        '&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8?ice=0&platform=yqq.json&needNewCode=0'
        '&data={}'.format(sign,parse.quote(data))
    html = requests.get(url,headers = headers).json()
    songs_num = html['singerSongList']['data']['totalNum']
    for number in range(0,songs_num,100):
        data = '{"comm":{"ct":24,"cv":0},"singerSongList":{"method":"GetSingerSongList","param":'
            '{"order":1,"singerMid":"%s","begin":%s,"num":%s}'
            ',"module":"musichall.song_list_server"}}'%(str(mid),str(number),str(songs_num))
        sign = get_sign(data)
        url = 'https://u.y.qq.com/cgi-bin/musics.fcg?-=getSingerSong4707786209273719'
            '&g_tk=5381&sign={}&loginUin=0'
            '&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8?ice=0&platform=yqq.json&needNewCode=0'
            '&data={}'.format(sign,parse.quote(data))
        html = requests.get(url,headers = headers).json()
        datas = html['singerSongList']['data']['songList']
        for d in datas:
            sing_name = d['songInfo']['title']
            song_mid = d['songInfo']['mid']
            try:
                lock.acquire()
                session.add(Song(song_name = sing_name,
                                song_singer = singer_name,
                                song_mid = song_mid))
                session.commit()
                lock.release()
                print('commit')
            except:                
                session.rollback()
                print('rollbeak')
            print('歌手名字:{}	歌曲名字:{}	歌曲ID:{}'.format(singer_name,sing_name,song_mid))
            download(song_mid,sing_name,singer_name)
def download(song_mid,sing_name,singer_name):
    qq_number = '请在这里写你的qq号'
    try:qq_number = str(int(qq_number))
    except:raise 'qq号未填写'
    data = '{"req":{"module":"CDN.SrfCdnDispatchServer","method":"GetCdnDispatch"'
        ',"param":{"guid":"4803422090","calltype":0,"userip":""}},'
        '"req_0":{"module":"vkey.GetVkeyServer","method":"CgiGetVkey",'
        '"param":{"guid":"4803422090","songmid":["%s"],"songtype":[0],'
        '"uin":"%s","loginflag":1,"platform":"20"}},"comm":{"uin":%s,"format":"json","ct":24,"cv":0}}'%(str(song_mid),str(qq_number),str(qq_number))
    sign = get_sign(data)    
    url = 'https://u.y.qq.com/cgi-bin/musics.fcg?-=getplaysongvkey27494207511290925'
        '&g_tk=1291538537&sign={}&loginUin={}'
        '&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8?ice=0'
        '&platform=yqq.json&needNewCode=0&data={}'.format(sign,qq_number,parse.quote(data))
    html = requests.get(url,headers = headers).json()
    try:
        purl = html['req_0']['data']['midurlinfo'][0]['purl']
        url = 'http://119.147.228.27/amobile.music.tc.qq.com/{}'.format(purl)
        html = requests.get(url,headers = headers)
        html.encoding = 'utf-8'
        sing_file_name = '{} -- {}'.format(sing_name,singer_name)
        filename = './QQ音乐/歌曲'
        if not os.path.exists(filename):
            os.makedirs(filename)
        with open('./QQ音乐/歌曲/{}.m4a'.format(sing_file_name),'wb') as f:
            print('
正在下载{}歌曲.....
'.format(sing_file_name))
            f.write(html.content) 
    except:
        print('查询权限失败,或没有查到对应的歌曲')
if __name__ == "__main__":
    myProcess()

db.py

from sqlalchemy import Column,Integer,String,create_engine
from sqlalchemy.orm import  sessionmaker,scoped_session
from sqlalchemy.ext.declarative import declarative_base
#此处没有使用pymysql的驱动
#请安装pip install mysql-connector-python
#engine中的 mysqlconnector 为 mysql官网驱动
engine = create_engine('mysql+mysqlconnector://root:root@localhost:3306/test?charset=utf8',
                   max_overflow = 500,#超过连接池大小外最多可以创建的链接
                   pool_size = 100,#连接池大小
                   echo = False,#调试信息展示
			)
Base = declarative_base()
class Song(Base):
    __tablename__ = 'song'
    song_id = Column(Integer,primary_key = True,autoincrement = True)
    song_name = Column(String(64))
    song_ablum = Column(String(64))
    song_mid = Column(String(50))
    song_singer = Column(String(50))
Base.metadata.create_all(engine)
DBsession = sessionmaker(bind = engine)
SQLsession = scoped_session(DBsession)

get_sign.js

this.window = this;
var sign = null;

!function(n, t) {
    "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (n = n || self).getSecuritySign = t()
} (this,
function() {
    "use strict";
    var n = function() {
        if ("undefined" != typeof self) return self;
        if ("undefined" != typeof window) return window;
        if ("undefined" != typeof global) return global;
        throw new Error("unable to locate global object")
    } ();
    n.__sign_hash_20200305 = function(n) {
        function l(n, t) {
            var o = (65535 & n) + (65535 & t);
            return (n >> 16) + (t >> 16) + (o >> 16) << 16 | 65535 & o
        }
        function r(n, t, o, e, u, p) {
            return l((i = l(l(t, n), l(e, p))) << (r = u) | i >>> 32 - r, o);
            var i, r
        }
        function g(n, t, o, e, u, p, i) {
            return r(t & o | ~t & e, n, t, u, p, i)
        }
        function a(n, t, o, e, u, p, i) {
            return r(t & e | o & ~e, n, t, u, p, i)
        }
        function s(n, t, o, e, u, p, i) {
            return r(t ^ o ^ e, n, t, u, p, i)
        }
        function v(n, t, o, e, u, p, i) {
            return r(o ^ (t | ~e), n, t, u, p, i)
        }
        function t(n) {
            return function(n) {
                var t, o = "";
                for (t = 0; t < 32 * n.length; t += 8) o += String.fromCharCode(n[t >> 5] >>> t % 32 & 255);
                return o
            } (function(n, t) {
                n[t >> 5] |= 128 << t % 32,
                n[14 + (t + 64 >>> 9 << 4)] = t;
                var o, e, u, p, i, r = 1732584193,
                f = -271733879,
                h = -1732584194,
                c = 271733878;
                for (o = 0; o < n.length; o += 16) r = g(e = r, u = f, p = h, i = c, n[o], 7, -680876936),
                c = g(c, r, f, h, n[o + 1], 12, -389564586),
                h = g(h, c, r, f, n[o + 2], 17, 606105819),
                f = g(f, h, c, r, n[o + 3], 22, -1044525330),
                r = g(r, f, h, c, n[o + 4], 7, -176418897),
                c = g(c, r, f, h, n[o + 5], 12, 1200080426),
                h = g(h, c, r, f, n[o + 6], 17, -1473231341),
                f = g(f, h, c, r, n[o + 7], 22, -45705983),
                r = g(r, f, h, c, n[o + 8], 7, 1770035416),
                c = g(c, r, f, h, n[o + 9], 12, -1958414417),
                h = g(h, c, r, f, n[o + 10], 17, -42063),
                f = g(f, h, c, r, n[o + 11], 22, -1990404162),
                r = g(r, f, h, c, n[o + 12], 7, 1804603682),
                c = g(c, r, f, h, n[o + 13], 12, -40341101),
                h = g(h, c, r, f, n[o + 14], 17, -1502002290),
                r = a(r, f = g(f, h, c, r, n[o + 15], 22, 1236535329), h, c, n[o + 1], 5, -165796510),
                c = a(c, r, f, h, n[o + 6], 9, -1069501632),
                h = a(h, c, r, f, n[o + 11], 14, 643717713),
                f = a(f, h, c, r, n[o], 20, -373897302),
                r = a(r, f, h, c, n[o + 5], 5, -701558691),
                c = a(c, r, f, h, n[o + 10], 9, 38016083),
                h = a(h, c, r, f, n[o + 15], 14, -660478335),
                f = a(f, h, c, r, n[o + 4], 20, -405537848),
                r = a(r, f, h, c, n[o + 9], 5, 568446438),
                c = a(c, r, f, h, n[o + 14], 9, -1019803690),
                h = a(h, c, r, f, n[o + 3], 14, -187363961),
                f = a(f, h, c, r, n[o + 8], 20, 1163531501),
                r = a(r, f, h, c, n[o + 13], 5, -1444681467),
                c = a(c, r, f, h, n[o + 2], 9, -51403784),
                h = a(h, c, r, f, n[o + 7], 14, 1735328473),
                r = s(r, f = a(f, h, c, r, n[o + 12], 20, -1926607734), h, c, n[o + 5], 4, -378558),
                c = s(c, r, f, h, n[o + 8], 11, -2022574463),
                h = s(h, c, r, f, n[o + 11], 16, 1839030562),
                f = s(f, h, c, r, n[o + 14], 23, -35309556),
                r = s(r, f, h, c, n[o + 1], 4, -1530992060),
                c = s(c, r, f, h, n[o + 4], 11, 1272893353),
                h = s(h, c, r, f, n[o + 7], 16, -155497632),
                f = s(f, h, c, r, n[o + 10], 23, -1094730640),
                r = s(r, f, h, c, n[o + 13], 4, 681279174),
                c = s(c, r, f, h, n[o], 11, -358537222),
                h = s(h, c, r, f, n[o + 3], 16, -722521979),
                f = s(f, h, c, r, n[o + 6], 23, 76029189),
                r = s(r, f, h, c, n[o + 9], 4, -640364487),
                c = s(c, r, f, h, n[o + 12], 11, -421815835),
                h = s(h, c, r, f, n[o + 15], 16, 530742520),
                r = v(r, f = s(f, h, c, r, n[o + 2], 23, -995338651), h, c, n[o], 6, -198630844),
                c = v(c, r, f, h, n[o + 7], 10, 1126891415),
                h = v(h, c, r, f, n[o + 14], 15, -1416354905),
                f = v(f, h, c, r, n[o + 5], 21, -57434055),
                r = v(r, f, h, c, n[o + 12], 6, 1700485571),
                c = v(c, r, f, h, n[o + 3], 10, -1894986606),
                h = v(h, c, r, f, n[o + 10], 15, -1051523),
                f = v(f, h, c, r, n[o + 1], 21, -2054922799),
                r = v(r, f, h, c, n[o + 8], 6, 1873313359),
                c = v(c, r, f, h, n[o + 15], 10, -30611744),
                h = v(h, c, r, f, n[o + 6], 15, -1560198380),
                f = v(f, h, c, r, n[o + 13], 21, 1309151649),
                r = v(r, f, h, c, n[o + 4], 6, -145523070),
                c = v(c, r, f, h, n[o + 11], 10, -1120210379),
                h = v(h, c, r, f, n[o + 2], 15, 718787259),
                f = v(f, h, c, r, n[o + 9], 21, -343485551),
                r = l(r, e),
                f = l(f, u),
                h = l(h, p),
                c = l(c, i);
                return [r, f, h, c]
            } (function(n) {
                var t, o = [];
                for (o[(n.length >> 2) - 1] = void 0, t = 0; t < o.length; t += 1) o[t] = 0;
                for (t = 0; t < 8 * n.length; t += 8) o[t >> 5] |= (255 & n.charCodeAt(t / 8)) << t % 32;
                return o
            } (n), 8 * n.length))
        }
        function o(n) {
            return t(unescape(encodeURIComponent(n)))
        }
        return function(n) {
            var t, o, e = "0123456789abcdef",
            u = "";
            for (o = 0; o < n.length; o += 1) t = n.charCodeAt(o),
            u += e.charAt(t >>> 4 & 15) + e.charAt(15 & t);
            return u
        } (o(n))
    },
    function r(f, h, c, l, g) {
        g = g || [[this], [{}]];
        for (var t = [], o = null, n = [function() {
            return ! 0
        },
        function() {},
        function() {
            g.length = c[h++]
        },
        function() {
            g.push(c[h++])
        },
        function() {
            g.pop()
        },
        function() {
            var n = c[h++],
            t = g[g.length - 2 - n];
            g[g.length - 2 - n] = g.pop(),
            g.push(t)
        },
        function() {
            g.push(g[g.length - 1])
        },
        function() {
            g.push([g.pop(), g.pop()].reverse())
        },
        function() {
            g.push([l, g.pop()])
        },
        function() {
            g.push([g.pop()])
        },
        function() {
            var n = g.pop();
            g.push(n[0][n[1]])
        },
        function() {
            g.push(g[g.pop()[0]][0])
        },
        function() {
            var n = g[g.length - 2];
            n[0][n[1]] = g[g.length - 1]
        },
        function() {
            g[g[g.length - 2][0]][0] = g[g.length - 1]
        },
        function() {
            var n = g.pop(),
            t = g.pop();
            g.push([t[0][t[1]], n])
        },
        function() {
            var n = g.pop();
            g.push([g[g.pop()][0], n])
        },
        function() {
            var n = g.pop();
            g.push(delete n[0][n[1]])
        },
        function() {
            var n = [];
            for (var t in g.pop()) n.push(t);
            g.push(n)
        },
        function() {
            g[g.length - 1].length ? g.push(g[g.length - 1].shift(), !0) : g.push(void 0, !1)
        },
        function() {
            var n = g[g.length - 2],
            t = Object.getOwnPropertyDescriptor(n[0], n[1]) || {
                configurable: !0,
                enumerable: !0
            };
            t.get = g[g.length - 1],
            Object.defineProperty(n[0], n[1], t)
        },
        function() {
            var n = g[g.length - 2],
            t = Object.getOwnPropertyDescriptor(n[0], n[1]) || {
                configurable: !0,
                enumerable: !0
            };
            t.set = g[g.length - 1],
            Object.defineProperty(n[0], n[1], t)
        },
        function() {
            h = c[h++]
        },
        function() {
            var n = c[h++];
            g[g.length - 1] && (h = n)
        },
        function() {
            throw g[g.length - 1]
        },
        function() {
            var n = c[h++],
            t = n ? g.slice( - n) : [];
            g.length -= n,
            g.push(g.pop().apply(l, t))
        },
        function() {
            var n = c[h++],
            t = n ? g.slice( - n) : [];
            g.length -= n;
            var o = g.pop();
            g.push(o[0][o[1]].apply(o[0], t))
        },
        function() {
            var n = c[h++],
            t = n ? g.slice( - n) : [];
            g.length -= n,
            t.unshift(null),
            g.push(new(Function.prototype.bind.apply(g.pop(), t)))
        },
        function() {
            var n = c[h++],
            t = n ? g.slice( - n) : [];
            g.length -= n,
            t.unshift(null);
            var o = g.pop();
            g.push(new(Function.prototype.bind.apply(o[0][o[1]], t)))
        },
        function() {
            g.push(!g.pop())
        },
        function() {
            g.push(~g.pop())
        },
        function() {
            g.push(typeof g.pop())
        },
        function() {
            g[g.length - 2] = g[g.length - 2] == g.pop()
        },
        function() {
            g[g.length - 2] = g[g.length - 2] === g.pop()
        },
        function() {
            g[g.length - 2] = g[g.length - 2] > g.pop()
        },
        function() {
            g[g.length - 2] = g[g.length - 2] >= g.pop()
        },
        function() {
            g[g.length - 2] = g[g.length - 2] << g.pop()
        },
        function() {
            g[g.length - 2] = g[g.length - 2] >> g.pop()
        },
        function() {
            g[g.length - 2] = g[g.length - 2] >>> g.pop()
        },
        function() {
            g[g.length - 2] = g[g.length - 2] + g.pop()
        },
        function() {
            g[g.length - 2] = g[g.length - 2] - g.pop()
        },
        function() {
            g[g.length - 2] = g[g.length - 2] * g.pop()
        },
        function() {
            g[g.length - 2] = g[g.length - 2] / g.pop()
        },
        function() {
            g[g.length - 2] = g[g.length - 2] % g.pop()
        },
        function() {
            g[g.length - 2] = g[g.length - 2] | g.pop()
        },
        function() {
            g[g.length - 2] = g[g.length - 2] & g.pop()
        },
        function() {
            g[g.length - 2] = g[g.length - 2] ^ g.pop()
        },
        function() {
            g[g.length - 2] = g[g.length - 2] in g.pop()
        },
        function() {
            g[g.length - 2] = g[g.length - 2] instanceof g.pop()
        },
        function() {
            g[g[g.length - 1][0]] = void 0 === g[g[g.length - 1][0]] ? [] : g[g[g.length - 1][0]]
        },
        function() {
            for (var e = c[h++], u = [], n = c[h++], t = c[h++], p = [], o = 0; o < n; o++) u[c[h++]] = g[c[h++]];
            for (var i = 0; i < t; i++) p[i] = c[h++];
            g.push(function n() {
                var t = u.slice(0);
                t[0] = [this],
                t[1] = [arguments],
                t[2] = [n];
                for (var o = 0; o < p.length && o < arguments.length; o++) 0 < p[o] && (t[p[o]] = [arguments[o]]);
                return r(f, e, c, l, t)
            })
        },
        function() {
            t.push([c[h++], g.length, c[h++]])
        },
        function() {
            t.pop()
        },
        function() {
            return !! o
        },
        function() {
            o = null
        },
        function() {
            g[g.length - 1] += String.fromCharCode(c[h++])
        },
        function() {
            g.push("")
        },
        function() {
            g.push(void 0)
        },
        function() {
            g.push(null)
        },
        function() {
            g.push(!0)
        },
        function() {
            g.push(!1)
        },
        function() {
            g.length -= c[h++]
        },
        function() {
            g[g.length - 1] = c[h++]
        },
        function() {
            var n = g.pop(),
            t = g[g.length - 1];
            t[0][t[1]] = g[n[0]][0]
        },
        function() {
            var n = g.pop(),
            t = g[g.length - 1];
            t[0][t[1]] = n[0][n[1]]
        },
        function() {
            var n = g.pop(),
            t = g[g.length - 1];
            g[t[0]][0] = g[n[0]][0]
        },
        function() {
            var n = g.pop(),
            t = g[g.length - 1];
            g[t[0]][0] = n[0][n[1]]
        },
        function() {
            g[g.length - 2] = g[g.length - 2] < g.pop()
        },
        function() {
            g[g.length - 2] = g[g.length - 2] <= g.pop()
        }];;) try {
            for (; ! n[c[h++]](););
            if (o) throw o;
            return g.pop()
        } catch(n) {
            var e = t.pop();
            if (void 0 === e) throw n;
            o = n,
            h = e[0],
            g.length = e[1],
            e[2] && (g[e[2]][0] = o)
        }
    } (120731, 0, [21, 34, 50, 100, 57, 50, 102, 50, 98, 99, 101, 52, 54, 97, 52, 99, 55, 56, 52, 49, 57, 54, 57, 49, 56, 98, 102, 100, 100, 48, 48, 55, 55, 102, 2, 10, 3, 2, 9, 48, 61, 3, 9, 48, 61, 4, 9, 48, 61, 5, 9, 48, 61, 6, 9, 48, 61, 7, 9, 48, 61, 8, 9, 48, 61, 9, 9, 48, 4, 21, 427, 54, 2, 15, 3, 2, 9, 48, 61, 3, 9, 48, 61, 4, 9, 48, 61, 5, 9, 48, 61, 6, 9, 48, 61, 7, 9, 48, 61, 8, 9, 48, 61, 9, 9, 48, 61, 10, 9, 48, 61, 11, 9, 48, 61, 12, 9, 48, 61, 13, 9, 48, 61, 14, 9, 48, 61, 10, 9, 55, 54, 97, 54, 98, 54, 99, 54, 100, 54, 101, 54, 102, 54, 103, 54, 104, 54, 105, 54, 106, 54, 107, 54, 108, 54, 109, 54, 110, 54, 111, 54, 112, 54, 113, 54, 114, 54, 115, 54, 116, 54, 117, 54, 118, 54, 119, 54, 120, 54, 121, 54, 122, 54, 48, 54, 49, 54, 50, 54, 51, 54, 52, 54, 53, 54, 54, 54, 55, 54, 56, 54, 57, 13, 4, 61, 11, 9, 55, 54, 77, 54, 97, 54, 116, 54, 104, 8, 55, 54, 102, 54, 108, 54, 111, 54, 111, 54, 114, 14, 55, 54, 77, 54, 97, 54, 116, 54, 104, 8, 55, 54, 114, 54, 97, 54, 110, 54, 100, 54, 111, 54, 109, 14, 25, 0, 3, 4, 9, 11, 3, 3, 9, 11, 39, 3, 1, 38, 40, 3, 3, 9, 11, 38, 25, 1, 13, 4, 61, 12, 9, 55, 13, 4, 61, 13, 9, 3, 0, 13, 4, 4, 3, 13, 9, 11, 3, 11, 9, 11, 66, 22, 306, 4, 21, 422, 24, 4, 3, 14, 9, 55, 54, 77, 54, 97, 54, 116, 54, 104, 8, 55, 54, 102, 54, 108, 54, 111, 54, 111, 54, 114, 14, 55, 54, 77, 54, 97, 54, 116, 54, 104, 8, 55, 54, 114, 54, 97, 54, 110, 54, 100, 54, 111, 54, 109, 14, 25, 0, 3, 10, 9, 55, 54, 108, 54, 101, 54, 110, 54, 103, 54, 116, 54, 104, 15, 10, 40, 25, 1, 13, 4, 61, 12, 9, 6, 11, 3, 10, 9, 3, 14, 9, 11, 15, 10, 38, 13, 4, 61, 13, 9, 6, 11, 6, 5, 1, 5, 0, 3, 1, 38, 13, 4, 61, 0, 5, 0, 43, 4, 21, 291, 61, 3, 12, 9, 11, 0, 3, 9, 9, 49, 72, 0, 2, 3, 4, 13, 4, 61, 8, 9, 21, 721, 3, 2, 8, 3, 2, 9, 48, 61, 3, 9, 48, 61, 4, 9, 48, 61, 5, 9, 48, 61, 6, 9, 48, 61, 7, 9, 48, 4, 55, 54, 115, 54, 101, 54, 108, 54, 102, 8, 10, 30, 55, 54, 117, 54, 110, 54, 100, 54, 101, 54, 102, 54, 105, 54, 110, 54, 101, 54, 100, 32, 28, 22, 510, 4, 21, 523, 22, 4, 55, 54, 115, 54, 101, 54, 108, 54, 102, 8, 10, 0, 55, 54, 119, 54, 105, 54, 110, 54, 100, 54, 111, 54, 119, 8, 10, 30, 55, 54, 117, 54, 110, 54, 100, 54, 101, 54, 102, 54, 105, 54, 110, 54, 101, 54, 100, 32, 28, 22, 566, 4, 21, 583, 3, 4, 55, 54, 119, 54, 105, 54, 110, 54, 100, 54, 111, 54, 119, 8, 10, 0, 55, 54, 103, 54, 108, 54, 111, 54, 98, 54, 97, 54, 108, 8, 10, 30, 55, 54, 117, 54, 110, 54, 100, 54, 101, 54, 102, 54, 105, 54, 110, 54, 101, 54, 100, 32, 28, 22, 626, 4, 21, 643, 25, 4, 55, 54, 103, 54, 108, 54, 111, 54, 98, 54, 97, 54, 108, 8, 10, 0, 55, 54, 69, 54, 114, 54, 114, 54, 111, 54, 114, 8, 55, 54, 117, 54, 110, 54, 97, 54, 98, 54, 108, 54, 101, 54, 32, 54, 116, 54, 111, 54, 32, 54, 108, 54, 111, 54, 99, 54, 97, 54, 116, 54, 101, 54, 32, 54, 103, 54, 108, 54, 111, 54, 98, 54, 97, 54, 108, 54, 32, 54, 111, 54, 98, 54, 106, 54, 101, 54, 99, 54, 116, 27, 1, 23, 56, 0, 49, 444, 0, 0, 24, 0, 13, 4, 61, 8, 9, 55, 54, 95, 54, 95, 54, 103, 54, 101, 54, 116, 54, 83, 54, 101, 54, 99, 54, 117, 54, 114, 54, 105, 54, 116, 54, 121, 54, 83, 54, 105, 54, 103, 54, 110, 15, 21, 1126, 49, 2, 14, 3, 2, 9, 48, 61, 3, 9, 48, 61, 4, 9, 48, 61, 5, 9, 48, 61, 6, 9, 48, 61, 7, 9, 48, 61, 8, 9, 48, 61, 9, 9, 48, 61, 10, 9, 48, 61, 11, 9, 48, 61, 9, 9, 55, 54, 108, 54, 111, 54, 99, 54, 97, 54, 116, 54, 105, 54, 111, 54, 110, 8, 10, 30, 55, 54, 117, 54, 110, 54, 100, 54, 101, 54, 102, 54, 105, 54, 110, 54, 101, 54, 100, 32, 28, 22, 862, 21, 932, 21, 4, 55, 54, 108, 54, 111, 54, 99, 54, 97, 54, 116, 54, 105, 54, 111, 54, 110, 8, 55, 54, 104, 54, 111, 54, 115, 54, 116, 14, 55, 54, 105, 54, 110, 54, 100, 54, 101, 54, 120, 54, 79, 54, 102, 14, 55, 54, 121, 54, 46, 54, 113, 54, 113, 54, 46, 54, 99, 54, 111, 54, 109, 25, 1, 3, 0, 3, 1, 39, 32, 22, 963, 4, 55, 54, 67, 54, 74, 54, 66, 54, 80, 54, 65, 54, 67, 54, 114, 54, 82, 54, 117, 54, 78, 54, 121, 54, 55, 21, 974, 50, 4, 3, 12, 9, 11, 3, 8, 3, 10, 24, 2, 13, 4, 61, 10, 9, 3, 13, 9, 55, 54, 95, 54, 95, 54, 115, 54, 105, 54, 103, 54, 110, 54, 95, 54, 104, 54, 97, 54, 115, 54, 104, 54, 95, 54, 50, 54, 48, 54, 50, 54, 48, 54, 48, 54, 51, 54, 48, 54, 53, 15, 10, 22, 1030, 21, 1087, 22, 4, 3, 13, 9, 55, 54, 95, 54, 95, 54, 115, 54, 105, 54, 103, 54, 110, 54, 95, 54, 104, 54, 97, 54, 115, 54, 104, 54, 95, 54, 50, 54, 48, 54, 50, 54, 48, 54, 48, 54, 51, 54, 48, 54, 53, 15, 3, 9, 9, 11, 3, 3, 9, 11, 38, 25, 1, 13, 4, 61, 11, 9, 3, 12, 9, 11, 3, 10, 3, 53, 3, 37, 39, 24, 2, 13, 4, 4, 55, 54, 122, 54, 122, 54, 97, 3, 11, 9, 11, 38, 3, 10, 9, 11, 38, 0, 49, 771, 2, 1, 12, 9, 13, 8, 3, 12, 4, 4, 56, 0], n);
    var t = n.__getSecuritySign;
    sign = t;
    return t;
});

function get_sign(data){
    return sign(data)
};

 

 收藏 (0) 打赏

您可以选择一种方式赞助本站

支付宝扫一扫赞助

微信钱包扫描赞助

未经允许不得转载:英协网 » Python爬虫实战 QQ音乐爬取全部歌曲

分享到: 生成海报
avatar

热门文章

  • 评论 抢沙发

    • QQ号
    • 昵称 (必填)
    • 邮箱 (必填)
    • 网址

    登录

    忘记密码 ?

    切换登录

    注册

    我们将发送一封验证邮件至你的邮箱, 请正确填写以完成账号注册和激活