import urllib import re urlFile = urllib.urlopen("http://www.mortystv.com/big_brother.shtml") urlRe = re.compile(r"http://www\.youtube\.com/watch\?v=.{11}") for line in urlFile: for match in urlRe.findall(line): print match