new parameter 'sortby' to searches (relevance, rating, views and date)

This commit is contained in:
Romain Bignon 2010-04-17 17:28:29 +02:00
commit 911cdc134b
5 changed files with 43 additions and 6 deletions

View file

@ -43,11 +43,11 @@ class YoupornBrowser(BaseBrowser):
else:
return str(_id)
def iter_search_results(self, pattern):
def iter_search_results(self, pattern, sortby):
if not pattern:
self.home()
else:
self.location('/search?query=%s' % urllib.quote_plus(pattern))
self.location('/search/%s?query=%s' % (sortby, urllib.quote_plus(pattern)))
assert self.is_on_page(IndexPage)
return self.page.iter_videos()