def scrapePlay(self, playLink, playType): title = self.strip(playLink.get_text()) print("PLAY: "+str(title)+" a "+playType) play = Play(None, title, playType) url = playLink.attrs['href'] playKey = url.split("/")[0] play.urlkey = playKey play = self.storePlay(play) scenes = self.getPage("http://shakespeare.mit.edu/"+url) links = scenes.findAll("a", href=re.compile("^("+playKey+")\.[0-9]\.[0-9]\.(html)")) for link in links: url = link.attrs["href"] urlSplit = url.split(".") scene = Scene(None, play, urlSplit[1], urlSplit[2]) self.getScene(url, scene)