需求
例如我想把JJ(林俊杰)的一些歌曲给下载下来,例如下图是我通过该平台网页版搜索JJ,灰色的无法下载,黑色的可以下载
去看原文
配置文件
#歌手名
SINGER = 林俊杰
# 保存路径
SAVE_PATH = Result/Music
代码
#coding=utf-8
#主函数
# 此代码仅供学习参考,请勿恶意爬虫
from Util import FileUtil, downloadMusic, useSelenium, FuncUtil
import sys
if __name__ == '__main__':
conf = FileUtil.getConf("Conf/conf.ini")
broswer, broswerPid = useSelenium.createBrowser(conf.get("MUSIC", "SEARCH_URL"))
try:
songIds = useSelenium.parser(broswer,conf)
FuncUtil.terminatePid(broswerPid)
except Exception as e:
print(e)
FuncUtil.terminatePid(broswerPid)
songIds = [x for x in songIds if "song" in x]
print("We find total " + str(len(songIds)) + " songs, start to download...")
netEasy = downloadMusic.NetEasyMusic(conf, songIds)
netEasy.run()
结果
原文有源码,更多内容,请关注地学数据处理分析。