用户登录
用户注册

分享至

Python下载网易云音乐的高清MV

  • 作者: 用户65181654
  • 来源: 51数据库
  • 2022-08-12
#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://www.51sjk.com/Upload/Articles/1/0/320/320378_20220812153926171.jpg"%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)
软件
前端设计
程序设计
Java相关