Get Books: Load more than 10 results from nextto

This commit is contained in:
Kovid Goyal 2012-03-17 20:51:00 +05:30
commit 15fb4c1ea0

View File

@ -3,7 +3,7 @@
from __future__ import (unicode_literals, division, absolute_import, print_function)
__license__ = 'GPL 3'
__copyright__ = '2011, Tomasz Długosz <tomek3d@gmail.com>'
__copyright__ = '2011-2012, Tomasz Długosz <tomek3d@gmail.com>'
__docformat__ = 'restructuredtext en'
import re
@ -47,9 +47,12 @@ class NextoStore(BasicStoreConfig, StorePlugin):
url = 'http://www.nexto.pl/szukaj.xml?search-clause=' + urllib.quote_plus(query) + '&scid=1015'
br = browser()
offset=0
counter = max_results
with closing(br.open(url, timeout=timeout)) as f:
while counter:
with closing(br.open(url + '&_offset=' + str(offset), timeout=timeout)) as f:
doc = html.fromstring(f.read())
for data in doc.xpath('//ul[@class="productslist"]/li'):
if counter <= 0:
@ -85,3 +88,6 @@ class NextoStore(BasicStoreConfig, StorePlugin):
s.formats = formats.upper().strip()
yield s
if not doc.xpath('//div[@class="listnavigator"]//a[@class="next"]'):
break
offset+=10