import re
import urllib
def getHtml(url):
page=urllib.urlopen(url)
html=page.read()
return html
def getpic(html):
s=r‘src="(.*?\.jpg)" pic_ext‘
piclist=re.findall(s,html)
x=0
for imgurl in piclist:
urllib.urlretrieve(imgurl,‘%d.jpg‘%x)
x=x+1
html=getHtml(‘http://tieba.baidu.com/p/3216903619‘)
getpic(html)
时间: 2024-10-13 19:35:39