mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
fetch more than 10 results from kooobe store
This commit is contained in:
parent
dc5e32ae05
commit
4050fc66ae
@ -35,13 +35,14 @@ class KoobeStore(BasicStoreConfig, StorePlugin):
|
||||
d.set_tags(self.config.get('tags', ''))
|
||||
d.exec_()
|
||||
|
||||
def search(self, query, max_results=12, timeout=60):
|
||||
url = 'http://www.koobe.pl/szukaj/fraza:' + urllib.quote(query)
|
||||
def search(self, query, max_results=10, timeout=60):
|
||||
|
||||
br = browser()
|
||||
page=1
|
||||
|
||||
counter = max_results
|
||||
with closing(br.open(url, timeout=timeout)) as f:
|
||||
while counter:
|
||||
with closing(br.open('http://www.koobe.pl/s,p,' + str(page) + ',szukaj/fraza:' + urllib.quote(query), timeout=timeout)) as f:
|
||||
doc = html.fromstring(f.read().decode('utf-8'))
|
||||
for data in doc.xpath('//div[@class="seach_result"]/div[@class="result"]'):
|
||||
if counter <= 0:
|
||||
@ -69,3 +70,6 @@ class KoobeStore(BasicStoreConfig, StorePlugin):
|
||||
s.drm = SearchResult.DRM_UNLOCKED
|
||||
|
||||
yield s
|
||||
if not doc.xpath('//div[@class="site_bottom"]//a[@class="right"]'):
|
||||
break
|
||||
page+=1
|
||||
|
Loading…
x
Reference in New Issue
Block a user