From 85974bba5616dec2d64549dd11f5ff14544f00d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20D=C5=82ugosz?= Date: Thu, 3 Aug 2023 23:27:50 +0200 Subject: [PATCH] Get books: update Virtualo store --- src/calibre/gui2/store/stores/virtualo_plugin.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/calibre/gui2/store/stores/virtualo_plugin.py b/src/calibre/gui2/store/stores/virtualo_plugin.py index ba89460bf4..b024029008 100644 --- a/src/calibre/gui2/store/stores/virtualo_plugin.py +++ b/src/calibre/gui2/store/stores/virtualo_plugin.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals -store_version = 10 # Needed for dynamic plugin loading +store_version = 11 # Needed for dynamic plugin loading __license__ = 'GPL 3' -__copyright__ = '2011-2019, Tomasz Długosz ' +__copyright__ = '2011-2023, Tomasz Długosz ' __docformat__ = 'restructuredtext en' import re @@ -41,7 +41,7 @@ class VirtualoStore(BasicStoreConfig, StorePlugin): def open(self, parent=None, detail_item=None, external=False): aff_root = 'https://www.a4b-tracking.com/pl/stat-click-text-link/12/58/' - url = 'http://virtualo.pl/ebook/c2/' + url = 'http://virtualo.pl/ebooki/' aff_url = aff_root + as_base64(url) @@ -58,7 +58,7 @@ class VirtualoStore(BasicStoreConfig, StorePlugin): d.exec() def search(self, query, max_results=12, timeout=60): - url = 'http://virtualo.pl/?q=' + quote(query) + url = 'http://virtualo.pl/?cat=1&q=' + quote(query) br = browser() no_drm_pattern = re.compile(r'Watermark|brak') @@ -66,7 +66,7 @@ class VirtualoStore(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="products-list-wrapper"]//li[@class="product "]'): + for data in doc.xpath('//div[@class="products-list-wrapper"]//li[@class="product"]'): if counter <= 0: break @@ -74,10 +74,10 @@ class VirtualoStore(BasicStoreConfig, StorePlugin): if not id: continue - price = ''.join(data.xpath('.//div[@class="information"]//div[@class="price"]/text()')) + price = ''.join(data.xpath('.//div[@class="info"]//div[@class="price"]/text()')) cover_url = ''.join(data.xpath('.//img[@class="cover"]/@src')) title = ''.join(data.xpath('.//h3[@class="title"]/a//text()')) - author = ', '.join(data.xpath('.//div[@class="information"]//div[@class="authors"]/a//text()')) + author = ', '.join(data.xpath('.//div[@class="info"]//div[@class="authors"]/a//text()')) formats = [form.strip() for form in data.xpath('.//div[@class="text-wrapper"]//div[@class="format"]/span[@class="prompt_preview"]/text()')] nodrm = no_drm_pattern.search(''.join(data.xpath('.//div[@class="protection"]/text()')))