修改网易云音乐下载逻辑
This commit is contained in:
+3
-1
@@ -1,4 +1,6 @@
|
|||||||
.idea/
|
.idea/
|
||||||
*.iml
|
*.iml
|
||||||
*.iws
|
*.iws
|
||||||
*.ipr
|
*.ipr
|
||||||
|
*.mp3
|
||||||
|
*.mp4
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# @Time : 2026/5/8 10:37
|
||||||
|
# @Author : cmk
|
||||||
|
# @File : WY-music.py
|
||||||
|
# @Email : 15726649712@163.com
|
||||||
|
|
||||||
|
'''
|
||||||
|
简单暴力获取网易云音乐照片或者mv
|
||||||
|
简单测试,无法大批量下载,vip歌曲无法下载
|
||||||
|
'''
|
||||||
|
|
||||||
|
import requests
|
||||||
|
from fake_useragent import UserAgent
|
||||||
|
|
||||||
|
class music():
|
||||||
|
def __init__(self):
|
||||||
|
self.headers = {
|
||||||
|
'User-Agent': UserAgent().random,
|
||||||
|
}
|
||||||
|
def get_data(self,name,url):
|
||||||
|
res = requests.get(url, headers=self.headers)
|
||||||
|
with open(name, 'wb') as f:
|
||||||
|
f.write(res.content)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
music_ = music()
|
||||||
|
name = input("输入音乐 or mv or 照片的名称以及格式.mp3,jpg,mp4:")
|
||||||
|
url = input('输入F12抓包的url:')
|
||||||
|
music_.get_data(name,url)
|
||||||
Binary file not shown.
Binary file not shown.
@@ -1,36 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# @Time : 2024/7/28 下午5:57
|
|
||||||
# @Author : cmk
|
|
||||||
# @File : get_wangyi.py
|
|
||||||
# @Email : 15726649712@163.com
|
|
||||||
|
|
||||||
'''
|
|
||||||
分别获取网易一张照片,一个非vip歌曲,一个mv
|
|
||||||
'''
|
|
||||||
|
|
||||||
import requests
|
|
||||||
|
|
||||||
headers = {
|
|
||||||
'user_agents':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36 OPR/26.0.1656.60',
|
|
||||||
}
|
|
||||||
|
|
||||||
#get image
|
|
||||||
url = 'http://p1.music.126.net/psth_fcCEKjDVXRtijL_DQ==/1383185632930533.jpg'
|
|
||||||
|
|
||||||
res = requests.get(url, headers=headers)
|
|
||||||
with open('test.jpg', 'wb') as f:
|
|
||||||
f.write(res.content)
|
|
||||||
|
|
||||||
#get music
|
|
||||||
url = 'https://m10.music.126.net/20240728182859/1252bdf0083d4ef2fbc4bccd1eff5f4a/yyaac/obj/wonDkMOGw6XDiTHCmMOi/3406609822/defb/9e18/d07d/d1c842849986e5c89dbc4a5cd0358ae6.m4a'
|
|
||||||
|
|
||||||
res = requests.get(url, headers=headers)
|
|
||||||
with open('aaa.mp3', 'wb') as f:
|
|
||||||
f.write(res.content)
|
|
||||||
|
|
||||||
#get mv
|
|
||||||
url = 'https://vodkgeyttp8.vod.126.net/cloudmusic/YiAgMSAgMDUwISAxMiAyYA==/mv/5555628/7508db79ce7ac7c34375f32aec1468ca.mp4?wsSecret=0051ba644c2551997f8b737a114c427f&wsTime=1722161256'
|
|
||||||
res = requests.get(url, headers=headers)
|
|
||||||
with open('aaa.mp4', 'wb') as f:
|
|
||||||
f.write(res.content)
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 32 KiB |
Reference in New Issue
Block a user