Using Python to download the HD Mv_python of NetEase Cloud Music

Source: Internet
Author: User

Python download NetEase cloud music HD MV, not from the home page into the analysis, direct circulation ....

downpage1.py

Copy Code code as follows:

#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)

The above is the entire code that this article shares, hoped everybody can like.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.