Created
November 26, 2013 12:29
-
-
Save suziewong/7657556 to your computer and use it in GitHub Desktop.
下载括号君的歌曲
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding=utf-8 | |
import urllib | |
import urllib2 | |
import re | |
##括号君在5sing上的歌曲 | |
urls = ['http://www.5sing.com/poppy/fc/1.html','http://www.5sing.com/poppy/fc/2.html'] | |
music_links = [] | |
for i in urls: | |
source = urllib.urlopen(i).read() | |
matches = re.compile(r'style="display:none"/><a href="(.*?)" target="_blank">(.*?)</a>') | |
music_links += matches.findall(source) | |
for link in music_links: | |
source = urllib.urlopen(link[0]).read() | |
pat = re.compile(r'file: "(.*?)"') | |
mlink = pat.findall(source)[0] | |
urllib.urlretrieve(mlink, 'music/'+link[1]+'.mp3') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment