From 26871566ce548d94a64e8f0684a7bc94f4fb110b Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Mon, 23 Sep 2019 19:01:03 -0400 Subject: [PATCH] Nexto store: remove use of type('') with better xpath There's no need to run regular expressions on a str(list()) of lxml element results, to see if anything contains a string -- simply use the XPath grammar contains() and check if any results were returned. --- src/calibre/gui2/store/stores/nexto_plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/store/stores/nexto_plugin.py b/src/calibre/gui2/store/stores/nexto_plugin.py index c05f2c2e3f..a7f8e7811c 100644 --- a/src/calibre/gui2/store/stores/nexto_plugin.py +++ b/src/calibre/gui2/store/stores/nexto_plugin.py @@ -76,7 +76,7 @@ class NextoStore(BasicStoreConfig, StorePlugin): title = re.sub(r' – ebook', '', title) author = ', '.join(data.xpath('.//div[@class="col-7"]//h4//a/text()')) formats = ', '.join(data.xpath('.//ul[@class="formats"]/li//b/text()')) - DrmFree = re.search(r'znak', type('')(data.xpath('.//ul[@class="formats"]/li//b/@title'))) + DrmFree = data.xpath('.//ul[@class="formats"]/li//b[contains(@title, "znak")]') counter -= 1