fix ina when there is no result
This commit is contained in:
parent
5825b9f304
commit
9aada8824f
1 changed files with 4 additions and 1 deletions
|
|
@ -32,7 +32,10 @@ class SearchPage(BasePage):
|
||||||
URL_REGEXP = re.compile('/video/(.+).html')
|
URL_REGEXP = re.compile('/video/(.+).html')
|
||||||
|
|
||||||
def iter_videos(self):
|
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'):
|
for li in ul.findall('li'):
|
||||||
id = re.sub(r'/video/(.+)\.html', r'\1', li.find('a').attrib['href'])
|
id = re.sub(r'/video/(.+)\.html', r'\1', li.find('a').attrib['href'])
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue