fix ina when there is no result

This commit is contained in:
Romain Bignon 2010-11-15 12:24:26 +01:00
commit 9aada8824f

View file

@ -32,7 +32,10 @@ class SearchPage(BasePage):
URL_REGEXP = re.compile('/video/(.+).html')
def iter_videos(self):
ul = select(self.document.getroot(), 'div.container-videos ul', 1)
try:
ul = select(self.document.getroot(), 'div.container-videos ul', 1)
except SelectElementException:
return
for li in ul.findall('li'):
id = re.sub(r'/video/(.+)\.html', r'\1', li.find('a').attrib['href'])