Skip to content

Instantly share code, notes, and snippets.

@suziewong suziewong/5sing
Created Nov 26, 2013

Embed
What would you like to do?
下载括号君的歌曲
# 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
You can’t perform that action at this time.