基于Python实现下载⽹易⾳乐代码实例
代码如下政治权利是什么
# 爬取⽹易⾳乐黄榕被陈小春
import requests
from bs4 import BeautifulSoup
quest
headers = {"origin": "music.163",
"referer": "music.163/",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36"} url = "music.163/playlist?id=2182968685"
response = (url, headers=headers).content
resp = BeautifulSoup(response, "lxml")
mains = resp.find("ul", {"class": "f-hide"})
教师节黑板报图片
lists = []
for music in mains.find_all("a"):
list = []
# 拼装下载地址
musicUrl = 'music.163/song/media/outer/url' + music['href'][5:] + '.mp3'
musicname =
list.append(musicUrl)陈乔恩否认怀孕
list.append(musicname)
lists.append(list)
for i in lists:
url = i[0]
name = i[1]
try:
print("正在下载:{}".format(name))
selina事件
except:
print("下载失败")
结果展⽰
以上就是本⽂的全部内容,希望对⼤家的学习有所帮助,也希望⼤家多多⽀持。
>陈奕迅何韵诗湿吻