mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge changes from lp:~tomek3d/calibre/store.
This commit is contained in:
commit
0e89e0f2ac
@ -3,7 +3,7 @@
|
|||||||
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
||||||
|
|
||||||
__license__ = 'GPL 3'
|
__license__ = 'GPL 3'
|
||||||
__copyright__ = '2011, Tomasz Długosz <tomek3d@gmail.com>'
|
__copyright__ = '2011-2012, Tomasz Długosz <tomek3d@gmail.com>'
|
||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
import re
|
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'
|
url = 'http://www.nexto.pl/szukaj.xml?search-clause=' + urllib.quote_plus(query) + '&scid=1015'
|
||||||
|
|
||||||
br = browser()
|
br = browser()
|
||||||
|
offset=0
|
||||||
|
|
||||||
counter = max_results
|
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())
|
doc = html.fromstring(f.read())
|
||||||
for data in doc.xpath('//ul[@class="productslist"]/li'):
|
for data in doc.xpath('//ul[@class="productslist"]/li'):
|
||||||
if counter <= 0:
|
if counter <= 0:
|
||||||
@ -85,3 +88,6 @@ class NextoStore(BasicStoreConfig, StorePlugin):
|
|||||||
s.formats = formats.upper().strip()
|
s.formats = formats.upper().strip()
|
||||||
|
|
||||||
yield s
|
yield s
|
||||||
|
if not doc.xpath('//div[@class="listnavigator"]//a[@class="next"]'):
|
||||||
|
break
|
||||||
|
offset+=10
|
||||||
|
Loading…
x
Reference in New Issue
Block a user