Move the "empty search for latest" to collections
There is now a "latest" collection (or "latest_nsfw"). The feature didn't look much used, since it didn't work on many backends. Using collections will make it easy to support other things like most viewed, featured, etc. As a bonus, I added tests for every backend with the feature.
This commit is contained in:
parent
4d628112d5
commit
e958c229e6
32 changed files with 366 additions and 112 deletions
|
|
@ -36,7 +36,7 @@ class ArteBrowser(BaseBrowser):
|
|||
r'http://videos.arte.tv/\w+/videos/(?P<id>.+)\.html': VideoPage
|
||||
}
|
||||
|
||||
SEARCH_LANG = {'fr': 'recherche', 'de':'suche', 'en': 'search'}
|
||||
SEARCH_LANG = {'fr': 'recherche', 'de': 'suche', 'en': 'search'}
|
||||
|
||||
def __init__(self, lang, quality, *args, **kwargs):
|
||||
BaseBrowser.__init__(self, *args, **kwargs)
|
||||
|
|
@ -52,9 +52,11 @@ class ArteBrowser(BaseBrowser):
|
|||
self.location('http://videos.arte.tv/fr/videos/toutesLesVideos')
|
||||
|
||||
def search_videos(self, pattern):
|
||||
if not pattern:
|
||||
self.home()
|
||||
else:
|
||||
self.location(self.buildurl('/%s/do_search/videos/%s' % (self.lang, self.SEARCH_LANG[self.lang]), q=pattern.encode('utf-8')))
|
||||
self.location(self.buildurl('/%s/do_search/videos/%s' % (self.lang, self.SEARCH_LANG[self.lang]), q=pattern.encode('utf-8')))
|
||||
assert self.is_on_page(IndexPage)
|
||||
return self.page.iter_videos()
|
||||
|
||||
def latest_videos(self):
|
||||
self.home()
|
||||
assert self.is_on_page(IndexPage)
|
||||
return self.page.iter_videos()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue