#coding=utf-8
import urllib
import re
def getHtml(url):
page = urllib.urlopen(url)
html = page.read()
return html
def getlink(html):
reg = raw_input('Please input Regular Expression:')
linkre = re.compile(reg)
linklist = re.findall(linkre,html)
return linklist
address = raw_input('Please input url http://')
html = getHtml('http://'+address)
res = getlink(html)
newfile = file('Result.txt','w')
for i in res:
newfile.write(i+'n')
print i
newfile.close()
print 'Find',len(res),'nOutput file : Result.txt'