使用Python实现下载网易云音乐的高清MV
作者:hebedich 时间:2022-08-07 17:30:52
Python下载网易云音乐的高清MV,没有从首页进去解析,直接循环了....
downPage1.py
#coding=utf-8
import urllib
import re
import os
def getHtml(url):
page = urllib.urlopen(url)
html = page.read()
return html
def getVideo(html):
reg = r'hurl=(.+?\.jpg)'
imgre = re.compile(reg)
imglist = re.findall(imgre,html)
return imglist
for num in range(28000,1000000):
print num
html = getHtml("http://music.163.com/mv?id=%s"%num)
parsed = getVideo(html)
if len(parsed)==0:
continue
vedioUrls = parsed[0].split("&")
artist = vedioUrls[4].split("=")[1].decode('utf-8').strip()
song = vedioUrls[3].split("=")[1].decode('utf-8').strip()
if len(vedioUrls[0])==0:
continue
filename = '%s/%s.mp4' %(artist,song)
if "/" in song:
continue
if os.path.exists(filename):
print 'the MV file exists.%s'%num
else:
print 'the MV is downloding.%s'%num
if os.path.exists(artist):
print ""
else:
os.makedirs(artist)
urllib.urlretrieve(vedioUrls[0],filename)
标签:Python,下载,高清MV
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python实现简单的飞机大战游戏
2023-08-28 01:50:50
![](https://img.aspxhome.com/file/2023/2/135112_0s.jpg)
vscode检测到#include错误请更新includePath的解决方法
2022-10-14 22:58:04
![](https://img.aspxhome.com/file/2023/8/117498_0s.png)
SQL Server 2008+ Reporting Services (SSRS)使用USER登录问题
2024-01-15 18:21:30
简化SQL Server备份与还原到云工作原理及操作方法
2024-01-18 14:27:36
![](https://img.aspxhome.com/file/2023/2/91202_0s.png)
asp如何让浏览器在https和http之间转化?
2010-05-13 16:37:00
python 平衡二叉树实现代码示例
2022-04-24 03:20:34
![](https://img.aspxhome.com/file/2023/4/134874_0s.png)
python中getattr函数使用方法 getattr实现工厂模式
2021-02-25 00:34:30
javascrip关于继承的小例子
2024-04-22 22:17:49
javascript实现延时显示提示框效果
2024-04-25 13:10:42
![](https://img.aspxhome.com/file/2023/0/135550_0s.gif)
Python Socket 编程知识点详细介绍
2021-10-28 16:31:29
![](https://img.aspxhome.com/file/2023/0/128770_0s.webp)
Python生成随机密码
2022-04-02 19:21:19
Python浮点数取整、格式化和NaN处理的操作方法
2023-01-12 11:41:19
![](https://img.aspxhome.com/file/2023/9/107629_0s.png)
Python实现word2Vec model过程解析
2023-10-07 14:22:10
![](https://img.aspxhome.com/file/2023/4/63254_0s.jpg)
从Node.js事件触发器到Vue自定义事件的深入讲解
2024-05-03 15:54:28
vant中的toast轻提示实现代码
2024-04-26 17:38:53
![](https://img.aspxhome.com/file/2023/5/133165_0s.jpg)
js date 格式化
2024-04-30 10:10:36
numpy给array增加维度np.newaxis的实例
2023-06-30 06:41:34
使用opencv中匹配点对的坐标提取方式
2022-12-02 00:32:54
![](https://img.aspxhome.com/file/2023/7/118007_0s.jpg)
Php header()函数语法及使用代码
2023-09-04 13:32:20
pyqt5 键盘监听按下enter 就登陆的实例
2022-03-04 08:12:31