mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-11 09:13:57 -04:00
Get Books: Update the Woblink, Publio and CDP store plugins
This commit is contained in:
commit
8b49425afa
@ -1,10 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
||||
store_version = 2 # Needed for dynamic plugin loading
|
||||
store_version = 3 # Needed for dynamic plugin loading
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2013, Tomasz Długosz <tomek3d@gmail.com>'
|
||||
__copyright__ = '2013-2014, Tomasz Długosz <tomek3d@gmail.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import urllib
|
||||
@ -58,7 +58,7 @@ class CdpStore(BasicStoreConfig, StorePlugin):
|
||||
cover_url = ''.join(data.xpath('.//div[@class="product-image"]/a[1]/@data-background'))
|
||||
cover_url = cover_url.split('\'')[1]
|
||||
title = ''.join(data.xpath('.//div[@class="product-description"]/h2/a/text()'))
|
||||
author = ''.join(data.xpath('.//div[@class="product-description"]//ul[@class="taxons"]/li[2]/a/text()'))
|
||||
author = ''.join(data.xpath('.//div[@class="product-description"]//ul[@class="taxons"]/li[@class="author"]/a/text()'))
|
||||
price = ''.join(data.xpath('.//span[@itemprop="price"]/text()'))
|
||||
|
||||
counter -= 1
|
||||
|
@ -1,10 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
||||
store_version = 2 # Needed for dynamic plugin loading
|
||||
store_version = 3 # Needed for dynamic plugin loading
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2012-2013, Tomasz Długosz <tomek3d@gmail.com>'
|
||||
__copyright__ = '2012-2014, Tomasz Długosz <tomek3d@gmail.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import urllib
|
||||
@ -64,7 +64,7 @@ class PublioStore(BasicStoreConfig, StorePlugin):
|
||||
price = ''.join(data.xpath('.//div[@class="priceBox tk-museo-slab"]/ins/text()'))
|
||||
if not price:
|
||||
price = ''.join(data.xpath('.//div[@class="priceBox tk-museo-slab"]/text()')).strip()
|
||||
formats = ', '.join(data.xpath('.//div[@class="formats"]/a/img/@alt'))
|
||||
formats = ', '.join(data.xpath('.//div[@class="formats"]/a/text()'))
|
||||
|
||||
counter -= 1
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
||||
store_version = 5 # Needed for dynamic plugin loading
|
||||
store_version = 6 # Needed for dynamic plugin loading
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2011-2013, Tomasz Długosz <tomek3d@gmail.com>'
|
||||
__copyright__ = '2011-2014, Tomasz Długosz <tomek3d@gmail.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import re
|
||||
@ -44,7 +44,7 @@ class WoblinkStore(BasicStoreConfig, StorePlugin):
|
||||
d.exec_()
|
||||
|
||||
def search(self, query, max_results=10, timeout=60):
|
||||
url = 'http://woblink.com/katalog-e-book?query=' + urllib.quote_plus(query.encode('utf-8'))
|
||||
url = 'http://woblink.com/katalog-ebooki?query=' + urllib.quote_plus(query.encode('utf-8'))
|
||||
if max_results > 10:
|
||||
if max_results > 20:
|
||||
url += '&limit=30'
|
||||
@ -56,7 +56,7 @@ class WoblinkStore(BasicStoreConfig, StorePlugin):
|
||||
counter = max_results
|
||||
with closing(br.open(url, timeout=timeout)) as f:
|
||||
doc = html.fromstring(f.read())
|
||||
for data in doc.xpath('//div[@class="nw_katalog_lista_ksiazka"]'):
|
||||
for data in doc.xpath('//div[@class="nw_katalog_lista_ksiazka "]'):
|
||||
if counter <= 0:
|
||||
break
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user