cappedtv: Proper handling of No Results Found
This commit is contained in:
parent
344ab189fc
commit
af82a0d292
2 changed files with 8 additions and 0 deletions
|
|
@ -39,6 +39,11 @@ class CappedVideo(BaseVideo):
|
|||
# parser for search pages
|
||||
class IndexPage(BasePage):
|
||||
def iter_videos(self):
|
||||
# When no results are found, the website returns random results
|
||||
sb = self.parser.select(self.document.getroot(), 'div.search form input.searchbox', 1)
|
||||
if sb.value == 'No Results Found':
|
||||
return
|
||||
|
||||
#Extracting meta data from results page
|
||||
vidbackdrop_list = self.parser.select(self.document.getroot(), 'div.vidBackdrop ')
|
||||
for vidbackdrop in vidbackdrop_list:
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ class CappedTest(BackendTest):
|
|||
self.assertTrue(v.url and v.url.startswith('http://'), 'URL for video "%s" not found: %s' % (v.id, v.url))
|
||||
self.backend.browser.openurl(v.url)
|
||||
|
||||
l = list(self.backend.search_videos('weboob'))
|
||||
self.assertTrue(len(l) == 0)
|
||||
|
||||
def test_latest(self):
|
||||
l = list(self.backend.iter_resources([BaseVideo], [u'latest']))
|
||||
self.assertTrue(len(l) > 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue