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
50dd0acc53
@ -42,9 +42,8 @@ class EbookpointStore(BasicStoreConfig, StorePlugin):
|
|||||||
d.set_tags(self.config.get('tags', ''))
|
d.set_tags(self.config.get('tags', ''))
|
||||||
d.exec_()
|
d.exec_()
|
||||||
|
|
||||||
def search(self, query, max_results=10, timeout=60):
|
def search(self, query, max_results=25, timeout=60):
|
||||||
url = 'http://ebookpoint.pl/search.scgi?szukaj=' + urllib.quote(query) + '&serwisyall=0&x=0&y=0'
|
url = 'http://ebookpoint.pl/search.scgi?szukaj=' + urllib.quote_plus(query.decode('utf-8').encode('iso-8859-2')) + '&serwisyall=0&x=0&y=0'
|
||||||
ebook_string = 'eBook.'
|
|
||||||
|
|
||||||
br = browser()
|
br = browser()
|
||||||
|
|
||||||
@ -60,19 +59,19 @@ class EbookpointStore(BasicStoreConfig, StorePlugin):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
cover_url = ''.join(data.xpath('.//a[@class="cover"]/img/@src'))
|
cover_url = ''.join(data.xpath('.//a[@class="cover"]/img/@src'))
|
||||||
title = ''.join(data.xpath('.//h3/a/text()'))
|
title = ''.join(data.xpath('.//h3/a/@title'))
|
||||||
title = re.sub(ebook_string, '', title)
|
title = re.sub('eBook.', '', title)
|
||||||
author = ''.join(data.xpath('.//p[@class="author"]/text()'))
|
author = ''.join(data.xpath('.//p[@class="author"]/text()'))
|
||||||
price = ''.join(data.xpath('.//p[@class="price"]/ins/text()'))
|
price = ''.join(data.xpath('.//p[@class="price"]/ins/text()'))
|
||||||
|
|
||||||
with closing(br.open(id.strip(), timeout=timeout)) as nf:
|
with closing(br.open(id.strip(), timeout=timeout)) as nf:
|
||||||
idata = html.fromstring(nf.read())
|
idata = html.fromstring(nf.read())
|
||||||
formats = ', '.join(idata.xpath('//div[@class="col-left"]/h2[contains(., "' + ebook_string + '")]/@class'))
|
formats = ', '.join(idata.xpath('//dd[@class="radio-line"]/label/text()'))
|
||||||
|
|
||||||
counter -= 1
|
counter -= 1
|
||||||
|
|
||||||
s = SearchResult()
|
s = SearchResult()
|
||||||
s.cover_url = 'http://ebookpoint.pl' + cover_url
|
s.cover_url = 'http://ebookpoint.pl' + re.sub('72x9', '65x8',cover_url)
|
||||||
s.title = title.strip()
|
s.title = title.strip()
|
||||||
s.author = author.strip()
|
s.author = author.strip()
|
||||||
s.price = re.sub(r'\.',',',price)
|
s.price = re.sub(r'\.',',',price)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user