Skip to content

Instantly share code, notes, and snippets.

@suziewong
Created November 26, 2013 12:29
Show Gist options
  • Save suziewong/7657556 to your computer and use it in GitHub Desktop.
Save suziewong/7657556 to your computer and use it in GitHub Desktop.
下载括号君的歌曲
# 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