# -*- coding: UTF-8 -*-
from urllib import request
import re
class mycrawl:
def get_html(url):
response = request.urlopen(url)
html = response.read()
html = html.decode("utf-8")
return html
def get_image(htmlCode):
reg=r'src="(.+?\.jpg)" width'
regc=re.compile(reg)
imgList=regc.findall(htmlCode)
return imgList
if __name__=='__main__':
print ('请输入url:')
URL=input()
html_Code=mycrawl.get_html("http://tieba.baidu.com/p/1753935195")
imag1=mycrawl.get_image(html_Code)
if imag1:
for i in imag1:
print (i)
else:
print("null")