#-*- coding=utf8 -*-
import urllib2,os,urllib
baseurl="http://www.baobao88.com"
listurl=baseurl+"/lianbo/1083.html"
localdir='out'
if not os.path.exists(localdir):
os.mkdir(localdir)
starttag='<span class="play">'
urlstart='href="'
urlstop='"'
mp3start='src="/au_play.php?id='
mp3end='"'
html = urllib2.urlopen(listurl).read()
conturllist=html.split(starttag)[2:]
conturl=[]
for ctl in conturllist:
conturl.append(ctl.split(urlstart,1)[1].split(urlstop,1)[0])
mp3url=[]
mp3infostart='mp3:"'
mp3infoend='"'
for url in conturl:
html = urllib2.urlopen(url).read()
#print html[:50], html.split(autotag,1)[1][:50]
mp3id=html.split(mp3start,1)[1].split(mp3end,1)[0]
request = urllib2.Request(baseurl+"/au_play.php?id="+mp3id, headers={"Referer" : url})
html=urllib2.urlopen(request).read()
mp3url.append(html.split(mp3infostart,1)[1].split(mp3infoend,1)[0])
downloader = urllib.URLopener()
for mu in mp3url:
localpath=localdir+"\\"+mu.rsplit('/',2)[-2]+".mp3"
print mu, "===>", localpath
request = urllib2.Request(mu, headers={"Referer" : mu})
mp3dat=urllib2.urlopen(request).read()
open(localpath,'wb').write(mp3dat) 批量下载宝宝吧故事集工具
最新推荐文章于 2025-11-18 10:15:01 发布

1069

被折叠的 条评论
为什么被折叠?



