主讲老师: 柏汌老师
直播时间:20:00
1.数据采集流程以及方式
2.企业爬虫项目创建过程
3.深度解析数据采集规律
4.动态数据采集方式
5.爬虫采集企业级用途方向
6.Python的实际作用及变现方式
进入直播间:https://ke.qq.com/webcourse/index.html#cid=3029344&term_id=103146405&taid=13021533390649696&live=1(实战课程 错过无回放)
学习时间:
学习产出:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2022-05-07 21:27
# @Author : sarahlizi
# @Site :
# @File : 爬虫_music.py
# @Software: PyCharm
import json
import requests
url = "https://music.163.com/weapi/song/enhance/player/url/v1?csrf_token="
payload = 'params=Bhly6%2BBIz3BZRKmgK6U1iuRWyGev28my3mtRs3O%2FUnjNTNvyNV3RSmJd1WbLD6dWmjRBXG7615m%2FaeztZj7ftrlTwqU%2BInwfFBDiF3V8Oh7U7825ERRMDaF6wtbLWmPRw%2FWiii8h0pyw3IgnirdOWA%3D%3D&encSecKey=829f31a9c4a6e8622cf423160d555cb935d48e12f1aeca6f97c7502f2fc4a9d81197932e4865fd10c72ecae5c964bdf587f1e8ac1a355c849bbf33a164df2e251a3eee413c6b1f05673370ca35ab2e651a1c1ee6b232789e00cda1ee033ab2477d66a8ef30753ecc5e0544214ee8df0bdf2ec3fc9224550d9cb44a40934b4092'
headers = {
'accept': '*/*',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36 Edg/101.0.1210.39',
'Content-Type': 'application/x-www-form-urlencoded',
'Cookie': 'NMTID=00OYnwKs2HXaVVl1EYcsjNbNeieKKkAAAGAnrO0Gg'
}
response = requests.request("POST", url, headers=headers, data=payload)
music_url = json.loads(response.text)["data"][0]["url"]
music_id = json.loads(response.text)["data"][0]["id"]
data = requests.get(music_url, params="", headers=headers)
with open("D:/music/{}.mp3".format(music_id), "wb") as f:
f.write(data.content)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)