import urllib
import re
import sys
# redirect std output to a file
sys.stdout = open('linuxinfo.html', 'a')
# match all lines that contain a hyperlink reference
link_pattern = re.compile(r'<a href=\'http://.*')
#open the url and place the results in a file-like object
u = urllib.urlopen('http://www.oreillynet.com/meerkat/?p=5&t=1HOUR&_fl=minimal&_de=0&_ca=0&_ch=0&_da=0')
#extract all the hyperlinks
links = re.findall(link_pattern, u.read())
#disregard the last link in the results, which points to the meerkat-powered logo.
for link in links[:-1]:
print link
#close the connection to the file-like object
u.close()