py3 porting

This commit is contained in:
Kovid Goyal 2019-09-11 15:55:30 +05:30
parent 2742bd7e29
commit eb37632940
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 5 additions and 5 deletions

View File

@ -58,7 +58,7 @@ class EmpikStore(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://www.empik.com/ebooki/ebooki,3501,s?resultsPP=' + str(max_results) + '&q=' + quote(query) url = 'http://www.empik.com/ebooki/ebooki,3501,s?resultsPP={}&q={}'.format(max_results, quote(query))
br = browser() br = browser()

View File

@ -57,7 +57,7 @@ class NextoStore(BasicStoreConfig, StorePlugin):
counter = max_results counter = max_results
while counter: while counter:
with closing(br.open(url + '&_offset=' + str(offset), timeout=timeout)) as f: with closing(br.open(url + '&_offset={}'.format(offset), timeout=timeout)) as f:
doc = html.fromstring(f.read()) doc = html.fromstring(f.read())
for data in doc.xpath('//ul[@class="productslist"]/li'): for data in doc.xpath('//ul[@class="productslist"]/li'):
if counter <= 0: if counter <= 0:
@ -76,7 +76,7 @@ class NextoStore(BasicStoreConfig, StorePlugin):
title = re.sub(r' ebook', '', title) title = re.sub(r' ebook', '', title)
author = ', '.join(data.xpath('.//div[@class="col-7"]//h4//a/text()')) author = ', '.join(data.xpath('.//div[@class="col-7"]//h4//a/text()'))
formats = ', '.join(data.xpath('.//ul[@class="formats"]/li//b/text()')) formats = ', '.join(data.xpath('.//ul[@class="formats"]/li//b/text()'))
DrmFree = re.search(r'znak', str(data.xpath('.//ul[@class="formats"]/li//b/@title'))) DrmFree = re.search(r'znak', type('')(data.xpath('.//ul[@class="formats"]/li//b/@title')))
counter -= 1 counter -= 1

View File

@ -62,7 +62,7 @@ class PublioStore(BasicStoreConfig, StorePlugin):
counter = max_results counter = max_results
page = 1 page = 1
while counter: while counter:
with closing(br.open('http://www.publio.pl/e-booki,strona' + str(page) + '.html?q=' + quote(query), timeout=timeout)) as f: # noqa with closing(br.open('http://www.publio.pl/e-booki,strona{}.html?q={}'.format(page, quote(query)), timeout=timeout)) as f: # noqa
doc = html.fromstring(f.read()) doc = html.fromstring(f.read())
for data in doc.xpath('//div[@class="products-list"]//div[@class="product-tile"]'): for data in doc.xpath('//div[@class="products-list"]//div[@class="product-tile"]'):
if counter <= 0: if counter <= 0:

View File

@ -63,7 +63,7 @@ class SwiatEbookowStore(BasicStoreConfig, StorePlugin):
counter = max_results counter = max_results
while counter: while counter:
with closing(br.open('https://www.swiatebookow.pl/ebooki/?q=' + quote(query) + '&page=' + str(page), timeout=timeout)) as f: with closing(br.open('https://www.swiatebookow.pl/ebooki/?q=' + quote(query) + '&page={}'.format(page), timeout=timeout)) as f:
doc = html.fromstring(f.read().decode('utf-8')) doc = html.fromstring(f.read().decode('utf-8'))
for data in doc.xpath('//div[@class="category-item-container"]//div[@class="book-large"]'): for data in doc.xpath('//div[@class="category-item-container"]//div[@class="book-large"]'):
if counter <= 0: if counter <= 0: