Get Books: Update the Woblink, Publio and CDP store plugins

This commit is contained in:
Kovid Goyal 2014-02-14 20:43:58 +05:30
commit 8b49425afa
3 changed files with 10 additions and 10 deletions

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import (unicode_literals, division, absolute_import, print_function) 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' __license__ = 'GPL 3'
__copyright__ = '2013, Tomasz Długosz <tomek3d@gmail.com>' __copyright__ = '2013-2014, Tomasz Długosz <tomek3d@gmail.com>'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
import urllib 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 = ''.join(data.xpath('.//div[@class="product-image"]/a[1]/@data-background'))
cover_url = cover_url.split('\'')[1] cover_url = cover_url.split('\'')[1]
title = ''.join(data.xpath('.//div[@class="product-description"]/h2/a/text()')) 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()')) price = ''.join(data.xpath('.//span[@itemprop="price"]/text()'))
counter -= 1 counter -= 1

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import (unicode_literals, division, absolute_import, print_function) 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' __license__ = 'GPL 3'
__copyright__ = '2012-2013, Tomasz Długosz <tomek3d@gmail.com>' __copyright__ = '2012-2014, Tomasz Długosz <tomek3d@gmail.com>'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
import urllib import urllib
@ -64,7 +64,7 @@ class PublioStore(BasicStoreConfig, StorePlugin):
price = ''.join(data.xpath('.//div[@class="priceBox tk-museo-slab"]/ins/text()')) price = ''.join(data.xpath('.//div[@class="priceBox tk-museo-slab"]/ins/text()'))
if not price: if not price:
price = ''.join(data.xpath('.//div[@class="priceBox tk-museo-slab"]/text()')).strip() 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 counter -= 1

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import (unicode_literals, division, absolute_import, print_function) 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' __license__ = 'GPL 3'
__copyright__ = '2011-2013, Tomasz Długosz <tomek3d@gmail.com>' __copyright__ = '2011-2014, Tomasz Długosz <tomek3d@gmail.com>'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
import re import re
@ -44,7 +44,7 @@ class WoblinkStore(BasicStoreConfig, StorePlugin):
d.exec_() d.exec_()
def search(self, query, max_results=10, timeout=60): 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 > 10:
if max_results > 20: if max_results > 20:
url += '&limit=30' url += '&limit=30'
@ -56,7 +56,7 @@ class WoblinkStore(BasicStoreConfig, StorePlugin):
counter = max_results counter = max_results
with closing(br.open(url, timeout=timeout)) as f: with closing(br.open(url, timeout=timeout)) as f:
doc = html.fromstring(f.read()) 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: if counter <= 0:
break break